diff --git a/pom.xml b/pom.xml index 568c1727..a6410d74 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,10 @@ Ryan Gardner + + Matt Foulks + https://github.com/mfoulks3200 + Martin Geldmacher https://github.com/geld0r diff --git a/src/main/java/com/tagtraum/perf/gcviewer/view/AboutDialog.java b/src/main/java/com/tagtraum/perf/gcviewer/view/AboutDialog.java index 9899ab68..f6146276 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/view/AboutDialog.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/view/AboutDialog.java @@ -43,6 +43,7 @@ public class AboutDialog extends ScreenCenteredDialog implements ActionListener "Cka3o4Huk", "Frank Dietrich", "Bernd Eckenfels", + "Matt Foulks", "Ryan Gardner", "Martin Geldmacher", "Neil Gentleman", diff --git a/src/main/java/com/tagtraum/perf/gcviewer/view/GCDocument.java b/src/main/java/com/tagtraum/perf/gcviewer/view/GCDocument.java index a5897360..87dacec1 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/view/GCDocument.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/view/GCDocument.java @@ -4,8 +4,7 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Point; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; +import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; diff --git a/src/main/java/com/tagtraum/perf/gcviewer/view/GCViewerGui.java b/src/main/java/com/tagtraum/perf/gcviewer/view/GCViewerGui.java index 0b153e8a..a4617b1e 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/view/GCViewerGui.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/view/GCViewerGui.java @@ -4,6 +4,8 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.beans.PropertyVetoException; import java.util.ArrayList; import java.util.List; @@ -27,7 +29,6 @@ public class GCViewerGui extends JFrame { public GCViewerGui() { super("tagtraum industries incorporated - GCViewer"); - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); } diff --git a/src/main/java/com/tagtraum/perf/gcviewer/view/ModelChartImpl.java b/src/main/java/com/tagtraum/perf/gcviewer/view/ModelChartImpl.java index 58f86266..b7675ad6 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/view/ModelChartImpl.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/view/ModelChartImpl.java @@ -11,10 +11,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.SwingPropertyChangeSupport; import java.awt.*; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.DateFormat; @@ -185,6 +182,26 @@ private void maybePopup(MouseEvent e) { } }); + + addMouseWheelListener(new MouseWheelListener() { + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + if (((e.getModifiersEx() & InputEvent.META_DOWN_MASK) != 0 && System.getProperty("os.name").contains("Mac OS X"))||(e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0 && !System.getProperty("os.name").contains("Mac OS X")) { + double pos = (double)(getHorizontalScrollBar().getValue()) / (double)(chart.getWidth()); + if (e.getWheelRotation() > 0 && getScaleFactor() < 100) { + setScaleFactor((getScaleFactor()*1.2)); + } + if (e.getWheelRotation() < 0 && getScaleFactor() > 0.01) { + setScaleFactor((getScaleFactor()/1.2)); + } + if (e.getWheelRotation() != 0) { + getHorizontalScrollBar().setValue((int)(pos * (double)(chart.getWidth()))); + e.consume(); + } + } + } + }); + } public void addTimeOffsetChangeListener(PropertyChangeListener listener) {