Changeset 10467 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2016-06-24T00:30:42+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r10382 r10467 66 66 Main.main.undoRedo.add(new AddCommand(nnew)); 67 67 getLayerManager().getEditDataSet().setSelected(nnew); 68 if (Main.map.mapView.getRealBounds().contains(nnew.getCoor())) { 69 Main.map.mapView.repaint(); 70 } else { 71 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 68 if (Main.map.mapView != null) { 69 if (Main.map.mapView.getRealBounds().contains(nnew.getCoor())) { 70 Main.map.mapView.repaint(); 71 } else { 72 AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew)); 73 } 72 74 } 73 75 } -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r10383 r10467 284 284 285 285 Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds)); 286 Main.map.repaint();287 286 } 288 287 -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r10463 r10467 205 205 // Do it! 206 206 Main.main.undoRedo.add(cmd); 207 Main.map.repaint();208 207 209 208 } catch (InvalidSelection except) { -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r10409 r10467 241 241 242 242 Main.main.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds)); 243 Main.map.repaint();244 243 } 245 244 -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r10409 r10467 98 98 // Do it! 99 99 Main.main.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds)); 100 Main.map.repaint();101 100 } 102 101 -
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r10292 r10467 137 137 } 138 138 kev.consume(); 139 Main.map.repaint();140 139 } 141 140 } … … 164 163 offsetDialog.updateOffset(); 165 164 } 166 Main.map.repaint();167 165 prevEastNorth = eastNorth; 168 166 } -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r10409 r10467 160 160 if (cmds.isEmpty()) return; 161 161 Main.main.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds)); 162 Main.map.repaint();163 162 } 164 163 -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r10409 r10467 81 81 82 82 Main.main.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds)); 83 Main.map.repaint();84 83 } 85 84 -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r10463 r10467 113 113 if (!commands.isEmpty()) { 114 114 Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands)); 115 Main.map.repaint();116 115 } else { 117 116 throw new InvalidUserInputException("Commands are empty"); … … 153 152 final SequenceCommand command = orthogonalize(sel); 154 153 Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command)); 155 Main.map.repaint();156 154 } catch (InvalidUserInputException ex) { 157 155 Main.debug(ex); -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r10463 r10467 103 103 } 104 104 Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); 105 // FIXME: This should be handled by undoRedo. 105 106 if (propertiesUpdated) { 106 107 ds.fireSelectionChanged(); 107 108 } 108 Main.map.repaint();109 109 } 110 110 -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r10409 r10467 124 124 ds.endUpdate(); 125 125 } 126 Main.map.repaint();127 126 } 128 127 -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r10409 r10467 91 91 // I'm sure there's a better way to handle this 92 92 Main.main.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes)); 93 Main.map.repaint();94 93 } 95 94 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r10306 r10467 122 122 public void run() { 123 123 targetLayer.onPostDownloadFromServer(); 124 if (Main.map != null)125 Main.map.mapView.repaint();126 124 } 127 125 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r10448 r10467 134 134 */ 135 135 public static void doActionPerformed(ActionEvent e) { 136 if (!Main.map.mapView.isActiveLayerDrawable()) 137 return; 136 MainLayerManager lm = Main.getLayerManager(); 137 OsmDataLayer editLayer = lm.getEditLayer(); 138 if (editLayer == null) { 139 return; 140 } 141 138 142 boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 139 143 boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK)) != 0; 140 144 141 MainLayerManager lm = Main.getLayerManager();142 145 Command c; 143 146 if (ctrl) { 144 c = DeleteCommand.deleteWithReferences( lm.getEditLayer(), lm.getEditDataSet().getSelected());147 c = DeleteCommand.deleteWithReferences(editLayer, lm.getEditDataSet().getSelected()); 145 148 } else { 146 c = DeleteCommand.delete( lm.getEditLayer(), lm.getEditDataSet().getSelected(), !alt /* also delete nodes in way */);149 c = DeleteCommand.delete(editLayer, lm.getEditDataSet().getSelected(), !alt /* also delete nodes in way */); 147 150 } 148 151 // if c is null, an error occurred or the user aborted. Don't do anything in that case. 149 152 if (c != null) { 150 153 Main.main.undoRedo.add(c); 154 //FIXME: This should not be required, DeleteCommand should update the selection, otherwise undo/redo won't work. 151 155 lm.getEditDataSet().setSelected(); 152 Main.map.repaint();153 156 } 154 157 } … … 213 216 private void repaintIfRequired(Set<OsmPrimitive> newHighlights, WaySegment newHighlightedWaySegment) { 214 217 boolean needsRepaint = false; 215 DataSet ds= getLayerManager().getEditDataSet();218 OsmDataLayer editLayer = getLayerManager().getEditLayer(); 216 219 217 220 if (newHighlightedWaySegment == null && oldHighlightedWaySegment != null) { 218 if ( ds!= null) {219 ds.clearHighlightedWaySegments();221 if (editLayer != null) { 222 editLayer.data.clearHighlightedWaySegments(); 220 223 needsRepaint = true; 221 224 } 222 225 oldHighlightedWaySegment = null; 223 226 } else if (newHighlightedWaySegment != null && !newHighlightedWaySegment.equals(oldHighlightedWaySegment)) { 224 if ( ds!= null) {225 ds.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment));227 if (editLayer != null) { 228 editLayer.data.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment)); 226 229 needsRepaint = true; 227 230 } … … 229 232 } 230 233 needsRepaint |= highlightHelper.highlightOnly(newHighlights); 231 if (needsRepaint) { 232 Main.map.mapView.repaint();234 if (needsRepaint && editLayer != null) { 235 editLayer.invalidate(); 233 236 } 234 237 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10446 r10467 185 185 186 186 // update selection to reflect which way being modified 187 DataSet currentDataSet = getLayerManager().getEditDataSet(); 188 if (getCurrentBaseNode() != null && currentDataSet != null && !currentDataSet.selectionEmpty()) { 187 OsmDataLayer editLayer = getLayerManager().getEditLayer(); 188 if (getCurrentBaseNode() != null && editLayer != null && !editLayer.data.selectionEmpty()) { 189 DataSet currentDataSet = editLayer.data; 189 190 Way continueFrom = getWayForNode(getCurrentBaseNode()); 190 191 if (alt && continueFrom != null && (!getCurrentBaseNode().isSelected() || continueFrom.isSelected())) { … … 197 198 } 198 199 199 if (needsRepaint) { 200 Main.map.mapView.repaint();200 if (needsRepaint && editLayer != null) { 201 editLayer.invalidate(); 201 202 } 202 203 return needsRepaint; … … 917 918 @Override 918 919 public void mouseExited(MouseEvent e) { 919 if (!Main.map.mapView.isActiveLayerDrawable()) 920 OsmDataLayer editLayer = Main.getLayerManager().getEditLayer(); 921 if (editLayer == null) 920 922 return; 921 923 mousePos = e.getPoint(); … … 925 927 // caused one already, don’t do it again. 926 928 if (!repaintIssued) { 927 Main.map.mapView.repaint();929 editLayer.invalidate(); 928 930 } 929 931 }
Note:
See TracChangeset
for help on using the changeset viewer.