[Libreoffice-commits] .: 2 commits - starmath/inc starmath/source starmath/visual-editor-todo
Jonas Finnemann Jensen
jopsen at kemper.freedesktop.org
Mon Nov 15 10:18:21 PST 2010
starmath/inc/view.hxx | 8 +++++++-
starmath/source/view.cxx | 44 +++++++++++++++++++++++++++++++++++++++++++-
starmath/visual-editor-todo | 2 ++
3 files changed, 52 insertions(+), 2 deletions(-)
New commits:
commit 2a571807554a495f94861a840827b6a706ecf488
Author: Luke Dixon <6b8b4567 at gmail.com>
Date: Sun Nov 14 21:56:24 2010 +0000
Blinking caret for visual formula editor.
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index f72f64e..cbaf501 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -35,6 +35,7 @@
#include <sfx2/shell.hxx>
#include <sfx2/viewfac.hxx>
#include <sfx2/viewfrm.hxx>
+#include <vcl/timer.hxx>
#include <svtools/colorcfg.hxx>
#include "edit.hxx"
#include "node.hxx"
@@ -56,6 +57,8 @@ class SmGraphicWindow : public ScrollableWindow
// old style editing pieces
Rectangle aCursorRect;
bool bIsCursorVisible;
+
+ AutoTimer aCaretBlinkTimer;
public:
bool IsCursorVisible() const { return bIsCursorVisible; }
void ShowCursor(bool bShow);
@@ -88,7 +91,10 @@ protected:
private:
void RepaintViewShellDoc();
-
+ DECL_LINK(CaretBlinkTimerHdl, AutoTimer *);
+ void CaretBlinkInit();
+ void CaretBlinkStart();
+ void CaretBlinkStop();
public:
SmGraphicWindow(SmViewShell* pShell);
~SmGraphicWindow();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index aee1d24..6d2752d 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -115,6 +115,8 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
SetHelpId(HID_SMA_WIN_DOCUMENT);
SetUniqueId(HID_SMA_WIN_DOCUMENT);
+
+ CaretBlinkInit();
}
SmGraphicWindow::~SmGraphicWindow()
@@ -123,6 +125,7 @@ SmGraphicWindow::~SmGraphicWindow()
pAccessible->ClearWin(); // make Accessible defunctional
// Note: memory for pAccessible will be freed when the reference
// xAccessible is released.
+ CaretBlinkStop();
}
void SmGraphicWindow::StateChanged( StateChangedType eType )
@@ -221,6 +224,7 @@ void SmGraphicWindow::GetFocus()
//Let view shell know what insertions should be done in visual editor
pViewShell->SetInsertIntoEditWindow(false);
SetIsCursorVisible(true);
+ CaretBlinkStart();
RepaintViewShellDoc();
}
@@ -237,7 +241,8 @@ void SmGraphicWindow::LoseFocus()
}
if (!IsInlineEditEnabled())
return;
- SetIsCursorVisible(FALSE);
+ SetIsCursorVisible(false);
+ CaretBlinkStop();
RepaintViewShellDoc();
}
@@ -247,6 +252,39 @@ void SmGraphicWindow::RepaintViewShellDoc()
rDoc.Repaint();
}
+IMPL_LINK( SmGraphicWindow, CaretBlinkTimerHdl, AutoTimer *, EMPTYARG )
+{
+ if (IsCursorVisible())
+ SetIsCursorVisible(false);
+ else
+ SetIsCursorVisible(true);
+
+ RepaintViewShellDoc();
+
+ return 0;
+}
+
+void SmGraphicWindow::CaretBlinkInit()
+{
+ aCaretBlinkTimer.SetTimeoutHdl(LINK(this, SmGraphicWindow, CaretBlinkTimerHdl));
+ aCaretBlinkTimer.SetTimeout( ScrollableWindow::GetSettings().GetStyleSettings().GetCursorBlinkTime() );
+}
+
+void SmGraphicWindow::CaretBlinkStart()
+{
+ if (!IsInlineEditEnabled())
+ return;
+ if ( aCaretBlinkTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
+ aCaretBlinkTimer.Start();
+}
+
+void SmGraphicWindow::CaretBlinkStop()
+{
+ if (!IsInlineEditEnabled())
+ return;
+ aCaretBlinkTimer.Stop();
+}
+
void SmGraphicWindow::ShowCursor(bool bShow)
// shows or hides the formula-cursor depending on 'bShow' is true or not
{
@@ -475,6 +513,10 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
}
}
}
+ CaretBlinkStop();
+ CaretBlinkStart();
+ SetIsCursorVisible(true);
+ RepaintViewShellDoc();
}
commit b7a1d0e97490c468bffc95acbaff94cd708f39eb
Author: Jonas Finnemann Jensen <jopsen at gmail.com>
Date: Sat Nov 6 19:00:13 2010 +0100
Added new task to the todo-list
diff --git a/starmath/visual-editor-todo b/starmath/visual-editor-todo
index 0ccb955..9f19e88 100644
--- a/starmath/visual-editor-todo
+++ b/starmath/visual-editor-todo
@@ -18,6 +18,8 @@ Easy
4. More documentation
5. Replace j_assert with DBG_ASSERT (don't do this yet).
6. Remove the CreateTextFromNode methods and replace calls to it with NodeToTextVisitor
+7. Extend NodeToTextVisitor to update token offsets so SmNode::GetRow and SmNode::GetColumn will work.
+ (These methods can be used to enable synchronization of caret positions between visual and non-visual editor).
Medium
------
More information about the Libreoffice-commits
mailing list