Changeset 1245 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-01-11T16:14:58+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r1169 r1245 70 70 71 71 public void actionPerformed(ActionEvent e) { 72 int numberOfNodesInCircle = Integer.parseInt(Main.pref.get("createcircle.nodecount", "8"));72 int numberOfNodesInCircle = Main.pref.getInteger("createcircle.nodecount", 8); 73 73 if (numberOfNodesInCircle < 1) { 74 74 numberOfNodesInCircle = 1; -
trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java
r1222 r1245 15 15 public class AudioBackAction extends JosmAction { 16 16 17 private double amount; // note, normally negative, i.e. jump backwards in time18 19 17 public AudioBackAction() { 20 18 super(tr("Back"), "audio-back", tr("Jump back."), 21 19 Shortcut.registerShortcut("audio:back", tr("Audio: {0}", tr("Back")), KeyEvent.VK_F6, Shortcut.GROUP_DIRECT), true); 22 amount = -Main.pref.getDouble("audio.forwardbackamount","10.0");23 20 this.putValue("help", "Action/Back"); 24 21 } … … 27 24 try { 28 25 if (AudioPlayer.playing() || AudioPlayer.paused()) 29 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() + amount); 26 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() 27 - Main.pref.getDouble("audio.forwardbackamount","10.0")); 30 28 else 31 29 MarkerLayer.playAudio(); -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java
r1180 r1245 15 15 public AudioFastSlowAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean fast) { 16 16 super(name, iconName, tooltip, shortcut, true); 17 try { 18 multiplier = Double.parseDouble(Main.pref.get("audio.fastfwdmultiplier","1.3")); 19 } catch (NumberFormatException e) { 20 multiplier = 1.3; 21 } 17 multiplier = Main.pref.getDouble("audio.fastfwdmultiplier","1.3"); 22 18 if (! fast) 23 19 multiplier = 1.0 / multiplier; -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java
r1222 r1245 14 14 15 15 public class AudioFwdAction extends JosmAction { 16 17 private double amount;18 19 16 public AudioFwdAction() { 20 17 super(tr("Forward"), "audio-fwd", tr("Jump forward"), 21 18 Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", tr("Forward")), KeyEvent.VK_F7, Shortcut.GROUP_DIRECT), true); 22 amount = Main.pref.getDouble("audio.forwardbackamount","10.0");23 19 } 24 20 … … 26 22 try { 27 23 if (AudioPlayer.playing() || AudioPlayer.paused()) 28 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() + amount); 24 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position() 25 + Main.pref.getDouble("audio.forwardbackamount","10.0")); 29 26 else 30 27 MarkerLayer.playAudio(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1221 r1245 536 536 B.north() + q * (A.north() - B.north())); 537 537 538 int snapToIntersectionThreshold =0;539 try { snapToIntersectionThreshold = Integer.parseInt(Main.pref.get("edit.snap-intersection-threshold","10")); } catch (NumberFormatException x) {}538 int snapToIntersectionThreshold 539 = Main.pref.getInteger("edit.snap-intersection-threshold",10); 540 540 541 541 // only adjust to intersection if within snapToIntersectionThreshold pixel of mouse click; otherwise -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r1115 r1245 73 73 * counts as a move, in milliseconds 74 74 */ 75 private int initialMoveDelay = 200;75 private int initialMoveDelay; 76 76 77 77 /** … … 79 79 * counts as a move, in pixels 80 80 */ 81 private int initialMoveThreshold = 15;81 private int initialMoveThreshold; 82 82 private boolean initialMoveThresholdExceeded = false; 83 83 /** … … 92 92 putValue("help", "Action/Move/Move"); 93 93 selectionManager = new SelectionManager(this, false, mapFrame.mapView); 94 try { initialMoveDelay = Integer.parseInt(Main.pref.get("edit.initial-move-delay","200")); } catch (NumberFormatException x) {} 95 try { initialMoveThreshold = Integer.parseInt(Main.pref.get("edit.initial-move-threshold","5")); } catch (NumberFormatException x) {} 96 94 initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay",200); 95 initialMoveThreshold = Main.pref.getInteger("edit.initial-move-threshold",5); 97 96 } 98 97 -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1243 r1245 433 433 putDefault(key, def); 434 434 String v = get(key); 435 try { 436 return Double.parseDouble(v == null ? def : v); 437 } catch(NumberFormatException e) { 438 // fall out 439 } 435 if(v != null && v.length() != 0) 436 try { return Double.parseDouble(v); } catch(NumberFormatException e) {} 437 try { return Double.parseDouble(def); } catch(NumberFormatException e) {} 440 438 return 0.0; 441 439 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r1169 r1245 138 138 139 139 try { 140 tabpane.setSelectedIndex( Integer.parseInt(Main.pref.get("download.tab", "0")));140 tabpane.setSelectedIndex(Main.pref.getInteger("download.tab", 0)); 141 141 } catch (Exception ex) { 142 Main.pref.put ("download.tab", "0");142 Main.pref.putInteger("download.tab", 0); 143 143 } 144 144 -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r1221 r1245 378 378 boolean forceLines = Main.pref.getBoolean("draw.rawgps.lines.force"); // also draw lines between points belonging to different segments 379 379 boolean direction = Main.pref.getBoolean("draw.rawgps.direction"); // draw direction arrows on the lines 380 int maxLineLength = -1; 381 try { 382 maxLineLength = Integer.parseInt(Main.pref.get("draw.rawgps.max-line-length", "-1")); // don't draw lines if longer than x meters 383 } catch (java.lang.NumberFormatException e) { 384 Main.pref.put("draw.rawgps.max-line-length", "-1"); 385 } 380 int maxLineLength = Main.pref.getInteger("draw.rawgps.max-line-length", -1); 381 // don't draw lines if longer than x meters 386 382 boolean lines = Main.pref.getBoolean("draw.rawgps.lines"); // draw line between points, global setting 387 383 String linesKey = "draw.rawgps.lines.layer "+name; … … 391 387 boolean colored = Main.pref.getBoolean("draw.rawgps.colors"); // color the lines 392 388 boolean alternatedirection = Main.pref.getBoolean("draw.rawgps.alternatedirection"); // paint direction arrow with alternate math. may be faster 393 int delta = 0; 394 try { 395 delta = Integer.parseInt(Main.pref.get("draw.rawgps.min-arrow-distance", "0")); // don't draw arrows nearer to each other than this 396 } catch (java.lang.NumberFormatException e) { 397 Main.pref.put("draw.rawgps.min-arrow-distance", "0"); 398 } 389 int delta = Main.pref.getInteger("draw.rawgps.min-arrow-distance", 0); 390 // don't draw arrows nearer to each other than this 399 391 400 392 /**************************************************************** -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r1195 r1245 46 46 private boolean enabled; 47 47 private boolean wasPlaying = false; 48 private int dropTolerance = 50; /* pixels */48 private int dropTolerance; /* pixels */ 49 49 50 50 public static PlayHeadMarker create() { … … 65 65 enabled = Main.pref.getBoolean("marker.traceaudio", true); 66 66 if (! enabled) return; 67 try { dropTolerance = Integer.parseInt(Main.pref.get("marker.playHeadDropTolerance", "50")); } 68 catch(NumberFormatException x) { dropTolerance = 50; } 67 dropTolerance = Main.pref.getInteger("marker.playHeadDropTolerance", 50); 69 68 Main.map.mapView.addMouseListener(new MouseAdapter() { 70 69 @Override public void mousePressed(MouseEvent ev) { … … 87 86 @Override public boolean containsPoint(Point p) { 88 87 Point screen = Main.map.mapView.getPoint(eastNorth); 89 Rectangle r = new Rectangle(screen.x, screen.y, symbol.getIconWidth(), symbol.getIconHeight()); 88 Rectangle r = new Rectangle(screen.x, screen.y, symbol.getIconWidth(), 89 symbol.getIconHeight()); 90 90 return r.contains(p); 91 91 } -
trunk/src/org/openstreetmap/josm/gui/preferences/AudioPreference.java
r1180 r1245 145 145 gui.audio.add(audioFastForwardMultiplier, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 146 146 147 audioLeadIn.setText(Main.pref.get("audio.leadin", "1 "));147 audioLeadIn.setText(Main.pref.get("audio.leadin", "1.0")); 148 148 audioLeadIn.setToolTipText(tr("Playback starts this number of seconds before (or after, if negative) the audio track position requested")); 149 149 gui.audio.add(new JLabel(tr("Lead-in time (seconds)")), GBC.std()); -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r1234 r1245 8 8 import java.awt.Image; 9 9 import java.awt.event.ActionEvent; 10 import java.awt.event.ActionListener; 10 11 import java.io.BufferedReader; 11 12 import java.io.InputStreamReader; … … 24 25 import javax.swing.Action; 25 26 import javax.swing.ImageIcon; 27 import javax.swing.JButton; 26 28 import javax.swing.JComboBox; 27 29 import javax.swing.JComponent; … … 43 45 import org.openstreetmap.josm.tools.GBC; 44 46 import org.openstreetmap.josm.tools.ImageProvider; 47 import org.openstreetmap.josm.tools.OpenBrowser; 45 48 import org.openstreetmap.josm.tools.XmlObjectParser; 46 49 import org.xml.sax.SAXException; … … 179 182 public String text; 180 183 public String locale_text; 181 public boolean default_ = false; // not used!184 public boolean default_ = false; // only used for tagless objects 182 185 public boolean use_last_as_default = false; 183 186 … … 196 199 for (String s : usage.values) oneValue = s; 197 200 if (usage.values.size() < 2 && (oneValue == null || OsmUtils.trueval.equals(oneValue) || OsmUtils.falseval.equals(oneValue))) { 201 if(default_) 202 { 203 for (OsmPrimitive s : sel) 204 if(s.keys != null && s.keys.size() > 0) default_ = false; 205 } 206 198 207 // all selected objects share the same value which is either true or false or unset, 199 208 // we can display a standard check box. … … 202 211 OsmUtils.falseval.equals(oneValue) ? 203 212 QuadStateCheckBox.State.NOT_SELECTED : 204 QuadStateCheckBox.State.UNSET; 213 default_ ? QuadStateCheckBox.State.SELECTED 214 : QuadStateCheckBox.State.UNSET; 205 215 check = new QuadStateCheckBox(locale_text, initialState, 206 216 new QuadStateCheckBox.State[] { … … 357 367 } 358 368 369 public static class Link extends Item { 370 public String href; 371 public String text; 372 public String locale_text; 373 374 @Override public void addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 375 if(locale_text == null) 376 locale_text = text == null ? tr("Open map features in browser") : tr(text); 377 JButton b = new JButton(locale_text); 378 b.addActionListener(new ActionListener(){ 379 public void actionPerformed(ActionEvent e) { 380 OpenBrowser.displayUrl(href); 381 } 382 }); 383 p.add(b, GBC.eol().anchor(GBC.EAST)); 384 } 385 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {} 386 } 387 359 388 public static class Optional extends Item { 360 389 // TODO: Draw a box around optional stuff … … 458 487 parser.mapBoth("group", TaggingPresetMenu.class); 459 488 parser.map("text", Text.class); 489 parser.map("link", Link.class); 460 490 parser.mapOnStart("optional", Optional.class); 461 491 parser.map("check", Check.class); -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r1169 r1245 197 197 command = new Execute(); 198 198 playingUrl = null; 199 try { 200 leadIn = Double.parseDouble(Main.pref.get("audio.leadin", "1.0" /* default, seconds */)); 201 } catch (NumberFormatException e) { 202 leadIn = 1.0; // failed to parse 203 } 204 try { 205 calibration = Double.parseDouble(Main.pref.get("audio.calibration", "1.0" /* default, ratio */)); 206 } catch (NumberFormatException e) { 207 calibration = 1.0; // failed to parse 208 } 199 leadIn = Main.pref.getDouble("audio.leadin", "1.0" /* default, seconds */); 200 calibration = Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */); 209 201 start(); 210 202 while (state == State.INITIALIZING) { yield(); }
Note:
See TracChangeset
for help on using the changeset viewer.