Changeset 9572 in josm for trunk/src


Ignore:
Timestamp:
2016-01-23T02:10:43+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #12417 - mapmodes did not listen to preferences change (patch by kolesar)

Location:
trunk/src/org/openstreetmap/josm/actions/mapmode
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r9444 r9572  
    141141        readPreferences();
    142142        snapHelper.init();
     143        readPreferences();
    143144    }
    144145
     
    239240    }
    240241
    241     private void readPreferences() {
     242    @Override
     243    protected void readPreferences() {
    242244        rubberLineColor = Main.pref.getColor(marktr("helper line"), null);
    243245        if (rubberLineColor == null) rubberLineColor = PaintColors.SELECTED.get();
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r9444 r9572  
    295295        Main.map.mapView.addMouseListener(this);
    296296        Main.map.mapView.addMouseMotionListener(this);
    297         readPreferences();
    298297        ignoreNextKeyRelease = true;
    299298        Main.map.keyDetector.addKeyListener(this);
     
    301300    }
    302301
    303     private void readPreferences() {
     302    @Override
     303    protected void readPreferences() {
    304304        initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay", 200);
    305305        initialMoveThreshold = Main.pref.getInteger("extrude.initial-move-threshold", 1);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r9358 r9572  
    142142    }
    143143
    144     private void readPreferences() {
     144    @Override
     145    protected void readPreferences() {
    145146        guideColor = Main.pref.getColor(marktr("improve way accuracy helper line"), null);
    146147        if (guideColor == null) guideColor = PaintColors.HIGHLIGHT.get();
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r9231 r9572  
    1515import org.openstreetmap.josm.tools.ImageProvider;
    1616import org.openstreetmap.josm.tools.Shortcut;
     17import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
     18import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    1719
    1820/**
     
    2224 * MapModes should register/deregister all necessary listeners on the map's view control.
    2325 */
    24 public abstract class MapMode extends JosmAction implements MouseListener, MouseMotionListener {
     26public abstract class MapMode extends JosmAction implements MouseListener, MouseMotionListener, PreferenceChangedListener {
    2527    protected final Cursor cursor;
    2628    protected boolean ctrl;
     
    6365    public void enterMode() {
    6466        putValue("active", Boolean.TRUE);
     67        Main.pref.addPreferenceChangeListener(this);
     68        readPreferences();
    6569        Main.map.mapView.setNewCursor(cursor, this);
    6670        updateStatusLine();
     
    7276    public void exitMode() {
    7377        putValue("active", Boolean.FALSE);
     78        Main.pref.removePreferenceChangeListener(this);
    7479        Main.map.mapView.resetCursor(this);
    7580    }
     
    8388        return "";
    8489    }
     90
     91    protected void readPreferences() {}
    8592
    8693    /**
     
    160167        // Do nothing
    161168    }
     169
     170    @Override
     171    public void preferenceChanged(PreferenceChangeEvent e) {
     172        readPreferences();
     173    }
    162174}
Note: See TracChangeset for help on using the changeset viewer.