From 95d225e0f973c819fe342c4865af8db028d965ed Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Thu, 19 Jan 2017 11:30:32 -0500 Subject: [PATCH] tmf: Add lower bound on vertical zoom adjustment This prevents to zoom-out further when all items have the minimum height, so that subsequent zoom-in has an immediate effect. Change-Id: I2c8d2707862a9b7a45390b6d36b5897046e0b545 Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/89129 Reviewed-by: Hudson CI --- .../tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java index 59ee111f75..1696f658b8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2007, 2016 Intel Corporation and others + * Copyright (c) 2007, 2017 Intel Corporation and others * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -164,6 +164,7 @@ public class TimeGraphControl extends TimeGraphBaseControl private boolean fMouseOverSplitLine = false; private int fGlobalItemHeight = CUSTOM_ITEM_HEIGHT; private int fHeightAdjustment = 0; + private int fMaxItemHeight = 0; private Map fFonts = new HashMap<>(); private boolean fBlendSubPixelEvents = false; private int fMinimumItemWidth = 0; @@ -1243,6 +1244,7 @@ public class TimeGraphControl extends TimeGraphBaseControl fHeightAdjustment++; } else { fHeightAdjustment--; + fHeightAdjustment = Math.max(fHeightAdjustment, 1 - fMaxItemHeight); } fItemData.refreshData(); redraw(); @@ -3371,6 +3373,7 @@ public class TimeGraphControl extends TimeGraphBaseControl public void refreshData() { ITimeGraphEntry selection = getSelectedTrace(); Map itemMap = new LinkedHashMap<>(); + fMaxItemHeight = 0; for (int i = 0; i < fRootEntries.length; i++) { ITimeGraphEntry entry = fRootEntries[i]; refreshData(itemMap, null, 0, entry); @@ -3398,6 +3401,7 @@ public class TimeGraphControl extends TimeGraphBaseControl } else { item.fItemHeight = fGlobalItemHeight; } + fMaxItemHeight = Math.max(fMaxItemHeight, item.fItemHeight); item.fItemHeight = Math.max(1, item.fItemHeight + fHeightAdjustment); itemMap.put(entry, item); if (entry.hasChildren()) { -- 2.34.1