Ignore:
Timestamp:
16.10.2007 23:18:46 (5 years ago)
Author:
framm
Message:
  • added a built-in set of tagging presets. this can be disabled from preferences panel, or replaced with an own control file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r304 r397  
    167167        /** 
    168168         * Called from the XML parser to set the icon 
     169         *  
     170         * FIXME for Java 1.6 - use 24x24 icons for LARGE_ICON_KEY (button bar) 
     171         * and the 16x16 icons for SMALL_ICON. 
    169172         */ 
    170173        public void setIcon(String iconName) { 
     
    172175                if (icon == null) 
    173176                        icon = new ImageIcon(iconName); 
    174                 if (Math.max(icon.getIconHeight(), icon.getIconWidth()) != 24) 
    175                         icon = new ImageIcon(icon.getImage().getScaledInstance(24, 24, Image.SCALE_SMOOTH)); 
     177                if (Math.max(icon.getIconHeight(), icon.getIconWidth()) != 16) 
     178                        icon = new ImageIcon(icon.getImage().getScaledInstance(16, 16, Image.SCALE_SMOOTH)); 
    176179                putValue(Action.SMALL_ICON, icon); 
    177180        } 
     
    225228                LinkedList<TaggingPreset> allPresets = new LinkedList<TaggingPreset>(); 
    226229                String allTaggingPresets = Main.pref.get("taggingpreset.sources"); 
     230                 
     231                if (Main.pref.getBoolean("taggingpreset.enable-defaults")) { 
     232                        InputStream in = Main.class.getResourceAsStream("/presets/presets.xml"); 
     233                        try { 
     234                                allPresets.addAll(TaggingPreset.readAll(in)); 
     235                        } catch (SAXException x) { 
     236                                JOptionPane.showMessageDialog(Main.parent, tr("Error parsing presets.xml: ")+x.getMessage()); 
     237                        } 
     238                } 
     239                 
    227240                StringTokenizer st = new StringTokenizer(allTaggingPresets, ";"); 
    228241                while (st.hasMoreTokens()) { 
     
    232245                                if (source.startsWith("http") || source.startsWith("ftp") || source.startsWith("file")) 
    233246                                        in = new URL(source).openStream(); 
    234                                 else if (source.startsWith("resource://")) 
     247                                else if (source.startsWith("resource://"))  
    235248                                        in = Main.class.getResourceAsStream(source.substring("resource:/".length())); 
    236249                                else 
     
    248261                return allPresets; 
    249262        } 
    250  
    251263 
    252264        public JPanel createPanel() { 
Note: See TracChangeset for help on using the changeset viewer.