- You roll up/down wheel on chart area to scroll up/down.
- You ctrl + roll up/down wheel on chart area to zoom in/out.
Usage
- Download "ganttproject.jar" from a link above.
- Place "ganttproject.jar" to your GanttProject installed folder. (GanttProject Installed folder)\plugins\net.sourceforge.ganttproject_2.0.0
- Launch GanttProject.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please see for more info. | |
http://sumimasen2.blogspot.com/2008/11/hack-ganttproject-for-mouse-wheel.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/ChartComponentBase.java | |
=================================================================== | |
--- D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/ChartComponentBase.java (revision 118) | |
+++ D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/ChartComponentBase.java (working copy) | |
@@ -290,7 +290,14 @@ | |
protected class MouseWheelListenerBase implements MouseWheelListener { | |
public void mouseWheelMoved(MouseWheelEvent e) { | |
- if (isRotationUp(e)) { | |
+ // Scroll | |
+ if (!e.isControlDown()) { | |
+ scrollTreePane(e.getWheelRotation() * 90) | |
+ return | |
+ } | |
+ | |
+ // Zoom | |
+ if (isRotationUp(e)) { | |
fireZoomOut() | |
} else { | |
fireZoomIn() | |
@@ -313,6 +320,9 @@ | |
return e.getWheelRotation() < 0 | |
} | |
} | |
+ | |
+ protected void scrollTreePane(int amount) { | |
+ } | |
protected abstract AbstractChartImplementation getImplementation() | |
Index: D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttGraphicArea.java | |
=================================================================== | |
--- D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttGraphicArea.java (revision 118) | |
+++ D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttGraphicArea.java (working copy) | |
@@ -973,6 +973,13 @@ | |
setActiveInteraction(new MoveTaskInteractions(e, tasks)) | |
} | |
} | |
+ | |
+ /** | |
+ * Scrolling by relative amount. | |
+ */ | |
+ protected void scrollTreePane(int amount) { | |
+ tree.scrollVertical(amount) | |
+ } | |
private class NewChartComponentImpl extends ChartImplementationBase | |
implements ChartImplementation { | |
Index: D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttTree2.java | |
=================================================================== | |
--- D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttTree2.java (revision 118) | |
+++ D:/MyProject/GanttProject/ganttproject/src/net/sourceforge/ganttproject/GanttTree2.java (working copy) | |
@@ -558,6 +558,24 @@ | |
+ (vbar.isVisible() ? vbar.getWidth() : 0), y - vbar.getValue() | |
+ 20) | |
} | |
+ | |
+ /** | |
+ * Scroll up/down | |
+ */ | |
+ public void scrollVertical(int amount) { | |
+ int originalValue = vbar.getValue() | |
+ | |
+ int newValue = originalValue + amount | |
+ | |
+ if (newValue < vbar.getMinimum()) { | |
+ newValue = vbar.getMinimum() | |
+ } | |
+ else if (vbar.getMaximum() < newValue) { | |
+ newValue = vbar.getMaximum() | |
+ } | |
+ | |
+ vbar.setValue(newValue) | |
+ } | |
/** Change grpahic part */ | |
public void setGraphicArea(GanttGraphicArea area) { |
No comments:
Post a Comment