tmf: Change time graph mouse wheel behavior
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 22 Jul 2014 19:48:35 +0000 (15:48 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 17 Sep 2014 14:46:35 +0000 (10:46 -0400)
The mouse wheel now scrolls up or down while over the time graph states
area. Zooming in or out can be performed by holding the Ctrl key while
scrolling the mouse wheel.

Change-Id: Ia544bb498a7a6ed9b50eb36f7cf3e2a6bb300400
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/30288
Tested-by: Hudson CI
org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java

index 5083514ebb042d09e2c86c1dd89068c188401465..55602f12d40a7f551f462bf86e2a82be075e0585 100644 (file)
@@ -1467,7 +1467,8 @@ The states flow is usable with the mouse. The following actions are set:
 * '''middle-drag or Ctrl-left-drag horizontally''': pan left or right
 * '''right-drag horizontally''': [[#Zoom region|zoom region]]
 * '''click on a colored bar''': the associated process node is selected and the current time indicator is moved where the click happened
-* '''mouse wheel up/down''': zoom in or out
+* '''mouse wheel up/down''': scroll up or down
+* '''Ctrl-mouse wheel up/down''': zoom in or out
 * '''drag the time ruler horizontally''': zoom in or out with fixed start time
 * '''double-click the time ruler''': reset zoom to full range
 
index 8b433a8ec612417d0c95ad6820303eeacc1aae71..12d4594070d667cbb4fd015c1e3fd1721fbd7d49 100644 (file)
@@ -2356,13 +2356,25 @@ public class TimeGraphControl extends TimeGraphBaseControl
         if (p.x >= 0 && p.x < parentSize.x && p.y >= 0 && p.y < parentSize.y) {
             // over the parent control
             if (e.x > getCtrlSize().x) {
-                // over the horizontal scroll bar
+                // over the vertical scroll bar
                 zoomScroll = false;
-            } else if (e.y >= 0 && e.y < getCtrlSize().y && e.x < fTimeProvider.getNameSpace()) {
-                // over the name space
-                zoomScroll = false;
-            } else {
+            } else if (e.y < 0 || e.y >= getCtrlSize().y) {
+                // over the time scale or horizontal scroll bar
                 zoomScroll = true;
+            } else {
+                if (e.x < fTimeProvider.getNameSpace()) {
+                    // over the name space
+                    zoomScroll = false;
+                } else {
+                    // over the state area
+                    if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+                        // over the state area, CTRL pressed
+                        zoomScroll = true;
+                    } else {
+                        // over the state area, CTRL not pressed
+                        zoomScroll = false;
+                    }
+                }
             }
         }
         if (zoomScroll && fTimeProvider.getTime0() != fTimeProvider.getTime1()) {
This page took 0.031269 seconds and 5 git commands to generate.