Changeset 5582 in josm for trunk/src


Ignore:
Timestamp:
2012-11-16T23:30:23+01:00 (11 years ago)
Author:
bastiK
Message:

fixed #8196 - preset icon size (patch by kendzi)

File:
1 edited

Legend:

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

    r5579 r5582  
    313313        public String short_description;
    314314        public String icon;
     315        public String icon_size;
    315316        public String locale_display_value;
    316317        public String locale_short_description;
     
    341342
    342343        public ImageIcon getIcon() {
    343             return icon == null ? null : loadImageIcon(icon, zipIcons, 24);
     344            return icon == null ? null : loadImageIcon(icon, zipIcons, parseInteger(icon_size));
     345        }
     346
     347        private Integer parseInteger(String str) {
     348            if (str == null || "".equals(str))
     349                return null;
     350            try {
     351                return Integer.parseInt(str);
     352            } catch (Exception e) {
     353                //
     354            }
     355            return null;
    344356        }
    345357
     
    761773                    boolean cellHasFocus) {
    762774                PresetListEntry item = (PresetListEntry) value;
    763                
     775
    764776                // Only return cached size, item is not shown
    765777                if (!list.isShowing() && item.prefferedWidth != -1 && item.prefferedHeight != -1) {
     
    12761288        ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true);
    12771289        if (maxSize != null) {
    1278             imgProv.setMaxSize(24);
     1290            imgProv.setMaxSize(maxSize);
    12791291        }
    12801292        return imgProv.get();
Note: See TracChangeset for help on using the changeset viewer.