Changeset 11386 in josm
- Timestamp:
- 2016-12-13T02:16:07+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/IconToggleButton.java
r10384 r11386 79 79 String getPreferenceKey() { 80 80 String s = (String) getSafeActionValue("toolbar"); 81 if (s == null) { 82 if (getAction() != null) { 83 s = getAction().getClass().getName(); 84 } 81 if (s == null && getAction() != null) { 82 s = getAction().getClass().getName(); 85 83 } 86 84 return "sidetoolbar.hidden."+s; 87 88 85 } 89 86 -
trunk/src/org/openstreetmap/josm/gui/PopupMenuHandler.java
r8510 r11386 74 74 MenuElement[] elements = menu.getSubElements(); 75 75 for (int i = 0; i < elements.length; i++) { 76 if (elements[i] instanceof JMenuItem) { 77 if (((JMenuItem) elements[i]).getAction() == a) { 78 menu.remove(i); 79 return; 80 } 76 if (elements[i] instanceof JMenuItem && ((JMenuItem) elements[i]).getAction() == a) { 77 menu.remove(i); 78 return; 81 79 } 82 80 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java
r10217 r11386 118 118 119 119 /** 120 * Start drawing the selection rectangle if it was the 1st button (left 121 * button) 120 * Start drawing the selection rectangle if it was the 1st button (left button) 122 121 */ 123 122 @Override … … 132 131 public void mouseDragged(MouseEvent e) { 133 132 if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK && 134 !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) { 135 if (iStartSelectionPoint != null) { 136 iEndSelectionPoint = e.getPoint(); 137 iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint); 138 isSelecting = true; 139 } 133 !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK) && iStartSelectionPoint != null) { 134 iEndSelectionPoint = e.getPoint(); 135 iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint); 136 isSelecting = true; 140 137 } 141 138 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r11032 r11386 98 98 @Override 99 99 public void mouseClicked(MouseEvent e) { 100 if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) { 101 if (noteData != null && noteData.getSelectedNote() != null) { 102 Main.map.mapView.zoomTo(noteData.getSelectedNote().getLatLon()); 103 } 100 if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2 && noteData != null && noteData.getSelectedNote() != null) { 101 Main.map.mapView.zoomTo(noteData.getSelectedNote().getLatLon()); 104 102 } 105 103 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r11365 r11386 205 205 206 206 //update highlights 207 if (highlightEnabled && focused == displaylist && Main.isDisplayingMapView()) { 208 if (highlightHelper.highlightOnly(sel)) { 209 Main.map.mapView.repaint(); 210 } 207 if (highlightEnabled && focused == displaylist && Main.isDisplayingMapView() && highlightHelper.highlightOnly(sel)) { 208 Main.map.mapView.repaint(); 211 209 } 212 210 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r11365 r11386 211 211 actEditRelationSelection.actionPerformed(null); 212 212 } 213 } else if (highlightEnabled && Main.isDisplayingMapView()) { 214 if (helper.highlightOnly(model.getElementAt(idx))) { 215 Main.map.mapView.repaint(); 216 } 213 } else if (highlightEnabled && Main.isDisplayingMapView() && helper.highlightOnly(model.getElementAt(idx))) { 214 Main.map.mapView.repaint(); 217 215 } 218 216 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r11366 r11386 385 385 if (Main.isDisplayingMapView()) { 386 386 int row = membershipTable.rowAtPoint(e.getPoint()); 387 if (row >= 0) { 388 if (highlightHelper.highlightOnly((Relation) membershipTable.getValueAt(row, 0))) { 389 Main.map.mapView.repaint(); 390 } 387 if (row >= 0 && highlightHelper.highlightOnly((Relation) membershipTable.getValueAt(row, 0))) { 388 Main.map.mapView.repaint(); 391 389 } 392 390 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java
r10212 r11386 132 132 } 133 133 } 134 if (strategy.isCloseChangesetAfterUpload()) { 135 if (changeset != null && changeset.getId() > 0) { 136 OsmApi.getOsmApi().closeChangeset(changeset, monitor.createSubTaskMonitor(0, false)); 137 } 134 if (strategy.isCloseChangesetAfterUpload() && changeset != null && changeset.getId() > 0) { 135 OsmApi.getOsmApi().closeChangeset(changeset, monitor.createSubTaskMonitor(0, false)); 138 136 } 139 137 } catch (OsmTransferException sxe) { -
trunk/src/org/openstreetmap/josm/gui/layer/AlignImageryPanel.java
r10611 r11386 83 83 public static void addNagPanelIfNeeded(ImageryInfo infoToAdd) { 84 84 BooleanProperty showAgain = new BooleanProperty("message.imagery.nagPanel." + infoToAdd.getUrl(), true); 85 if (Main.isDisplayingMapView() && showAgain.get() && !infoToAdd.isGeoreferenceValid()) { 86 if (Main.map.getTopPanel(AlignImageryPanel.class) == null) { 87 double w = GuiHelper.getScreenSize().getWidth(); 88 AlignImageryPanel p = new AlignImageryPanel(w > 1300, showAgain, infoToAdd); 89 Main.map.addTopPanel(p); 90 } 85 if (Main.isDisplayingMapView() && showAgain.get() && !infoToAdd.isGeoreferenceValid() 86 && Main.map.getTopPanel(AlignImageryPanel.class) == null) { 87 double w = GuiHelper.getScreenSize().getWidth(); 88 Main.map.addTopPanel(new AlignImageryPanel(w > 1300, showAgain, infoToAdd)); 91 89 } 92 90 } -
trunk/src/org/openstreetmap/josm/gui/layer/NativeScaleLayer.java
r10600 r11386 174 174 for (int i = 0; i < size; i++) { 175 175 Scale current = this.scales.get(i); 176 if (previous != null) { 177 if (scale <= previous.scale && scale >= current.scale) { 178 if (floor || previous.scale / scale < scale / current.scale) { 179 return new Scale(previous.scale, previous.isNative, i-1); 180 } else { 181 return new Scale(current.scale, current.isNative, i); 182 } 176 if (previous != null && scale <= previous.scale && scale >= current.scale) { 177 if (floor || previous.scale / scale < scale / current.scale) { 178 return new Scale(previous.scale, previous.isNative, i-1); 179 } else { 180 return new Scale(current.scale, current.isNative, i); 183 181 } 184 182 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r11368 r11386 143 143 if (!hasNonModifier) { 144 144 p.a = new StyleElementList(p.a, NodeElement.SIMPLE_NODE_ELEMSTYLE); 145 if (!hasText) { 146 if (TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 147 p.a = new StyleElementList(p.a, BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE); 148 } 145 if (!hasText && TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 146 p.a = new StyleElementList(p.a, BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE); 149 147 } 150 148 } … … 318 316 } else if (osm instanceof Relation) { 319 317 Pair<StyleElementList, Range> p = generateStyles(osm, scale, true); 320 if (drawMultipolygon && ((Relation) osm).isMultipolygon()) { 321 if (!Utils.exists(p.a, AreaElement.class) && Main.pref.getBoolean("multipolygon.deprecated.outerstyle", true)) { 322 // look at outer ways to find area style 323 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, (Relation) osm); 324 for (Way w : multipolygon.getOuterWays()) { 325 Pair<StyleElementList, Range> wayStyles = generateStyles(w, scale, false); 326 p.b = Range.cut(p.b, wayStyles.b); 327 StyleElement area = Utils.find(wayStyles.a, AreaElement.class); 328 if (area != null) { 329 p.a = new StyleElementList(p.a, area); 330 break; 331 } 318 if (drawMultipolygon && ((Relation) osm).isMultipolygon() 319 && !Utils.exists(p.a, AreaElement.class) && Main.pref.getBoolean("multipolygon.deprecated.outerstyle", true)) { 320 // look at outer ways to find area style 321 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, (Relation) osm); 322 for (Way w : multipolygon.getOuterWays()) { 323 Pair<StyleElementList, Range> wayStyles = generateStyles(w, scale, false); 324 p.b = Range.cut(p.b, wayStyles.b); 325 StyleElement area = Utils.find(wayStyles.a, AreaElement.class); 326 if (area != null) { 327 p.a = new StyleElementList(p.a, area); 328 break; 332 329 } 333 330 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r10824 r11386 277 277 for (int i = 0; i < colors.getRowCount(); ++i) { 278 278 String key = (String) colors.getValueAt(i, 0); 279 if (Main.pref.putColor(key, (Color) colors.getValueAt(i, 1))) { 280 if (key.startsWith("mappaint.")) { 281 ret = true; 282 } 279 if (Main.pref.putColor(key, (Color) colors.getValueAt(i, 1)) && key.startsWith("mappaint.")) { 280 ret = true; 283 281 } 284 282 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java
r11374 r11386 101 101 102 102 switch(vColIndex) { 103 case 0: renderTagName((TagModel) value); break; 104 case 1: renderTagValue((TagModel) value); break; 105 106 default: throw new JosmRuntimeException("unexpected index in switch statement"); 103 case 0: renderTagName((TagModel) value); break; 104 case 1: renderTagValue((TagModel) value); break; 105 default: throw new JosmRuntimeException("unexpected index in switch statement"); 107 106 } 108 if (hasFocus && isSelected) { 109 if (table.getSelectedColumnCount() == 1 && table.getSelectedRowCount() == 1) { 110 if (table.getEditorComponent() != null) { 111 table.getEditorComponent().requestFocusInWindow(); 112 } 113 } 107 if (hasFocus && isSelected && table.getSelectedColumnCount() == 1 && table.getSelectedRowCount() == 1 108 && table.getEditorComponent() != null) { 109 table.getEditorComponent().requestFocusInWindow(); 114 110 } 115 111 return this; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r10768 r11386 280 280 if (o instanceof ComboMultiSelect) { 281 281 ((ComboMultiSelect) o).addListEntries(listEntries); 282 } else if (o instanceof Key) { 283 if (((Key) o).value == null) { 284 ((Key) o).value = ""; // Fix #8530 285 } 282 } else if (o instanceof Key && ((Key) o).value == null) { 283 ((Key) o).value = ""; // Fix #8530 286 284 } 287 285 listEntries = new LinkedList<>(); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r10657 r11386 127 127 */ 128 128 public static void addTaggingPresets(Collection<TaggingPreset> presets) { 129 if (presets != null) { 130 if (taggingPresets.addAll(presets)) { 131 for (TaggingPresetListener listener : listeners) { 132 listener.taggingPresetsModified(); 133 } 129 if (presets != null && taggingPresets.addAll(presets)) { 130 for (TaggingPresetListener listener : listeners) { 131 listener.taggingPresetsModified(); 134 132 } 135 133 } -
trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
r10611 r11386 120 120 if (timer.isRunning()) { 121 121 timer.stop(); 122 } else if (set.add(e.getKeyCode()) && enabled) { 123 if (isFocusInMainWindow()) { 124 for (KeyPressReleaseListener q: keyListeners) { 125 if (Main.isTraceEnabled()) { 126 Main.trace(q+" => doKeyPressed("+e+')'); 127 } 128 q.doKeyPressed(e); 122 } else if (set.add(e.getKeyCode()) && enabled && isFocusInMainWindow()) { 123 for (KeyPressReleaseListener q: keyListeners) { 124 if (Main.isTraceEnabled()) { 125 Main.trace(q+" => doKeyPressed("+e+')'); 129 126 } 127 q.doKeyPressed(e); 130 128 } 131 129 } … … 133 131 if (timer.isRunning()) { 134 132 timer.stop(); 135 if (set.remove(e.getKeyCode()) && enabled) { 136 if (isFocusInMainWindow()) { 137 for (KeyPressReleaseListener q: keyListeners) { 138 if (Main.isTraceEnabled()) { 139 Main.trace(q+" => doKeyReleased("+e+')'); 140 } 141 q.doKeyReleased(e); 133 if (set.remove(e.getKeyCode()) && enabled && isFocusInMainWindow()) { 134 for (KeyPressReleaseListener q: keyListeners) { 135 if (Main.isTraceEnabled()) { 136 Main.trace(q+" => doKeyReleased("+e+')'); 142 137 } 138 q.doKeyReleased(e); 143 139 } 144 140 } -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractTextComponentValidator.java
r10378 r11386 115 115 tc.getDocument().addDocumentListener(this); 116 116 } 117 if (addActionListener) { 118 if (tc instanceof JosmTextField) { 119 JosmTextField tf = (JosmTextField) tc; 120 tf.addActionListener(this); 121 } 117 if (addActionListener && tc instanceof JosmTextField) { 118 ((JosmTextField) tc).addActionListener(this); 122 119 } 123 120 tc.addPropertyChangeListener("enabled", this); -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r11288 r11386 339 339 while (entries.hasMoreElements()) { 340 340 ZipEntry entry = entries.nextElement(); 341 if (entry.getName().endsWith('.' + extension)) { 342 /* choose any file with correct extension. When more than 343 one file, prefer the one which matches namepart */ 344 if (resentry == null || entry.getName().indexOf(namepart) >= 0) { 345 resentry = entry; 346 } 341 // choose any file with correct extension. When more than one file, prefer the one which matches namepart 342 if (entry.getName().endsWith('.' + extension) && (resentry == null || entry.getName().indexOf(namepart) >= 0)) { 343 resentry = entry; 347 344 } 348 345 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r10755 r11386 193 193 remember(relation.getPrimitiveId()); 194 194 for (RelationMember member : !recursesDown() ? relation.getMembers() : Collections.<RelationMember>emptyList()) { 195 if (OsmPrimitiveType.from(member.getMember()).equals(OsmPrimitiveType.RELATION)) { 196 // avoid infinite recursion in case of cyclic dependencies in relations 197 // 198 if (relations.contains(member.getMember().getId())) { 199 continue; 200 } 195 // avoid infinite recursion in case of cyclic dependencies in relations 196 if (OsmPrimitiveType.from(member.getMember()).equals(OsmPrimitiveType.RELATION) 197 && relations.contains(member.getMember().getId())) { 198 continue; 201 199 } 202 200 if (!member.getMember().isIncomplete()) { -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r11381 r11386 667 667 int retCode = response.getResponseCode(); 668 668 669 if (retCode >= 500) { 670 if (retries-- > 0) { 671 sleepAndListen(retries, monitor); 672 Main.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries())); 673 continue; 674 } 669 if (retCode >= 500 && retries-- > 0) { 670 sleepAndListen(retries, monitor); 671 Main.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries())); 672 continue; 675 673 } 676 674 -
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r11098 r11386 82 82 File tmpFile = null; 83 83 try { 84 // use a tmp file because if something errors out in the 85 // process of writing the file, we might just end up with 86 // a truncated file. That can destroy lots of work. 84 // use a tmp file because if something errors out in the process of writing the file, 85 // we might just end up with a truncated file. That can destroy lots of work. 87 86 if (file.exists()) { 88 87 tmpFile = new File(file.getPath() + '~'); … … 91 90 92 91 doSave(file, layer); 93 if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) { 94 if (tmpFile != null) { 95 Utils.deleteFile(tmpFile); 96 } 92 if ((noBackup || !Main.pref.getBoolean("save.keepbackup", false)) && tmpFile != null) { 93 Utils.deleteFile(tmpFile); 97 94 } 98 95 layer.onPostSaveToFile(); … … 107 104 108 105 try { 109 // if the file save failed, then the tempfile will not 110 // be deleted. So, restore the backup if we made one. 106 // if the file save failed, then the tempfile will not be deleted. So, restore the backup if we made one. 111 107 if (tmpFile != null && tmpFile.exists()) { 112 108 Utils.copyFile(tmpFile, file); -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r11374 r11386 291 291 break; 292 292 case MIRROR: 293 if ("mirror".equals(qName)) { 294 if (mirrorEntry != null) { 295 entry.addMirror(mirrorEntry); 296 mirrorEntry = null; 297 } 293 if ("mirror".equals(qName) && mirrorEntry != null) { 294 entry.addMirror(mirrorEntry); 295 mirrorEntry = null; 298 296 } 299 297 break;
Note:
See TracChangeset
for help on using the changeset viewer.