/// <summary> /// Key up /// </summary> /// <param name="sender">Sender</param> /// <param name="args">Arguments</param> private void keyPress(object sender, KeyPressEventArgs args) { if (keySymbol != null) { MathSymbol sym = keySymbol.GetSymbol(args); if (sym == null) { return; } sym = Find(sym); if (sym == null) { return; } if (newCursor is MathSymbol) { MathSymbol ds = newCursor as MathSymbol; newCursor = MathSymbolDrawable.InsertObject(ds, sym) as IInsertedObject; } else if (newCursor is MathFormulaDrawable) { MathFormulaDrawable mf = newCursor as MathFormulaDrawable; newCursor = mf.InsertObject(sym) as IInsertedObject; } //newCursor = newCursor.InsertObject(movedSymbol); movedSymbol = null; DrawCursor(); DrawFormulaOnComponent(); oldCursor = movedSymbol as IInsertedObject; control.Cursor = CURSOR_EDIT; } }
/// <summary> /// The "on click" event handler /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> private void onMouseClicked(object sender, MouseEventArgs e) { translate(e); if (movedSymbol == null) { movedSymbol = newSymbol; if (movedSymbol != null) { if (movedSymbol is DateTimeSymbol) { DateTimeSymbol dts = movedSymbol as DateTimeSymbol; dts.DateTime = dateTime.DateTime; } IDrawableSymbol ds = movedSymbol as IDrawableSymbol; wImage = ds.PureDrawable.SymbolImage.Width; hImage = ds.PureDrawable.SymbolImage.Height; control.Cursor = CURSOR_MOVE; oldX = imagePoint.X; oldY = imagePoint.Y; DrawCursor(); if (newCursor != null) { DrawCursor(newCursor, true, true); } } if (newRemoveCursor != null) { MathSymbol s = (MathSymbol)newRemoveCursor; if (s.Contains(newCursor)) { newCursor = null; oldCursor = null; } s.Remove(); newRemoveCursor = null; oldRemoveCursor = null; DrawFormulaOnComponent(); } } else { if (newCursor == null) { movedSymbol = null; DrawCursor(); newCursor = null; oldCursor = null; control.Cursor = CURSOR_EDIT; } else { if (newCursor is MathSymbol) { MathSymbol ds = newCursor as MathSymbol; newCursor = MathSymbolDrawable.InsertObject(ds, movedSymbol) as IInsertedObject; } else if (newCursor is MathFormulaDrawable) { MathFormulaDrawable mf = newCursor as MathFormulaDrawable; newCursor = mf.InsertObject(movedSymbol) as IInsertedObject; } //newCursor = newCursor.InsertObject(movedSymbol); movedSymbol = null; DrawCursor(); DrawFormulaOnComponent(); oldCursor = movedSymbol as IInsertedObject; control.Cursor = CURSOR_EDIT; } } }