Changeset 3237 in josm
- Timestamp:
- 2010-05-12T21:37:49+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r2901 r3237 588 588 return; 589 589 Layer layer = model.getLayer(index); 590 String current = Main.pref.get("marker.show "+layer.getName(),"show");591 Main.pref.put("marker.show "+layer.getName(), current.equalsIgnoreCase("show") ? "hide" : "show");592 590 layer.toggleVisible(); 593 591 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java
r1727 r3237 41 41 } 42 42 43 @Override public void paint(Graphics g, MapView mv, boolean mousePressed, String show) {44 if (! show.equalsIgnoreCase("show")) {45 super.paint(g, mv, mousePressed, show); 43 @Override public void paint(Graphics g, MapView mv, boolean mousePressed, boolean showTextOrIcon) { 44 if (!showTextOrIcon) { 45 super.paint(g, mv, mousePressed, showTextOrIcon); 46 46 return; 47 47 } … … 62 62 r.grow((inset.top+inset.bottom)/2, (inset.left+inset.right)/2); 63 63 b.paintBorder(mv, g, r.x, r.y, r.width, r.height); 64 if ((text != null) && (show.equalsIgnoreCase("show"))&& Main.pref.getBoolean("marker.buttonlabels", true))64 if ((text != null) && showTextOrIcon && Main.pref.getBoolean("marker.buttonlabels", true)) { 65 65 g.drawString(text, screen.x+4, screen.y+2); 66 } 66 67 } 67 68 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r2811 r3237 178 178 * @param mousePressed true if the left mouse button is pressed 179 179 */ 180 public void paint(Graphics g, MapView mv, boolean mousePressed, String show) {180 public void paint(Graphics g, MapView mv, boolean mousePressed, boolean showTextOrIcon) { 181 181 Point screen = mv.getPoint(getEastNorth()); 182 if (symbol != null && show .equalsIgnoreCase("show")) {182 if (symbol != null && showTextOrIcon) { 183 183 symbol.paintIcon(mv, g, screen.x-symbol.getIconWidth()/2, screen.y-symbol.getIconHeight()/2); 184 184 } else { … … 187 187 } 188 188 189 if ((text != null) && (show.equalsIgnoreCase("show"))) {189 if ((text != null) && showTextOrIcon) { 190 190 g.drawString(text, screen.x+4, screen.y+2); 191 191 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r3220 r3237 155 155 156 156 @Override public void paint(Graphics2D g, MapView mv, Bounds box) { 157 String mkrTextShow = Main.pref.get("marker.show "+getName(), "show");157 boolean showTextOrIcon = isTextOrIconShown(); 158 158 g.setColor(getColor(getName())); 159 159 … … 163 163 for (Marker mkr : data) { 164 164 if (mousePos != null && mkr.containsPoint(mousePos)) { 165 mkr.paint(g, mv, mousePressedTmp, mkrTextShow);165 mkr.paint(g, mv, mousePressedTmp, showTextOrIcon); 166 166 mousePressedTmp = false; 167 167 } … … 169 169 } else { 170 170 for (Marker mkr : data) { 171 mkr.paint(g, mv, false, mkrTextShow);171 mkr.paint(g, mv, false, showTextOrIcon); 172 172 } 173 173 } … … 284 284 components.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this))); 285 285 JCheckBoxMenuItem showMarkerTextItem = new JCheckBoxMenuItem(new ShowHideMarkerText(this)); 286 showMarkerTextItem.setState(isTextShown()); 286 showMarkerTextItem.setState(isTextOrIconShown()); 287 287 components.add(showMarkerTextItem); 288 288 components.add(new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this))); … … 452 452 } 453 453 454 private boolean isTextShown() { 454 private boolean isTextOrIconShown() { 455 455 String current = Main.pref.get("marker.show "+getName(),"show"); 456 return current.equalsIgnoreCase("show");456 return "show".equalsIgnoreCase(current); 457 457 } 458 458 … … 469 469 470 470 public void actionPerformed(ActionEvent e) { 471 Main.pref.put("marker.show "+layer.getName(), layer.isTextShown() ? "hide" : "show"); 471 Main.pref.put("marker.show "+layer.getName(), layer.isTextOrIconShown() ? "hide" : "show"); 472 472 Main.map.mapView.repaint(); 473 473 }
Note:
See TracChangeset
for help on using the changeset viewer.