diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-12-04 15:11:23 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-12-04 19:24:58 +0400 |
commit | 68c1f757962a8f2789821ff636bc397d1edd0051 (patch) | |
tree | e4f151220bd1a610dfadfc18a390ac3eb1413c44 /starmath | |
parent | 558b5ea32a99654dcb63526f107726f7aec4747f (diff) |
visual formula editor: implement selection by mouse
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/view.hxx | 1 | ||||
-rw-r--r-- | starmath/source/view.cxx | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index d716e72f9c07..5781e26c09f0 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -103,6 +103,7 @@ public: // Window virtual void MouseButtonDown(const MouseEvent &rMEvt); + virtual void MouseMove(const MouseEvent &rMEvt); virtual void GetFocus(); virtual void LoseFocus(); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index c9a0ffdf75d9..4dbc8a8897ad 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -182,9 +182,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt) return; if (IsInlineEditEnabled()) { - // if it was clicked inside the formula then get the appropriate node - if (pTree->OrientedDist(aPos) <= 0) - pViewShell->GetDoc()->GetCursor().MoveTo(this, aPos, !rMEvt.IsShift()); + pViewShell->GetDoc()->GetCursor().MoveTo(this, aPos, !rMEvt.IsShift()); return; } const SmNode *pNode = 0; @@ -214,6 +212,22 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt) } } +void SmGraphicWindow::MouseMove(const MouseEvent &rMEvt) +{ + ScrollableWindow::MouseMove(rMEvt); + + if (rMEvt.IsLeft() && IsInlineEditEnabled()) + { + Point aPos(PixelToLogic(rMEvt.GetPosPixel()) - GetFormulaDrawPos()); + pViewShell->GetDoc()->GetCursor().MoveTo(this, aPos, false); + + CaretBlinkStop(); + SetIsCursorVisible(true); + CaretBlinkStart(); + RepaintViewShellDoc(); + } +} + bool SmGraphicWindow::IsInlineEditEnabled() const { return pViewShell->IsInlineEditEnabled(); |