Changeset 34510 in osm for applications/editors


Ignore:
Timestamp:
2018-08-18T17:16:12+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/FastDraw
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/build.xml

    r33731 r34510  
    44    <property name="commit.message" value="[josm_fastdraw] Fix incorrect settings saving-2"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="12987"/>
     6    <property name="plugin.main.version" value="14153"/>
    77   
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java

    r33731 r34510  
    22package org.openstreetmap.josm.plugins.fastdraw;
    33
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    5 
    64import java.awt.Color;
    75import java.awt.Stroke;
    8 import java.io.IOException;
    96
    10 import org.openstreetmap.josm.Main;
    117import org.openstreetmap.josm.data.preferences.NamedColorProperty;
    128import org.openstreetmap.josm.gui.util.GuiHelper;
    13 import org.openstreetmap.josm.tools.Logging;
     9import org.openstreetmap.josm.spi.preferences.Config;
    1410
    1511public class FDSettings {
     
    5349
    5450    public void loadPrefs() {
    55         normalStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.normal", "2"));
    56         deleteStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.delete", "3"));
    57         simplifiedStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.simplified", "2"));
     51        normalStroke = GuiHelper.getCustomizedStroke(Config.getPref().get("fastdraw.stroke.normal", "2"));
     52        deleteStroke = GuiHelper.getCustomizedStroke(Config.getPref().get("fastdraw.stroke.delete", "3"));
     53        simplifiedStroke = GuiHelper.getCustomizedStroke(Config.getPref().get("fastdraw.stroke.simplified", "2"));
    5854
    59         bigDotSize = Main.pref.getInt("fastdraw.point.bigsize", 7);
    60         dotSize = Main.pref.getInt("fastdraw.point.normalsize", 5);
     55        bigDotSize = Config.getPref().getInt("fastdraw.point.bigsize", 7);
     56        dotSize = Config.getPref().getInt("fastdraw.point.normalsize", 5);
    6157
    62         maxDist = Main.pref.getDouble("fastdraw.maxdist", 5);
    63         epsilonMult = Main.pref.getDouble("fastdraw.epsilonmult", 1.1);
    64         //deltaLatLon = Main.pref.getDouble("fastdraw.deltasearch", 0.01);
    65         minPixelsBetweenPoints = Main.pref.getDouble("fastdraw.mindelta", 20);
    66         startingEps = Main.pref.getDouble("fastdraw.startingEps", 5);
    67         maxPointsPerKm = Main.pref.getDouble("fastdraw.maxpkm", 150);
    68         pkmBlockSize = Main.pref.getInt("fastdraw.pkmblocksize", 10);
    69         drawLastSegment = Main.pref.getBoolean("fastdraw.drawlastsegment", true);
    70         snapNodes = Main.pref.getBoolean("fastdraw.snapnodes", true);
    71         fixedClick = Main.pref.getBoolean("fastdraw.fixedclick", false);
    72         fixedSpacebar = Main.pref.getBoolean("fastdraw.fixedspacebar", false);
    73         drawClosed = Main.pref.getBoolean("fastdraw.drawclosed", false);
    74         simplifyMode = Main.pref.getInt("fastdraw.simplifymode", 0) % 3;
    75         allowEditExistingWays = Main.pref.getBoolean("fastdraw.alloweditexisting", false);
     58        maxDist = Config.getPref().getDouble("fastdraw.maxdist", 5);
     59        epsilonMult = Config.getPref().getDouble("fastdraw.epsilonmult", 1.1);
     60        //deltaLatLon = Config.getPref().getDouble("fastdraw.deltasearch", 0.01);
     61        minPixelsBetweenPoints = Config.getPref().getDouble("fastdraw.mindelta", 20);
     62        startingEps = Config.getPref().getDouble("fastdraw.startingEps", 5);
     63        maxPointsPerKm = Config.getPref().getDouble("fastdraw.maxpkm", 150);
     64        pkmBlockSize = Config.getPref().getInt("fastdraw.pkmblocksize", 10);
     65        drawLastSegment = Config.getPref().getBoolean("fastdraw.drawlastsegment", true);
     66        snapNodes = Config.getPref().getBoolean("fastdraw.snapnodes", true);
     67        fixedClick = Config.getPref().getBoolean("fastdraw.fixedclick", false);
     68        fixedSpacebar = Config.getPref().getBoolean("fastdraw.fixedspacebar", false);
     69        drawClosed = Config.getPref().getBoolean("fastdraw.drawclosed", false);
     70        simplifyMode = Config.getPref().getInt("fastdraw.simplifymode", 0) % 3;
     71        allowEditExistingWays = Config.getPref().getBoolean("fastdraw.alloweditexisting", false);
    7672
    77         autoTags = Main.pref.get("fastdraw.autotags");
     73        autoTags = Config.getPref().get("fastdraw.autotags");
    7874    }
    7975
    8076    public void savePrefs() {
    81         Main.pref.putDouble("fastdraw.maxdist", maxDist);
    82         Main.pref.putDouble("fastdraw.epsilonmult", epsilonMult);
    83         //Main.pref.putDouble("fastdraw.deltasearch", deltaLatLon);
    84         Main.pref.putDouble("fastdraw.mindelta", minPixelsBetweenPoints);
    85         Main.pref.putDouble("fastdraw.startingEps", startingEps);
    86         Main.pref.putDouble("fastdraw.maxpkm", maxPointsPerKm);
    87         Main.pref.putInt("fastdraw.pkmblocksize", pkmBlockSize);
    88         Main.pref.putBoolean("fastdraw.drawlastsegment", drawLastSegment);
    89         Main.pref.putBoolean("fastdraw.snapnodes", snapNodes);
    90         Main.pref.putBoolean("fastdraw.fixedclick", fixedClick);
    91         Main.pref.putBoolean("fastdraw.fixedspacebar", fixedSpacebar);
    92         Main.pref.putBoolean("fastdraw.drawclosed", drawClosed);
    93         Main.pref.putInt("fastdraw.simplifymode", simplifyMode);
    94         Main.pref.put("fastdraw.autotags", autoTags);
    95         Main.pref.putBoolean("fastdraw.alloweditexisting", allowEditExistingWays);
    96         try {
    97             Main.pref.save();
    98         } catch (IOException e) {
    99             Logging.error(tr("Can not save preferences"));
    100         }
     77        Config.getPref().putDouble("fastdraw.maxdist", maxDist);
     78        Config.getPref().putDouble("fastdraw.epsilonmult", epsilonMult);
     79        //Config.getPref().putDouble("fastdraw.deltasearch", deltaLatLon);
     80        Config.getPref().putDouble("fastdraw.mindelta", minPixelsBetweenPoints);
     81        Config.getPref().putDouble("fastdraw.startingEps", startingEps);
     82        Config.getPref().putDouble("fastdraw.maxpkm", maxPointsPerKm);
     83        Config.getPref().putInt("fastdraw.pkmblocksize", pkmBlockSize);
     84        Config.getPref().putBoolean("fastdraw.drawlastsegment", drawLastSegment);
     85        Config.getPref().putBoolean("fastdraw.snapnodes", snapNodes);
     86        Config.getPref().putBoolean("fastdraw.fixedclick", fixedClick);
     87        Config.getPref().putBoolean("fastdraw.fixedspacebar", fixedSpacebar);
     88        Config.getPref().putBoolean("fastdraw.drawclosed", drawClosed);
     89        Config.getPref().putInt("fastdraw.simplifymode", simplifyMode);
     90        Config.getPref().put("fastdraw.autotags", autoTags);
     91        Config.getPref().putBoolean("fastdraw.alloweditexisting", allowEditExistingWays);
    10192    }
    10293}
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java

    r33731 r34510  
    1919import javax.swing.JPanel;
    2020
    21 import org.openstreetmap.josm.Main;
    2221import org.openstreetmap.josm.gui.ExtendedDialog;
     22import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    2424import org.openstreetmap.josm.gui.datatransfer.importers.TextTagPaster;
    2525import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
     26import org.openstreetmap.josm.spi.preferences.Config;
    2627import org.openstreetmap.josm.tools.GBC;
    2728import org.openstreetmap.josm.tools.ImageProvider;
     
    4950
    5051    public FastDrawConfigDialog(FDSettings settings) {
    51         super(Main.parent, tr("FastDraw configuration"), new String[] {tr("Ok"), tr("Cancel")});
     52        super(MainApplication.getMainFrame(), tr("FastDraw configuration"), new String[] {tr("Ok"), tr("Cancel")});
    5253        this.settings = settings;
    5354
     
    6667        pasteButton.setToolTipText(tr("Try copying tags from properties table"));
    6768
    68         ArrayList<String> history = new ArrayList<>(Main.pref.getList("fastdraw.tags-history"));
     69        ArrayList<String> history = new ArrayList<>(Config.getPref().getList("fastdraw.tags-history"));
    6970        while (history.remove("")) { };
    7071        addTags.setPossibleItems(history);
     
    131132                    addTags.addCurrentItemToHistory();
    132133                }
    133                 Main.pref.putList("fastdraw.tags-history", addTags.getHistory());
     134                Config.getPref().putList("fastdraw.tags-history", addTags.getHistory());
    134135                settings.savePrefs();
    135136            } catch (ParseException e) {
    136                 JOptionPane.showMessageDialog(Main.parent,
     137                JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    137138                        tr("Can not read settings"));
    138139            }
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r33731 r34510  
    2020import javax.swing.JOptionPane;
    2121
    22 import org.openstreetmap.josm.Main;
    2322import org.openstreetmap.josm.actions.mapmode.MapMode;
    2423import org.openstreetmap.josm.command.AddCommand;
     
    2827import org.openstreetmap.josm.command.SequenceCommand;
    2928import org.openstreetmap.josm.data.Bounds;
     29import org.openstreetmap.josm.data.UndoRedoHandler;
    3030import org.openstreetmap.josm.data.coor.LatLon;
    3131import org.openstreetmap.josm.data.osm.DataSet;
     
    464464                if (line.getPoints().size() > 5) {
    465465                    boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
    466                             "delete_drawn_line", Main.parent,
     466                            "delete_drawn_line", MainApplication.getMainFrame(),
    467467                            tr("Are you sure you do not want to save the line containing {0} points?",
    468468                                    line.getPoints().size()), tr("Delete confirmation"),
     
    476476
    477477        case KeyEvent.VK_I:
    478             JOptionPane.showMessageDialog(Main.parent,
     478            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    479479                    tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)",
    480480                            line.getLength(), line.getPoints().size(), line.getNodesPerKm(settings.pkmBlockSize),
     
    565565            }
    566566            if (nd.getCoor().isOutSideWorld()) {
    567                 JOptionPane.showMessageDialog(Main.parent,
     567                JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    568568                        tr("Cannot place node outside of the world."));
    569569                return;
     
    599599        } else cmds.add(new AddCommand(ds, w));
    600600        Command c = new SequenceCommand(tr("Draw the way by mouse"), cmds);
    601         MainApplication.undoRedo.add(c);
     601        UndoRedoHandler.getInstance().add(c);
    602602        lineWasSaved = true;
    603603        newDrawing(); // stop drawing
Note: See TracChangeset for help on using the changeset viewer.