[PATCH] The tooltips of the slide sorter in impress should behave li...

mhofmann (via Code Review) gerrit at gerrit.libreoffice.org
Sun Mar 24 12:18:13 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2969

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/69/2969/1

The tooltips of the slide sorter in impress should behave like the toolbar.

When hovering the mouse over a slide its name is displayed in a tooltip.
If you jump with the mouse from slide to slide the new tooltip is displayed
immediately.
Also remove unused member variables and make tooltip delay configurable.

Change-Id: Ia2347d81620f0ced437beaaeb49d8ad7f41e9333
---
M sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
M sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
M sd/source/ui/slidesorter/view/SlsToolTip.cxx
3 files changed, 22 insertions(+), 17 deletions(-)



diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index 99b089d..a4e03da 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -37,7 +37,6 @@
 
 namespace sd { namespace slidesorter { namespace view {
 
-const int Theme_ToolTipDelay = 1000;
 const int Theme_FocusIndicatorWidth = 3;
 
 /** Collection of colors and styles that are used to paint the slide sorter
diff --git a/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
index 01bc50e..bc26e73 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
@@ -55,10 +55,10 @@
 private:
     SlideSorter& mrSlideSorter;
     model::SharedPageDescriptor mpDescriptor;
-    ::rtl::OUString msDefaultHelpText;
     ::rtl::OUString msCurrentHelpText;
     sal_uLong mnHelpWindowHandle;
-    Timer maTimer;
+    Timer maShowTimer;
+    Timer maHiddenTimer;
 
     /** Request to show the tool tip.
         @param bForce
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index f28aa53..c0babd7 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -33,13 +33,16 @@
 
 ToolTip::ToolTip (SlideSorter& rSlideSorter)
     : mrSlideSorter(rSlideSorter),
-      msDefaultHelpText(),
       msCurrentHelpText(),
       mnHelpWindowHandle(0),
-      maTimer()
+      maShowTimer(),
+      maHiddenTimer()
 {
-    maTimer.SetTimeout(Theme_ToolTipDelay);
-    maTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
+    SharedSdWindow window = rSlideSorter.GetContentWindow();
+    const HelpSettings& rHelpSettings = window->GetSettings().GetHelpSettings();
+    maShowTimer.SetTimeout(rHelpSettings.GetTipDelay());
+    maShowTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
+    maHiddenTimer.SetTimeout(rHelpSettings.GetTipDelay());
 }
 
 
@@ -47,19 +50,23 @@
 
 ToolTip::~ToolTip (void)
 {
-    maTimer.Stop();
+    maShowTimer.Stop();
+    maHiddenTimer.Stop();
     Hide();
 }
-
-
 
 
 void ToolTip::SetPage (const model::SharedPageDescriptor& rpDescriptor)
 {
     if (mpDescriptor != rpDescriptor)
     {
-        maTimer.Stop();
-        Hide();
+        maShowTimer.Stop();
+        bool bWasVisible = Hide();
+
+        if (bWasVisible)
+        {
+            maHiddenTimer.Start();
+        }
 
         mpDescriptor = rpDescriptor;
 
@@ -79,13 +86,12 @@
                 sHelpText += OUString::number(mpDescriptor->GetPageIndex()+1);
             }
 
-            msDefaultHelpText = sHelpText;
             msCurrentHelpText = sHelpText;
-            Show(false);
+            // show new tooltip immediately, if last one was recently hidden
+            Show(maHiddenTimer.IsActive());
         }
         else
         {
-            msDefaultHelpText = OUString();
             msCurrentHelpText = OUString();
         }
     }
@@ -98,7 +104,7 @@
     if (bNoDelay)
         DoShow();
     else
-        maTimer.Start();
+        maShowTimer.Start();
 }
 
 
@@ -106,7 +112,7 @@
 
 void ToolTip::DoShow (void)
 {
-    if (maTimer.IsActive())
+    if (maShowTimer.IsActive())
     {
         // The delay timer is active.  Wait for it to trigger the showing of
         // the tool tip.

-- 
To view, visit https://gerrit.libreoffice.org/2969
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2347d81620f0ced437beaaeb49d8ad7f41e9333
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: mhofmann <borim7 at web.de>



More information about the LibreOffice mailing list