Changeset 9824 in josm
- Timestamp:
- 2016-02-18T17:46:28+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r9818 r9824 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; … … 34 39 */ 35 40 public class MapMover extends MouseAdapter implements MouseMotionListener, MouseWheelListener, Destroyable { 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 } 36 64 37 65 private final class ZoomerAction extends AbstractAction { … … 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 -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r9783 r9824 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; … … 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 … … 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 … … 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;
Note:
See TracChangeset
for help on using the changeset viewer.