Changeset 3896 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
- Timestamp:
- 2011-02-13T13:13:04+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r3894 r3896 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 6 7 import java.io.IOException; 7 8 import java.io.InputStream; … … 28 29 29 30 final public List<MapCSSRule> rules; 31 private Color backgroundColorOverride; 30 32 31 33 public MapCSSStyleSource(String url, String name, String shortdescription) { … … 47 49 parser.sheet(this); 48 50 loadMeta(); 51 loadCanvas(); 49 52 } catch(IOException e) { 50 53 System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString())); … … 78 81 */ 79 82 private void loadMeta() { 83 Cascade c = constructSpecial("meta"); 84 String pTitle = c.get("title", null, String.class); 85 if (title == null) { 86 title = pTitle; 87 } 88 String pIcon = c.get("icon", null, String.class); 89 if (icon == null) { 90 icon = pIcon; 91 } 92 } 93 94 private void loadCanvas() { 95 Cascade c = constructSpecial("canvas"); 96 backgroundColorOverride = c.get("background-color", null, Color.class); 97 } 98 99 private Cascade constructSpecial(String type) { 100 80 101 MultiCascade mc = new MultiCascade(); 81 102 Node n = new Node(); … … 88 109 for (MapCSSRule r : rules) { 89 110 for (Selector s : r.selectors) { 90 if (s.base.equals( "meta")) {111 if (s.base.equals(type)) { 91 112 for (Condition cnd : s.conds) { 92 113 if (!cnd.applies(env)) … … 99 120 } 100 121 } 101 Cascade c = mc.getCascade("default"); 102 String pTitle = c.get("title", null, String.class); 103 if (title == null) { 104 title = pTitle; 105 } 106 String pIcon = c.get("icon", null, String.class); 107 if (icon == null) { 108 icon = pIcon; 109 } 122 return mc.getCascade("default"); 123 } 124 125 public Color getBackgroundColorOverride() { 126 return backgroundColorOverride; 110 127 } 111 128
Note:
See TracChangeset
for help on using the changeset viewer.
