counter

20081117

Hack GanttProject for mouse wheel behavior

I love GanttProject. Becouse it is most effecient opensource project management tool for me. But I feel discomfort to behavior of mouse wheel. I ofeten use wheel for scrolling. But, in case of GanttProject, mouse wheel assign to zooming operation. I ofeten missoperation and feel frastrations. That's why I made patch and binary for mouse wheel behavior. You can download binary file form following link. This patch changing.
  • 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

  1. Download "ganttproject.jar" from a link above.
  2. Place "ganttproject.jar" to your GanttProject installed folder. (GanttProject Installed folder)\plugins\net.sourceforge.ganttproject_2.0.0
  3. Launch GanttProject.
I post patch for your feference.
Please see for more info.
http://sumimasen2.blogspot.com/2008/11/hack-ganttproject-for-mouse-wheel.html
view raw readme.txt hosted with ❤ by GitHub
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) {
view raw gistfile1.diff hosted with ❤ by GitHub

No comments:

Followers

About Me

Tokyo, Japan
http://iddy.jp/profile/snaka/