Changeset 4567 in josm
- Timestamp:
- 2011-11-02T15:44:20+01:00 (13 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r4489 r4567 278 278 final MapFrame mapFrame = new MapFrame(contentPanePrivate); 279 279 setMapFrame(mapFrame); 280 mapFrame.selectMapMode((MapMode)mapFrame.getDefaultButtonAction() );280 mapFrame.selectMapMode((MapMode)mapFrame.getDefaultButtonAction(), layer); 281 281 mapFrame.setVisible(true); 282 282 mapFrame.initializeDialogsPane(); -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r4488 r4567 288 288 return button; 289 289 } 290 290 291 291 public void validateToolBarToggle() { 292 292 toolBarToggle.removeAll(); … … 320 320 /** 321 321 * Change the operating map mode for the view. Will call unregister on the 322 * old MapMode and register on the new one. 322 * old MapMode and register on the new one. Now this function also verifies 323 * if new map mode is correct mode for current layer and does not change mode 324 * in such cases. 323 325 * @param mapMode The new mode to set. 324 326 */ 325 327 public void selectMapMode(MapMode newMapMode) { 328 selectMapMode(newMapMode, mapView.getActiveLayer()); 329 } 330 331 /** 332 * Another version of the selectMapMode for changing layer action. 333 * Pass newly selected layer to this method. 334 * @param newMapMode 335 * @param newLayer 336 */ 337 public void selectMapMode(MapMode newMapMode, Layer newLayer) { 338 if (newMapMode == null || !newMapMode.layerIsSupported(newLayer)) 339 return; 340 326 341 MapMode oldMapMode = this.mapMode; 327 342 if (newMapMode == oldMapMode) … … 332 347 this.mapMode = newMapMode; 333 348 newMapMode.enterMode(); 334 lastMapMode.put( mapView.getActiveLayer(), newMapMode);349 lastMapMode.put(newLayer, newMapMode); 335 350 fireMapModeChanged(oldMapMode, newMapMode); 336 351 } … … 474 489 modeChanged = newMapMode != mapMode; 475 490 if (newMapMode != null) { 476 selectMapMode(newMapMode); 477 } // it would be nice to select first supported mode when layer is first selected, but it don't work well with for example editgpx layer 491 selectMapMode(newMapMode, newLayer); // it would be nice to select first supported mode when layer is first selected, but it don't work well with for example editgpx layer 492 } else { 493 mapMode.exitMode(); // if new mode is null - simply exit from previous mode 494 } 478 495 } 479 496 if (!modeChanged && mapMode != null) {
Note:
See TracChangeset
for help on using the changeset viewer.