Hi Jonas,

On Tue, 2011-02-15 at 21:51 +0100, Jonas Finnemann Jensen wrote:

> Well, lets just think about writing a note for the next guy, if we
> find a solution :)

I suppose the EditEngine::SetText functions would be be a good place to
start.

>         
> I noticed that 0xFFFF is used in SelectAll... but searching for
> EE_PARA_ALL, gives some results where it's used for creating
> selections, so that's probably what it's a constant for...

It's a small matter, but not sure it is quite right as the 4th argument
but at least there is other code that can be pointed at which does this.

> 
> Unless, you've other ideas, I suggest don't you update your patch,
> then I'll push it... And please update the todo-list, you've just
> fixed one of the complicated issues... :)

Here's the redo of this patch :)

Thanks for all your help :) might not have got there otherwise. Let's
hope it will be okay.

Regards,
Luke

>From e39c1f9efe25e62bae09f3c0aeabaa16db174fb8 Mon Sep 17 00:00:00 2001
From: Luke Dixon <6b8b4...@gmail.com>
Date: Tue, 15 Feb 2011 22:46:54 +0000
Subject: [PATCH] Make Undo & Redo work with the visual formula editor

and update todo list.
---
 starmath/source/cursor.cxx   |    3 ++-
 starmath/source/document.cxx |    1 +
 starmath/visual-editor-todo  |   13 ++++++-------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 8685ee5..e9eb200 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -1461,7 +1461,8 @@ void SmCursor::EndEdit(){
     SmNodeToTextVisitor(pTree, formula);
     //pTree->CreateTextFromNode(formula);
     pDocShell->aText = formula;
-    pDocShell->GetEditEngine().SetText(formula);
+    pDocShell->GetEditEngine().QuickInsertText( formula, ESelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL ) );
+    pDocShell->GetEditEngine().QuickFormatDoc();
 }
 
 void SmCursor::RequestRepaint(){
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index d98c406..eddbe9b 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -1174,6 +1174,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
                     (pTmpUndoMgr->*fnDo)( 0 );
             }
             Repaint();
+            UpdateText();
             SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this );
             while( pFrm )
             {
diff --git a/starmath/visual-editor-todo b/starmath/visual-editor-todo
index b19c1e7..3be3fd2 100644
--- a/starmath/visual-editor-todo
+++ b/starmath/visual-editor-todo
@@ -36,10 +36,9 @@ Complex
 
 Complex and non-essential
 -------------------------
-1. Global clipboard integration
-2. Support undo/redo with UndoManager integration
-3. Consider improving GUI for "Formula Elements"-dialog, most buttons work with visual editor
-4. Consider allowing users to enter commands in visual editor, by prefixing the command...
-5. Optimize things, for instance SmCursor::AnnotateSelection() is called way too many places...
-6. Improve handling of MoveUp and MoveDown in SmCursor::Move, SmCaretPos2LineVisitor might need improvement.
-7. Synchronized command text caret and visual editor caret.
+* Global clipboard integration
+* Consider improving GUI for "Formula Elements"-dialog, most buttons work with visual editor
+* Consider allowing users to enter commands in visual editor, by prefixing the command...
+* Optimize things, for instance SmCursor::AnnotateSelection() is called way too many places...
+* Improve handling of MoveUp and MoveDown in SmCursor::Move, SmCaretPos2LineVisitor might need improvement.
+* Synchronized command text caret and visual editor caret.
-- 
1.7.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to