Changeset 3854 in josm for trunk/src/org


Ignore:
Timestamp:
2011-02-04T23:49:33+01:00 (14 years ago)
Author:
bastiK
Message:

Removed property "mappaint.style", including gui selection combobox. It was intended to restrict the used mappaint styles: A style is not used unless the so called "name" property is equal to Main.pref.get("mappaint.style"). This system was not really used: All styles in the list of published styles have name "default" or no name at all which is the same. The selection of styles will be done by checkboxes, so they can be turned on and off individually. At the moment, the "name" property is still used for caching and definition of color preference keys.

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r3848 r3854  
    55import java.util.ArrayList;
    66import java.util.Collection;
    7 import java.util.HashSet;
     7import java.util.Collections;
    88import java.util.Iterator;
    99import java.util.List;
    1010import java.util.Map.Entry;
    11 import java.util.Set;
    12 
    13 import org.openstreetmap.josm.Main;
     11
    1412import org.openstreetmap.josm.data.osm.Node;
    1513import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1917import org.openstreetmap.josm.gui.NavigatableComponent;
    2018import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList;
    21 import org.openstreetmap.josm.tools.FilteredCollection;
    2219import org.openstreetmap.josm.tools.Pair;
    23 import org.openstreetmap.josm.tools.Predicate;
    2420import org.openstreetmap.josm.tools.Utils;
    2521
     
    4440
    4541    public Collection<StyleSource> getStyleSources() {
    46         return new FilteredCollection<StyleSource>(styleSources, new Predicate<StyleSource>() {
    47 
    48             String name = Main.pref.get("mappaint.style", "standard");
    49 
    50             @Override
    51             public boolean evaluate(StyleSource s) {
    52                 return Utils.equal(s.getPrefName(), name);
    53             }
    54 
    55         });
    56     }
    57 
    58     public Collection<String> getStyleNames() {
    59         Set<String> names = new HashSet<String>();
    60         names.add("standard");
    61         for (StyleSource s : styleSources) {
    62             if (s.name != null) {
    63                 names.add(s.name);
    64             }
    65         }
    66         return names;
     42        return Collections.<StyleSource>unmodifiableCollection(styleSources);
    6743    }
    6844
  • trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java

    r3848 r3854  
    2828    private SourceEditor sources;
    2929    private JCheckBox enableIconDefault;
    30     private JComboBox styleCombo = new JComboBox();
    3130
    3231    public static class Factory implements PreferenceSettingFactory {
     
    4241        sources = new MapPaintSourceEditor();
    4342
    44         Collection<String> styles = new TreeSet<String>(MapPaintStyles.getStyles().getStyleNames());
    45         String defstyle = Main.pref.get("mappaint.style", "standard");
    46         styles.add(defstyle);
    47         for(String style : styles) {
    48             styleCombo.addItem(style);
    49         }
    50 
    51         styleCombo.setEditable(true);
    52         for (int i = 0; i < styleCombo.getItemCount(); ++i) {
    53             if (((String)styleCombo.getItemAt(i)).equals(defstyle)) {
    54                 styleCombo.setSelectedIndex(i);
    55                 break;
    56             }
    57         }
    58 
    5943        final JPanel panel = new JPanel(new GridBagLayout());
    6044        panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
    61 
    62         panel.add(new JLabel(tr("Used style")), GBC.std().insets(5,5,0,5));
    63         panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
    64         panel.add(styleCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,0,5,0));
    6545
    6646        panel.add(sources, GBC.eol().fill(GBC.BOTH));
     
    170150            restart = true;
    171151        }
    172         if(Main.pref.put("mappaint.style", styleCombo.getEditor().getItem().toString())
    173         && Main.isDisplayingMapView())
     152        if(Main.isDisplayingMapView())
    174153        {
    175154            MapPaintStyles.getStyles().clearCached();
Note: See TracChangeset for help on using the changeset viewer.