Re: [Libreoffice] Easy Hack: Don't draw caret when visual formula editor looses focus

2010-11-02 Thread Jonas Finnemann Jensen
Hi Luke,

I thought I'd try one of the visual formula editor easy hacks

Great... Your patch looks fine to me... And works very well too!
I've applied and pushed your patch to the master branch (commit
8137918224bb).
And removed the item from the easy hacks page on the wiki.

This one seemed the easiest of the three there. Hope it's okay.

More than okay: Great! Issues are here to be fixed - not buried in a bug
tracker...

I noticed that you've found and updated the todo list (thanks, btw)...
This means that you know where to find inspiration for more challenging
visual formula editor tasks, should you be interested...
(just, drop me an e-mail, if you are).

I started the visual formula editor feature during GSoC, so if you want to
work on it
or have questions, you're most welcome to e-mail me or ping me on IRC...
(I'm also available if you need some help getting started with the
codebase).

Again, thanks for the patch - that's one item off the todo :)

--
Regards Jonas Finnemann Jensen.


On Mon, Nov 1, 2010 at 23:04, Luke Dixon <6b8b4...@gmail.com> wrote:

> Hello,
>
> I thought I'd try one of the visual formula editor easy hacks, as
> Michael had recommended.
>
> This one seemed the easiest of the three there. Hope it's okay.
>
> Regards,
> Luke
>
>
>
> ___
> LibreOffice mailing list
> LibreOffice@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
>
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Easy Hack: Don't draw caret when visual formula editor looses focus

2010-11-01 Thread Luke Dixon
Hello,

I thought I'd try one of the visual formula editor easy hacks, as
Michael had recommended.

This one seemed the easiest of the three there. Hope it's okay.

Regards,
Luke


>From 9de527f33cd410422e706da547fae67d6a5adbee Mon Sep 17 00:00:00 2001
From: Luke Dixon <6b8b4...@gmail.com>
Date: Mon, 1 Nov 2010 21:57:49 +
Subject: [PATCH] Don't draw caret when visual formula editor looses focus.

---
 starmath/inc/view.hxx   |3 +++
 starmath/source/view.cxx|   14 +-
 starmath/visual-editor-todo |3 +--
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 925b2cc..40c3aab 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -86,6 +86,9 @@ protected:
 virtual void StateChanged( StateChangedType eChanged );
 DECL_LINK(MenuSelectHdl, Menu *);
 
+private:
+void RepaintViewShellDoc();
+
 public:
 SmGraphicWindow(SmViewShell* pShell);
 ~SmGraphicWindow();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 120e3b5..d71283f 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -217,6 +217,8 @@ void SmGraphicWindow::GetFocus()
 pViewShell->GetEditWindow()->Flush();
 //Let view shell know what insertions should be done in visual editor
 pViewShell->SetInsertIntoEditWindow(FALSE);
+SetIsCursorVisible(TRUE);
+RepaintViewShellDoc();
 }
 
 void SmGraphicWindow::LoseFocus()
@@ -230,6 +232,16 @@ void SmGraphicWindow::LoseFocus()
 pAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED,
 aOldValue, aNewValue );
 }
+if (!IsInlineEditEnabled())
+return;
+SetIsCursorVisible(FALSE);
+RepaintViewShellDoc();
+}
+
+void SmGraphicWindow::RepaintViewShellDoc()
+{
+SmDocShell &rDoc = *pViewShell->GetDoc();
+rDoc.Repaint();
 }
 
 void SmGraphicWindow::ShowCursor(BOOL bShow)
@@ -318,7 +330,7 @@ void SmGraphicWindow::Paint(const Rectangle&)
 SetFormulaDrawPos(aPoint);
 if(IsInlineEditEnabled()) {
 //Draw cursor if any...
-if(pViewShell->GetDoc()->HasCursor())
+if(pViewShell->GetDoc()->HasCursor() && IsCursorVisible())
 pViewShell->GetDoc()->GetCursor().Draw(*this, aPoint);
 } else {
 SetIsCursorVisible(FALSE);	// (old) cursor must be drawn again
diff --git a/starmath/visual-editor-todo b/starmath/visual-editor-todo
index 027140f..4317493 100644
--- a/starmath/visual-editor-todo
+++ b/starmath/visual-editor-todo
@@ -24,8 +24,7 @@ Medium
 2. SmCursor` should support deletion of lines, rows, cols and sub-/superscripts.
 3. SmCursor::InsertSubSup() should wrap the body in a SmBraceNode if the body is an SmOperNode, SmBinVerNode, etc.
 4. Make caret in visual editor blink.
-5. Don't draw visual editor caret, when SmGraphicWindow doesn't have focus.
-6. When OpenOffice Math runs in standalone mode it centers the current formula, this is not nice for visual editing.
+5. When OpenOffice Math runs in standalone mode it centers the current formula, this is not nice for visual editing.
 
 Complex
 ---
-- 
1.7.3.1

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