From e5552166cfdc360d0411d39e4c4e1b18e2edfe44 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Tue, 22 Jul 2014 15:48:35 -0400 Subject: [PATCH] tmf: Change time graph mouse wheel behavior 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 Reviewed-on: https://git.eclipse.org/r/30288 Tested-by: Hudson CI --- .../doc/User-Guide.mediawiki | 3 ++- .../timegraph/widgets/TimeGraphControl.java | 22 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki index 5083514ebb..55602f12d4 100644 --- a/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki +++ b/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki @@ -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 diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java index 8b433a8ec6..12d4594070 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java @@ -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()) { -- 2.34.1