Patch #2842 2009-10-22 22:04

erik_bs

Switcher dialog: Mouse wheel support and hot tracking.
Download
2842-Switcher_dialo.patch (1.3 KB)
Category
Application::Refinement
Status
Accepted
Close date
2009-12-31 16:05
Assigned to
mortenmacfly
Index: switcherdlg.cpp
===================================================================
--- switcherdlg.cpp    (revision 5870)
+++ switcherdlg.cpp    (working copy)
@@ -484,16 +484,49 @@
 
 void wxMultiColumnListCtrl::OnMouseEvent(wxMouseEvent& event)
 {
-    if (event.LeftDown())
+    if (event.GetEventType() == wxEVT_MOUSEWHEEL)
     {
-        SetFocus();
+        int dir = event.GetWheelRotation();
 
+        if (dir > 0)
+        {
+            m_items.SetSelection(m_items.GetSelection() - 1);
+            if (m_items.GetSelection() < 0)
+                m_items.SetSelection(m_items.GetItemCount() - 1);
+
+            AdvanceToNextSelectableItem(-1);
+        }
+        else if (dir < 0)
+        {
+            m_items.SetSelection(m_items.GetSelection() + 1);
+            if (m_items.GetSelection() >= m_items.GetItemCount())
+                m_items.SetSelection(0);
+
+            AdvanceToNextSelectableItem(1);
+        }
+
+        GenerateSelectionEvent();
+
+        Refresh();
+    }
+    else
+    {
         int idx = m_items.HitTest(event.GetPosition());
+
         if (idx != wxNOT_FOUND)
         {
             m_items.SetSelection(idx);
 
+            GenerateSelectionEvent();
+
+            Refresh();
+        }
+
+        if (event.LeftDown())
+        {
             SendCloseEvent();
+
+            SetFocus();
         }
     }
 }
erik_bs 2009-10-22 22:08

Since the browser apparently consumed the description, I re-post the following summary:

The switcher dialog is a convenient way to quickly switch to a currently opened file in your project.

However, certain improvement could make it even more user-friendly. This patch that adds

the following features:

- Hot tracking. Hovering the mouse above an item will now cause that item to be highlighted.

- Mouse wheel support. Allows the user to scroll through the items.

This was functionality was tested on rev. 5870 under Ubuntu 9.04.