Changeset 4276 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-07-29T13:04:04+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r4270 r4276 1407 1407 @Override 1408 1408 public void actionPerformed(ActionEvent e) { 1409 GPXSettingsPanel panel=new GPXSettingsPanel(getName()); 1409 boolean hasLocal = false, hasNonlocal = false; 1410 for (Layer layer : layers) { 1411 if (layer instanceof GpxLayer) { 1412 if (((GpxLayer) layer).isLocalFile) hasLocal = true; 1413 else hasNonlocal = true; 1414 } 1415 } 1416 GPXSettingsPanel panel=new GPXSettingsPanel(getName(), hasLocal, hasNonlocal); 1417 1410 1418 int answer = JOptionPane.showConfirmDialog(Main.parent, panel, 1411 1419 tr("Customize track drawing"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); … … 1413 1421 for(Layer layer : layers) { 1414 1422 // save preferences for all layers 1415 panel.savePreferences(layer.getName()); 1423 boolean f=false; 1424 if (layer instanceof GpxLayer) f=((GpxLayer)layer).isLocalFile; 1425 panel.savePreferences(layer.getName(),f); 1416 1426 } 1417 1427 Main.map.repaint(); … … 1419 1429 } 1420 1430 1421 1431 private class MarkersFromNamedPoins extends AbstractAction { 1422 1432 1423 1433 public MarkersFromNamedPoins() { -
trunk/src/org/openstreetmap/josm/gui/preferences/GPXSettingsPanel.java
r4274 r4276 49 49 /* gpx data field name */ trc("gpx_field", "Desc(ription)"), tr("Both"), tr("None")}); 50 50 private String layerName; 51 52 public GPXSettingsPanel(String layerName) { 51 private boolean local; // flag to display LocalOnly checkbox 52 private boolean nonlocal; // flag to display AllLines checkbox 53 54 public GPXSettingsPanel(String layerName, boolean local, boolean nonlocal) { 53 55 super(new GridBagLayout()); 56 this.local=local; this.nonlocal=nonlocal; 54 57 this.layerName = "layer "+layerName; 55 58 initComponents(); … … 60 63 super(new GridBagLayout()); 61 64 initComponents(); 65 local=false; nonlocal=false; 62 66 loadPreferences(); // preferences -> controls 63 67 } 68 64 69 private void initComponents() { 65 70 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 81 86 if (layerName!=null) add(drawRawGpsLinesGlobal, GBC.eol().insets(40,0,0,0)); 82 87 add(drawRawGpsLinesNone, GBC.eol().insets(40,0,0,0)); 83 add(drawRawGpsLinesLocal, GBC.eol().insets(40,0,0,0));84 add(drawRawGpsLinesAll, GBC.eol().insets(40,0,0,0));88 if (layerName==null || local) add(drawRawGpsLinesLocal, GBC.eol().insets(40,0,0,0)); 89 if (layerName==null || nonlocal) add(drawRawGpsLinesAll, GBC.eol().insets(40,0,0,0)); 85 90 86 91 drawRawGpsLinesActionListener = new ActionListener(){ … … 201 206 makeAutoMarkers.setSelected(Main.pref.getBoolean("marker.makeautomarkers", true)); 202 207 if(layerName!=null && !Main.pref.hasKey("draw.rawgps.lines."+layerName) 203 && !Main.pref.hasKey("draw.rawgps.lines.local "+layerName)){208 && !Main.pref.hasKey("draw.rawgps.lines.local."+layerName)){ 204 209 // no line preferences for layer is found 205 210 drawRawGpsLinesGlobal.setSelected(true); … … 254 259 * if layerName==null, global preferences are written 255 260 */ 256 public boolean savePreferences (String layerName ) {261 public boolean savePreferences (String layerName, boolean locLayer) { 257 262 String layerNameDot = ".layer "+layerName; 263 if (layerName==null) layerNameDot=""; 258 264 Main.pref.put("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected()); 259 265 if (drawRawGpsLinesGlobal.isSelected()) { 260 Main.pref.put("draw.rawgps.lines" +layerNameDot, null);261 Main.pref.put("draw.rawgps. lines.local"+layerNameDot, null);262 Main.pref.put("draw.rawgps. max-line-length"+layerNameDot, null);263 Main.pref.put("draw.rawgps.max-line-length.local" +layerNameDot, null);266 Main.pref.put("draw.rawgps.lines" + layerNameDot, null); 267 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, null); 268 Main.pref.put("draw.rawgps.lines.local" + layerNameDot, null); 269 Main.pref.put("draw.rawgps.max-line-length.local" + layerNameDot, null); 264 270 Main.pref.put("draw.rawgps.lines.force"+layerNameDot, null); 265 271 Main.pref.put("draw.rawgps.direction"+layerNameDot, null); … … 267 273 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, null); 268 274 } else { 269 Main.pref.put("draw.rawgps.lines"+layerNameDot, drawRawGpsLinesAll.isSelected()); 270 Main.pref.put("draw.rawgps.lines.local"+layerNameDot, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected()); 271 Main.pref.put("draw.rawgps.max-line-length"+layerNameDot, drawRawGpsMaxLineLength.getText()); 272 Main.pref.put("draw.rawgps.max-line-length.local"+layerNameDot, drawRawGpsMaxLineLengthLocal.getText()); 275 if (layerName==null || !locLayer) { 276 Main.pref.put("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected()); 277 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, drawRawGpsMaxLineLength.getText()); 278 } 279 if (layerName==null || locLayer) { 280 Main.pref.put("draw.rawgps.lines.local" + layerNameDot, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected()); 281 Main.pref.put("draw.rawgps.max-line-length.local" + layerNameDot, drawRawGpsMaxLineLengthLocal.getText()); 282 } 273 283 Main.pref.put("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected()); 274 284 Main.pref.put("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected()); … … 308 318 */ 309 319 public void savePreferences() { 310 savePreferences(null );320 savePreferences(null, false); 311 321 } 312 322 }
Note:
See TracChangeset
for help on using the changeset viewer.