- Timestamp:
- 2012-03-03T12:37:00+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r5034 r5035 95 95 public MapStatus statusLine; 96 96 97 // Toggle dialogs 97 98 public ConflictDialog conflictDialog; 98 99 public FilterDialog filterDialog; … … 101 102 public SelectionListDialog selectionListDialog; 102 103 public PropertiesDialog propertiesDialog; 104 105 // Map modes 106 private final MapMode mapModeSelect; 107 private final MapMode mapModeDraw; 108 private final MapMode mapModeZoom; 103 109 104 110 /** … … 140 146 // toolbar 141 147 toolBarActions.setFloatable(false); 142 addMapMode(new IconToggleButton( new SelectAction(this)));143 addMapMode(new IconToggleButton( new DrawAction(this)));144 addMapMode(new IconToggleButton( new ZoomAction(this)));148 addMapMode(new IconToggleButton(mapModeSelect = new SelectAction(this))); 149 addMapMode(new IconToggleButton(mapModeDraw = new DrawAction(this))); 150 addMapMode(new IconToggleButton(mapModeZoom = new ZoomAction(this))); 145 151 addMapMode(new IconToggleButton(new DeleteAction(this), true)); 146 152 addMapMode(new IconToggleButton(new ParallelWayAction(this), true)); … … 208 214 } 209 215 210 public voidselectSelectTool(boolean onlyIfModeless) {216 public boolean selectSelectTool(boolean onlyIfModeless) { 211 217 if(onlyIfModeless && !Main.pref.getBoolean("modeless", false)) 212 return ;213 214 selectMapMode((MapMode)getDefaultButtonAction());218 return false; 219 220 return selectMapMode(mapModeSelect); 215 221 } 216 222 … … 219 225 return; 220 226 221 Action drawAction = ((AbstractButton)toolBarActions.getComponent(1)).getAction(); 222 selectMapMode((MapMode)drawAction); 227 selectMapMode(mapModeDraw); 228 } 229 230 public boolean selectZoomTool(boolean onlyIfModeless) { 231 if(onlyIfModeless && !Main.pref.getBoolean("modeless", false)) 232 return false; 233 234 return selectMapMode(mapModeZoom); 223 235 } 224 236 … … 318 330 * in such cases. 319 331 * @param mapMode The new mode to set. 320 */ 321 public void selectMapMode(MapMode newMapMode) { 322 selectMapMode(newMapMode, mapView.getActiveLayer()); 332 * @return 333 */ 334 public boolean selectMapMode(MapMode newMapMode) { 335 return selectMapMode(newMapMode, mapView.getActiveLayer()); 323 336 } 324 337 … … 328 341 * @param newMapMode 329 342 * @param newLayer 330 */ 331 public void selectMapMode(MapMode newMapMode, Layer newLayer) { 343 * @return True if mode is really selected 344 */ 345 public boolean selectMapMode(MapMode newMapMode, Layer newLayer) { 332 346 if (newMapMode == null || !newMapMode.layerIsSupported(newLayer)) 333 return ;347 return false; 334 348 335 349 MapMode oldMapMode = this.mapMode; 336 350 if (newMapMode == oldMapMode) 337 return ;351 return true; 338 352 if (oldMapMode != null) { 339 353 oldMapMode.exitMode(); … … 343 357 lastMapMode.put(newLayer, newMapMode); 344 358 fireMapModeChanged(oldMapMode, newMapMode); 359 return true; 345 360 } 346 361
Note:
See TracChangeset
for help on using the changeset viewer.