Changeset 3443 in josm
- Timestamp:
- 2010-08-15T22:04:43+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r3083 r3443 24 24 public abstract class AbstractInfoAction extends JosmAction { 25 25 26 public AbstractInfoAction( ) {27 super( );26 public AbstractInfoAction(boolean installAdapters) { 27 super(installAdapters); 28 28 } 29 29 -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r3416 r3443 66 66 */ 67 67 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) { 68 this(name, iconName, tooltip, shortcut, register, true); 69 } 70 71 /** 72 * Even newer super for all actions. Use if you don't want to install layer changed and selection changed adapters 73 * @param name 74 * @param iconName 75 * @param tooltip 76 * @param shortcut 77 * @param register 78 * @param installAdapters 79 */ 80 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, boolean installAdapters) { 68 81 super(name, iconName == null ? null : ImageProvider.get(iconName)); 69 82 setHelpId(); … … 77 90 Main.toolbar.register(this); 78 91 } 79 installAdapters(); 92 if (installAdapters) { 93 installAdapters(); 94 } 80 95 } 81 96 -
trunk/src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java
r2512 r3443 7 7 import java.awt.event.KeyEvent; 8 8 9 import org.openstreetmap.josm.Main; 9 10 import org.openstreetmap.josm.gui.MapFrame; 10 11 import org.openstreetmap.josm.gui.MapView; … … 30 31 31 32 /** 32 * Shortcut to the mapview.33 */34 private final MapView mv;35 /**36 33 * Manager that manages the selection rectangle with the aspect ratio of the 37 34 * MapView. … … 47 44 Shortcut.registerShortcut("mapmode:zoom", tr("Mode: {0}", tr("Zoom")), KeyEvent.VK_Z, Shortcut.GROUP_EDIT), 48 45 mapFrame, ImageProvider.getCursor("normal", "zoom")); 49 mv = mapFrame.mapView; 50 selectionManager = new SelectionManager(this, true, mv); 46 selectionManager = new SelectionManager(this, true, mapFrame.mapView); 51 47 } 52 48 … … 55 51 */ 56 52 public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) { 57 if (r.width >= 3 && r.height >= 3) { 53 if (r.width >= 3 && r.height >= 3 && Main.isDisplayingMapView()) { 54 MapView mv = Main.map.mapView; 58 55 mv.zoomToFactor(mv.getEastNorth(r.x+r.width/2, r.y+r.height/2), r.getWidth()/mv.getWidth()); 59 56 } … … 62 59 @Override public void enterMode() { 63 60 super.enterMode(); 64 selectionManager.register( mv);61 selectionManager.register(Main.map.mapView); 65 62 } 66 63 67 64 @Override public void exitMode() { 68 65 super.exitMode(); 69 selectionManager.unregister( mv);66 selectionManager.unregister(Main.map.mapView); 70 67 } 71 68 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r3278 r3443 214 214 } 215 215 } 216 mapView.destroy(); 216 217 } 217 218 -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r3416 r3443 222 222 223 223 // listend to selection changes to redraw the map 224 DataSet.addSelectionListener(new SelectionChangedListener(){ 225 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 226 repaint(); 227 } 228 }); 224 DataSet.addSelectionListener(repaintSelectionChangedListener); 229 225 230 226 //store the last mouse action … … 805 801 } 806 802 803 private SelectionChangedListener repaintSelectionChangedListener = new SelectionChangedListener(){ 804 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 805 repaint(); 806 } 807 }; 808 809 public void destroy() { 810 Main.pref.removePreferenceChangeListener(this); 811 DataSet.removeSelectionListener(repaintSelectionChangedListener); 812 } 813 807 814 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r3275 r3443 12 12 import java.awt.event.KeyEvent; 13 13 import java.awt.event.MouseEvent; 14 15 14 import java.util.ArrayList; 16 15 import java.util.LinkedHashSet; … … 74 73 super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), 75 74 Shortcut.registerShortcut("subwindow:commandstack", tr("Toggle: {0}", tr("Command Stack")), KeyEvent.VK_O, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 100, true); 76 Main.main.undoRedo.listenerCommands.add(this);77 78 75 undoTree.addMouseListener(new PopupMenuHandler()); 79 76 undoTree.setRootVisible(false); … … 212 209 listener.updateEnabledState(); 213 210 } 211 Main.main.undoRedo.listenerCommands.add(this); 214 212 } 215 213 … … 227 225 undoTreeModel.setRoot(new DefaultMutableTreeNode()); 228 226 redoTreeModel.setRoot(new DefaultMutableTreeNode()); 227 Main.main.undoRedo.listenerCommands.remove(this); 229 228 } 230 229 … … 263 262 // if one tree is empty, move selection to the other 264 263 switch (lastOperation) { 265 266 267 268 269 270 271 272 273 274 264 case UNDO: 265 if (undoCommands.isEmpty()) { 266 lastOperation = UndoRedoType.REDO; 267 } 268 break; 269 case REDO: 270 if (redoCommands.isEmpty()) { 271 lastOperation = UndoRedoType.UNDO; 272 } 273 break; 275 274 } 276 275 277 276 // select the next command to undo/redo 278 277 switch (lastOperation) { 279 280 281 282 283 284 278 case UNDO: 279 undoTree.setSelectionRow(undoTree.getRowCount()-1); 280 break; 281 case REDO: 282 redoTree.setSelectionRow(0); 283 break; 285 284 } 286 285 } … … 370 369 this.type = type; 371 370 switch (type) { 372 373 374 375 376 377 378 379 380 381 382 383 371 case UNDO: 372 tree = undoTree; 373 putValue(NAME,tr("Undo")); 374 putValue(SHORT_DESCRIPTION, tr("Undo the selected and all later commands")); 375 putValue(SMALL_ICON, ImageProvider.get("undo")); 376 break; 377 case REDO: 378 tree = redoTree; 379 putValue(NAME,tr("Redo")); 380 putValue(SHORT_DESCRIPTION, tr("Redo the selected and all earlier commands")); 381 putValue(SMALL_ICON, ImageProvider.get("redo")); 382 break; 384 383 } 385 384 } … … 397 396 // calculate the number of commands to undo/redo; then do it 398 397 switch (type) { 399 400 401 402 403 404 405 406 398 case UNDO: 399 int numUndo = ((DefaultMutableTreeNode) undoTreeModel.getRoot()).getChildCount() - idx; 400 Main.main.undoRedo.undo(numUndo); 401 break; 402 case REDO: 403 int numRedo = idx+1; 404 Main.main.undoRedo.redo(numRedo); 405 break; 407 406 } 408 407 Main.map.repaint(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r3416 r3443 188 188 189 189 public ShowUserInfoAction() { 190 super(false); 190 191 putValue(NAME, tr("Show info")); 191 192 putValue(SHORT_DESCRIPTION, tr("Launches a browser with information about the user")); -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r3083 r3443 117 117 118 118 public ChangesetInfoAction() { 119 super(true); 119 120 putValue(NAME, tr("Changeset info")); 120 121 putValue(SHORT_DESCRIPTION, tr("Launch browser with information about the changeset"));
Note: See TracChangeset
for help on using the changeset viewer.