diff --git a/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java b/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
index fb54d8a..b63a59a 100644
|
a
|
b
|
MouseWheelListener {
|
| 82 | 82 | @Override |
| 83 | 83 | public void mouseWheelMoved(MouseWheelEvent e) { |
| 84 | 84 | if (wheelZoomEnabled) { |
| 85 | | map.setZoom(map.getZoom() - e.getWheelRotation(), e.getPoint()); |
| | 85 | int rotation = JMapViewer.zoomReverseWheel ? -e.getWheelRotation() : e.getWheelRotation(); |
| | 86 | map.setZoom(map.getZoom() - rotation, e.getPoint()); |
| 86 | 87 | } |
| 87 | 88 | } |
| 88 | 89 | |
diff --git a/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java b/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
index cc08aa9..79792c9 100644
|
a
|
b
|
public class JMapViewer extends JPanel implements TileLoaderListener {
|
| 46 | 46 | /** whether debug mode is enabled or not */ |
| 47 | 47 | public static boolean debug; |
| 48 | 48 | |
| | 49 | /** option to reverse zoom direction with mouse wheel */ |
| | 50 | public static boolean zoomReverseWheel; |
| | 51 | |
| 49 | 52 | /** |
| 50 | 53 | * Vectors for clock-wise tile painting |
| 51 | 54 | */ |
diff --git a/src/org/openstreetmap/josm/gui/MapMover.java b/src/org/openstreetmap/josm/gui/MapMover.java
index 5580884..21dadf8 100644
|
a
|
b
|
import javax.swing.JComponent;
|
| 20 | 20 | import javax.swing.JPanel; |
| 21 | 21 | import javax.swing.KeyStroke; |
| 22 | 22 | |
| | 23 | import org.openstreetmap.gui.jmapviewer.JMapViewer; |
| | 24 | |
| 23 | 25 | import org.openstreetmap.josm.Main; |
| 24 | 26 | import org.openstreetmap.josm.actions.mapmode.SelectAction; |
| 25 | 27 | import org.openstreetmap.josm.data.coor.EastNorth; |
| | 28 | import org.openstreetmap.josm.data.preferences.BooleanProperty; |
| | 29 | import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; |
| | 30 | import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; |
| 26 | 31 | import org.openstreetmap.josm.tools.Destroyable; |
| 27 | 32 | import org.openstreetmap.josm.tools.Shortcut; |
| 28 | 33 | |
| … |
… |
import org.openstreetmap.josm.tools.Shortcut;
|
| 34 | 39 | */ |
| 35 | 40 | public class MapMover extends MouseAdapter implements MouseMotionListener, MouseWheelListener, Destroyable { |
| 36 | 41 | |
| | 42 | public static final BooleanProperty PROP_ZOOM_REVERSE_WHEEL = new BooleanProperty("zoom.reverse-wheel", false); |
| | 43 | |
| | 44 | private static final JMapViewerUpdater jMapViewerUpdater = new JMapViewerUpdater(); |
| | 45 | |
| | 46 | private static class JMapViewerUpdater implements PreferenceChangedListener { |
| | 47 | |
| | 48 | JMapViewerUpdater() { |
| | 49 | Main.pref.addPreferenceChangeListener(this); |
| | 50 | updateJMapViewer(); |
| | 51 | } |
| | 52 | |
| | 53 | @Override |
| | 54 | public void preferenceChanged(PreferenceChangeEvent e) { |
| | 55 | if (MapMover.PROP_ZOOM_REVERSE_WHEEL.getKey().equals(e.getKey())) { |
| | 56 | updateJMapViewer(); |
| | 57 | } |
| | 58 | } |
| | 59 | |
| | 60 | private void updateJMapViewer() { |
| | 61 | JMapViewer.zoomReverseWheel = MapMover.PROP_ZOOM_REVERSE_WHEEL.get(); |
| | 62 | } |
| | 63 | } |
| | 64 | |
| 37 | 65 | private final class ZoomerAction extends AbstractAction { |
| 38 | 66 | private final String action; |
| 39 | 67 | |
| … |
… |
public class MapMover extends MouseAdapter implements MouseMotionListener, Mouse
|
| 213 | 241 | */ |
| 214 | 242 | @Override |
| 215 | 243 | public void mouseWheelMoved(MouseWheelEvent e) { |
| 216 | | nc.zoomManyTimes(e.getX(), e.getY(), e.getWheelRotation()); |
| | 244 | int rotation = PROP_ZOOM_REVERSE_WHEEL.get() ? -e.getWheelRotation() : e.getWheelRotation(); |
| | 245 | nc.zoomManyTimes(e.getX(), e.getY(), rotation); |
| 217 | 246 | } |
| 218 | 247 | |
| 219 | 248 | /** |
diff --git a/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java b/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
index f30057f..3d80963 100644
|
a
|
b
|
import javax.swing.UIManager.LookAndFeelInfo;
|
| 22 | 22 | |
| 23 | 23 | import org.openstreetmap.josm.Main; |
| 24 | 24 | import org.openstreetmap.josm.actions.ExpertToggleAction; |
| | 25 | import org.openstreetmap.josm.gui.MapMover; |
| 25 | 26 | import org.openstreetmap.josm.gui.dialogs.ToggleDialog; |
| 26 | 27 | import org.openstreetmap.josm.gui.preferences.PreferenceSetting; |
| 27 | 28 | import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; |
| … |
… |
public class LafPreference implements SubPreferenceSetting {
|
| 61 | 62 | private final JCheckBox dynamicButtons = new JCheckBox(tr("Dynamic buttons in side menus")); |
| 62 | 63 | private final JCheckBox isoDates = new JCheckBox(tr("Display ISO dates")); |
| 63 | 64 | private final JCheckBox nativeFileChoosers = new JCheckBox(tr("Use native file choosers (nicer, but do not support file filters)")); |
| | 65 | private final JCheckBox zoomReverseWheel = new JCheckBox(tr("Reverse zoom with mouse wheel")); |
| 64 | 66 | |
| 65 | 67 | @Override |
| 66 | 68 | public void addGui(PreferenceTabbedPane gui) { |
| … |
… |
public class LafPreference implements SubPreferenceSetting {
|
| 140 | 142 | nativeFileChoosers.setSelected(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.get()); |
| 141 | 143 | panel.add(nativeFileChoosers, GBC.eop().insets(20, 0, 0, 0)); |
| 142 | 144 | |
| | 145 | zoomReverseWheel.setToolTipText( |
| | 146 | tr("Check if you feel opposite direction more convenient")); |
| | 147 | zoomReverseWheel.setSelected(MapMover.PROP_ZOOM_REVERSE_WHEEL.get()); |
| | 148 | panel.add(zoomReverseWheel, GBC.eop().insets(20, 0, 0, 0)); |
| | 149 | |
| 143 | 150 | panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0)); |
| 144 | 151 | |
| 145 | 152 | panel.add(new JLabel(tr("Look and Feel")), GBC.std().insets(20, 0, 0, 0)); |
| … |
… |
public class LafPreference implements SubPreferenceSetting {
|
| 161 | 168 | Main.pref.put(ToggleDialog.PROP_DYNAMIC_BUTTONS.getKey(), dynamicButtons.isSelected()); |
| 162 | 169 | Main.pref.put(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected()); |
| 163 | 170 | Main.pref.put(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected()); |
| | 171 | Main.pref.put(MapMover.PROP_ZOOM_REVERSE_WHEEL.getKey(), zoomReverseWheel.isSelected()); |
| 164 | 172 | mod |= Main.pref.put("laf", ((LookAndFeelInfo) lafCombo.getSelectedItem()).getClassName()); |
| 165 | 173 | return mod; |
| 166 | 174 | } |