diff options
author | Jonas Finnemann Jensen <jopsen@gmail.com> | 2010-10-01 22:04:50 +0200 |
---|---|---|
committer | Jonas Finnemann Jensen <jopsen@gmail.com> | 2010-10-01 23:08:54 +0200 |
commit | 8c340c4270c3e955862f4f56be9fc135a3c2cc43 (patch) | |
tree | 58ca65df035ed3d141bd26319b1e2470455e4198 /starmath/source/edit.cxx | |
parent | c1369970be1d2c0cb19edcac4e1d010635c89730 (diff) |
Integrated the visual formula editor patch
Ported the most recent version of the visual formula editor patch,
to LibreOffice. This patch is not finished yet, see README for more
information.
Diffstat (limited to 'starmath/source/edit.cxx')
-rw-r--r-- | starmath/source/edit.cxx | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 020376c05dfb..d4bde39bbc35 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -121,9 +121,6 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl)); aModifyTimer.SetTimeout(500); - aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl)); - aCursorMoveTimer.SetTimeout(500); - // if not called explicitly the this edit window within the // command window will just show an empty gray panel. Show(); @@ -132,7 +129,6 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : SmEditWindow::~SmEditWindow() { - aCursorMoveTimer.Stop(); aModifyTimer.Stop(); @@ -256,36 +252,6 @@ IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ ) return 0; } - -IMPL_LINK(SmEditWindow, CursorMoveTimerHdl, Timer *, EMPTYARG /*pTimer*/) - // every once in a while check cursor position (selection) of edit - // window and if it has changed (try to) set the formula-cursor - // according to that. -{ - ESelection aNewSelection (GetSelection()); - - if (!aNewSelection.IsEqual(aOldSelection)) - { SmViewShell *pView = rCmdBox.GetView(); - - if (pView) - { - // get row and column to look for - USHORT nRow, nCol; - SmGetLeftSelectionPart(aNewSelection, nRow, nCol); - nRow++; - nCol++; - - pView->GetGraphicWindow().SetCursorPos(nRow, nCol); - - aOldSelection = aNewSelection; - } - } - aCursorMoveTimer.Stop(); - - return 0; -} - - void SmEditWindow::Resize() { if (!pEditView) @@ -319,8 +285,6 @@ void SmEditWindow::MouseButtonUp(const MouseEvent &rEvt) else Window::MouseButtonUp (rEvt); - // ggf FormulaCursor neu positionieren - CursorMoveTimerHdl(&aCursorMoveTimer); InvalidateSlots(); } @@ -425,10 +389,6 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) } else { - // Timer neu starten, um den Handler (auch bei laengeren Eingaben) - // moeglichst nur einmal am Ende aufzurufen. - aCursorMoveTimer.Start(); - DBG_ASSERT( pEditView, "EditView missing (NULL pointer)" ); if (!pEditView) CreateEditView(); @@ -631,7 +591,6 @@ void SmEditWindow::SetText(const XubString& rText) //! Hier die Timer neu zu starten verhindert, dass die Handler fuer andere //! (im Augenblick nicht mehr aktive) Math Tasks aufgerufen werden. aModifyTimer.Start(); - aCursorMoveTimer.Start(); pEditView->SetSelection(eSelection); } @@ -655,6 +614,10 @@ void SmEditWindow::GetFocus() EditEngine *pEditEngine = GetEditEngine(); if (pEditEngine) pEditEngine->SetStatusEventHdl( LINK(this, SmEditWindow, EditStatusHdl) ); + + //Let SmViewShell know we got focus + if(GetView()) + GetView()->SetInsertIntoEditWindow(TRUE); } @@ -737,7 +700,6 @@ void SmEditWindow::InsertCommand(USHORT nCommand) } aModifyTimer.Start(); - aCursorMoveTimer.Start(); GrabFocus(); } @@ -925,7 +887,6 @@ void SmEditWindow::InsertText(const String& Text) { pEditView->InsertText(Text); aModifyTimer.Start(); - aCursorMoveTimer.Start(); } } @@ -943,13 +904,6 @@ void SmEditWindow::Flush() new SfxStringItem(SID_TEXT, GetText()), 0L); } } - - if (aCursorMoveTimer.IsActive()) - { - aCursorMoveTimer.Stop(); - // ggf noch die (neue) FormulaCursor Position setzen - CursorMoveTimerHdl(&aCursorMoveTimer); - } } |