Changeset 6172 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2013-08-21T18:15:12+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
-
dialogs/DialogsPanel.java (modified) (3 diffs)
-
dialogs/ToggleDialog.java (modified) (4 diffs)
-
mappaint/NodeElemStyle.java (modified) (5 diffs)
-
widgets/TextContextualPopupMenu.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r3530 r6172 1 1 // License: GPL. See LICENSE file for details. 2 3 2 package org.openstreetmap.josm.gui.dialogs; 4 3 … … 11 10 import javax.swing.JSplitPane; 12 11 13 import org.openstreetmap.josm.gui.MultiSplitPane;14 12 import org.openstreetmap.josm.gui.MultiSplitLayout.Divider; 15 13 import org.openstreetmap.josm.gui.MultiSplitLayout.Leaf; 16 14 import org.openstreetmap.josm.gui.MultiSplitLayout.Node; 17 15 import org.openstreetmap.josm.gui.MultiSplitLayout.Split; 18 19 public class DialogsPanel extends JPanel { 16 import org.openstreetmap.josm.gui.MultiSplitPane; 17 import org.openstreetmap.josm.tools.Destroyable; 18 19 public class DialogsPanel extends JPanel implements Destroyable { 20 20 protected List<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>(); 21 21 protected MultiSplitPane mSpltPane = new MultiSplitPane(); … … 292 292 } 293 293 294 @Override 294 295 public void destroy() { 295 296 for (ToggleDialog t : allDialogs) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r6170 r6172 13 13 import java.awt.GridBagLayout; 14 14 import java.awt.GridLayout; 15 import java.awt.Image;16 15 import java.awt.Rectangle; 17 16 import java.awt.Toolkit; … … 33 32 import javax.swing.AbstractAction; 34 33 import javax.swing.BorderFactory; 35 import javax.swing.ImageIcon;36 34 import javax.swing.JButton; 37 35 import javax.swing.JCheckBoxMenuItem; … … 462 460 463 461 // scale down the dialog icon 464 ImageIcon inIcon = ImageProvider.get("dialogs", iconName); 465 ImageIcon smallIcon = new ImageIcon(inIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)); 466 lblTitle = new JLabel("",smallIcon, JLabel.TRAILING); 462 lblTitle = new JLabel("", new ImageProvider("dialogs", iconName).setWidth(16).get(), JLabel.TRAILING); 467 463 lblTitle.setIconTextGap(8); 468 464 … … 500 496 // show the pref button if applicable 501 497 if (preferenceClass != null) { 502 inIcon = ImageProvider.get("preference"); 503 smallIcon = new ImageIcon(inIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)); 504 JButton pref = new JButton(smallIcon); 498 JButton pref = new JButton(new ImageProvider("preference").setWidth(16).get()); 505 499 pref.setToolTipText(tr("Open preferences for this panel")); 506 500 pref.setBorder(BorderFactory.createEmptyBorder()); -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r5812 r6172 6 6 import java.awt.BasicStroke; 7 7 import java.awt.Color; 8 import java.awt.Image; 8 9 import java.awt.Rectangle; 9 10 import java.awt.Stroke; … … 19 20 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 20 21 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 22 import org.openstreetmap.josm.tools.ImageProvider; 21 23 import org.openstreetmap.josm.tools.Utils; 22 24 … … 25 27 */ 26 28 public class NodeElemStyle extends ElemStyle implements StyleKeys { 27 public MapImage mapImage; 28 public Symbol symbol; 29 public final MapImage mapImage; 30 public final Symbol symbol; 31 32 private Image enabledNodeIcon; 33 private Image disabledNodeIcon; 29 34 30 35 public enum SymbolShape { SQUARE, CIRCLE, TRIANGLE, PENTAGON, HEXAGON, HEPTAGON, OCTAGON, NONAGON, DECAGON } … … 230 235 } 231 236 237 private Image getRealNodeIcon(final Image image) { 238 final int maxSize = 16; 239 // Scale down large (.svg) images to 16x16 pixels if no size is explicitely specified 240 if ((mapImage.width == -1 && image.getWidth(null) > maxSize) 241 || (mapImage.height == -1 && image.getHeight(null) > maxSize)) { 242 return ImageProvider.createBoundedImage(image, maxSize); 243 } else { 244 return image; 245 } 246 } 247 232 248 @Override 233 249 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean member) { … … 235 251 Node n = (Node) primitive; 236 252 if (mapImage != null && painter.isShowIcons()) { 237 painter.drawNodeIcon(n, (painter.isInactiveMode() || n.isDisabled()) ? mapImage.getDisabled() : mapImage.getImage(), 238 Utils.color_int2float(mapImage.alpha), selected, member); 253 final Image nodeIcon; 254 if (painter.isInactiveMode() || n.isDisabled()) { 255 if (disabledNodeIcon == null) { 256 disabledNodeIcon = getRealNodeIcon(mapImage.getDisabled()); 257 } 258 nodeIcon = disabledNodeIcon; 259 } else { 260 if (enabledNodeIcon == null) { 261 enabledNodeIcon = getRealNodeIcon(mapImage.getImage()); 262 } 263 nodeIcon = enabledNodeIcon; 264 } 265 painter.drawNodeIcon(n, nodeIcon, Utils.color_int2float(mapImage.alpha), selected, member); 239 266 } else if (symbol != null) { 240 267 Color fillColor = symbol.fillColor; -
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r6084 r6172 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Image;7 6 import java.awt.event.ActionEvent; 8 7 import java.beans.PropertyChangeEvent; … … 149 148 mi.setText(label); 150 149 if (iconName != null && Main.pref.getBoolean("text.popupmenu.useicons", true)) { 151 ImageIcon icon = ImageProvider .get(iconName);150 ImageIcon icon = new ImageProvider(iconName).setWidth(16).get(); 152 151 if (icon != null) { 153 mi.setIcon( new ImageIcon(icon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)));152 mi.setIcon(icon); 154 153 } 155 154 }
Note:
See TracChangeset
for help on using the changeset viewer.
