Changeset 34510 in osm for applications/editors
- Timestamp:
- 2018-08-18T17:16:12+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/build.xml
r33731 r34510 4 4 <property name="commit.message" value="[josm_fastdraw] Fix incorrect settings saving-2"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 2987"/>6 <property name="plugin.main.version" value="14153"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
r33731 r34510 2 2 package org.openstreetmap.josm.plugins.fastdraw; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr;5 6 4 import java.awt.Color; 7 5 import java.awt.Stroke; 8 import java.io.IOException;9 6 10 import org.openstreetmap.josm.Main;11 7 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 12 8 import org.openstreetmap.josm.gui.util.GuiHelper; 13 import org.openstreetmap.josm. tools.Logging;9 import org.openstreetmap.josm.spi.preferences.Config; 14 10 15 11 public class FDSettings { … … 53 49 54 50 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")); 58 54 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); 61 57 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); 76 72 77 autoTags = Main.pref.get("fastdraw.autotags");73 autoTags = Config.getPref().get("fastdraw.autotags"); 78 74 } 79 75 80 76 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); 101 92 } 102 93 } -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
r33731 r34510 19 19 import javax.swing.JPanel; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.gui.ExtendedDialog; 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 24 24 import org.openstreetmap.josm.gui.datatransfer.importers.TextTagPaster; 25 25 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 26 import org.openstreetmap.josm.spi.preferences.Config; 26 27 import org.openstreetmap.josm.tools.GBC; 27 28 import org.openstreetmap.josm.tools.ImageProvider; … … 49 50 50 51 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")}); 52 53 this.settings = settings; 53 54 … … 66 67 pasteButton.setToolTipText(tr("Try copying tags from properties table")); 67 68 68 ArrayList<String> history = new ArrayList<>( Main.pref.getList("fastdraw.tags-history"));69 ArrayList<String> history = new ArrayList<>(Config.getPref().getList("fastdraw.tags-history")); 69 70 while (history.remove("")) { }; 70 71 addTags.setPossibleItems(history); … … 131 132 addTags.addCurrentItemToHistory(); 132 133 } 133 Main.pref.putList("fastdraw.tags-history", addTags.getHistory());134 Config.getPref().putList("fastdraw.tags-history", addTags.getHistory()); 134 135 settings.savePrefs(); 135 136 } catch (ParseException e) { 136 JOptionPane.showMessageDialog(Main .parent,137 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 137 138 tr("Can not read settings")); 138 139 } -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r33731 r34510 20 20 import javax.swing.JOptionPane; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.actions.mapmode.MapMode; 24 23 import org.openstreetmap.josm.command.AddCommand; … … 28 27 import org.openstreetmap.josm.command.SequenceCommand; 29 28 import org.openstreetmap.josm.data.Bounds; 29 import org.openstreetmap.josm.data.UndoRedoHandler; 30 30 import org.openstreetmap.josm.data.coor.LatLon; 31 31 import org.openstreetmap.josm.data.osm.DataSet; … … 464 464 if (line.getPoints().size() > 5) { 465 465 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 466 "delete_drawn_line", Main .parent,466 "delete_drawn_line", MainApplication.getMainFrame(), 467 467 tr("Are you sure you do not want to save the line containing {0} points?", 468 468 line.getPoints().size()), tr("Delete confirmation"), … … 476 476 477 477 case KeyEvent.VK_I: 478 JOptionPane.showMessageDialog(Main .parent,478 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 479 479 tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)", 480 480 line.getLength(), line.getPoints().size(), line.getNodesPerKm(settings.pkmBlockSize), … … 565 565 } 566 566 if (nd.getCoor().isOutSideWorld()) { 567 JOptionPane.showMessageDialog(Main .parent,567 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 568 568 tr("Cannot place node outside of the world.")); 569 569 return; … … 599 599 } else cmds.add(new AddCommand(ds, w)); 600 600 Command c = new SequenceCommand(tr("Draw the way by mouse"), cmds); 601 MainApplication.undoRedo.add(c);601 UndoRedoHandler.getInstance().add(c); 602 602 lineWasSaved = true; 603 603 newDrawing(); // stop drawing
Note:
See TracChangeset
for help on using the changeset viewer.