Changeset 397 in josm
- Timestamp:
- 2007-10-16T23:18:46+02:00 (17 years ago)
- Location:
- trunk
- Files:
-
- 53 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r343 r397 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry excluding="build/|dist/|src/|test/" including="images/ " kind="src" path=""/>4 <classpathentry excluding="build/|dist/|src/|test/" including="images/|presets/" kind="src" path=""/> 5 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 6 <classpathentry kind="lib" path=" lib/metadata-extractor-2.3.1.jar"/>6 <classpathentry kind="lib" path="/home/fred/src/eclipse-workspace/JOSM/lib/metadata-extractor-2.3.1-nosun.jar"/> 7 7 <classpathentry kind="lib" path="lib/gettext-commons-0.9.jar" sourcepath="C:/Download/gettext-commons-0.9-src.zip"/> 8 8 <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> -
trunk/build.xml
r392 r397 25 25 </copy> 26 26 27 <!-- presets --> 28 <copy todir="build/presets"> 29 <fileset dir="presets" /> 30 </copy> 31 27 32 <!-- create josm-custom.jar --> 28 33 <jar destfile="dist/josm-custom.jar" basedir="build"> … … 37 42 </target> 38 43 39 40 41 44 <target name="init"> 42 45 <mkdir dir="build" /> -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r343 r397 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.BorderLayout; 7 import java.awt.GridBagLayout; 6 8 import java.awt.event.ActionEvent; 7 9 import java.awt.event.ActionListener; 10 import java.util.Vector; 8 11 9 12 import javax.swing.Action; 13 import javax.swing.DefaultComboBoxModel; 10 14 import javax.swing.JMenu; 11 15 import javax.swing.JMenuBar; 12 16 import javax.swing.JMenuItem; 17 import javax.swing.JPanel; 13 18 14 19 import org.openstreetmap.josm.actions.AboutAction; … … 35 40 import org.openstreetmap.josm.actions.search.SearchAction; 36 41 import org.openstreetmap.josm.data.DataSetChecker; 42 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference; 43 import org.openstreetmap.josm.gui.tagging.ForwardActionListener; 44 import org.openstreetmap.josm.gui.tagging.TaggingCellRenderer; 45 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 46 import org.openstreetmap.josm.tools.GBC; 37 47 38 48 /** … … 75 85 public final JMenu connectionMenu = new JMenu(tr("Connection")); 76 86 public final JMenu toolsMenu = new JMenu(tr("Tools")); 87 public final JMenu presetsMenu = new JMenu(tr("Presets")); 77 88 78 89 public final JMenu zoomToMenu = new JMenu(tr("Zoom To")); … … 128 139 layerMenu.setVisible(false); 129 140 141 add(presetsMenu); 142 130 143 JMenuItem check = new JMenuItem("DEBUG: Check Dataset"); 131 144 check.addActionListener(new ActionListener(){ … … 140 153 helpMenu.add(about); 141 154 add(helpMenu); 155 142 156 } 143 157 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r352 r397 321 321 super(tr("Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."), KeyEvent.VK_P, 150); 322 322 323 // --------------------------------------- 324 // This drop-down will probably be removed soon. 325 // 323 326 if (TaggingPresetPreference.taggingPresets.size() > 0) { 324 327 Vector<ActionListener> allPresets = new Vector<ActionListener>(); … … 326 329 allPresets.add(new ForwardActionListener(this, p)); 327 330 328 allPresets.add(0, new ForwardActionListener(this, new TaggingPreset())); 331 TaggingPreset empty = new TaggingPreset(); 332 // empty.setName("this drop-down will be removed soon"); 333 allPresets.add(0, new ForwardActionListener(this, empty)); 329 334 taggingPresets.setModel(new DefaultComboBoxModel(allPresets)); 330 335 JPanel north = new JPanel(new GridBagLayout()); … … 341 346 }); 342 347 taggingPresets.setRenderer(new TaggingCellRenderer()); 348 349 // End of "will be removed soon". 350 // -------------------------------------------- 343 351 344 352 // setting up the properties table -
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r298 r397 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 7 import java.awt.GridBagLayout; 8 9 import javax.swing.BorderFactory; 6 10 import javax.swing.JComboBox; 7 11 import javax.swing.JLabel; 12 import javax.swing.JPanel; 8 13 9 14 import org.openstreetmap.josm.Main; … … 26 31 } 27 32 projectionCombo.addActionListener(gui.requireRestartAction); 28 29 gui.map.add(new JLabel(tr("Projection method")), GBC.std()); 30 gui.map.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 31 gui.map.add(projectionCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,0,0,5)); 33 34 JPanel projPanel = new JPanel(); 35 projPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Map Projection"))); 36 projPanel.setLayout(new GridBagLayout()); 37 projPanel.add(new JLabel(tr("Projection method")), GBC.std().insets(5,5,0,5)); 38 projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 39 projPanel.add(projectionCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5)); 40 gui.map.add(projPanel, GBC.eol().insets(0,0,0,10).fill(GBC.HORIZONTAL)); 32 41 } 33 42 -
trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
r343 r397 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 6 7 import java.awt.GridBagLayout; 7 8 import java.awt.event.ActionEvent; … … 10 11 import java.util.StringTokenizer; 11 12 13 import javax.swing.Action; 14 import javax.swing.BorderFactory; 12 15 import javax.swing.Box; 13 16 import javax.swing.DefaultListModel; 14 17 import javax.swing.JButton; 18 import javax.swing.JCheckBox; 15 19 import javax.swing.JLabel; 16 20 import javax.swing.JList; 21 import javax.swing.JMenuItem; 17 22 import javax.swing.JOptionPane; 18 23 import javax.swing.JPanel; 19 24 import javax.swing.JScrollPane; 25 import javax.swing.JSeparator; 26 import javax.swing.border.BevelBorder; 20 27 21 28 import org.openstreetmap.josm.Main; … … 27 34 public static Collection<TaggingPreset> taggingPresets; 28 35 private JList taggingPresetSources; 36 private JCheckBox enableDefault; 37 38 public void addGui(final PreferenceDialog gui) { 39 40 taggingPresetSources = new JList(new DefaultListModel()); 41 enableDefault = new JCheckBox(tr("Enable built-in defaults"), 42 Main.pref.getBoolean("taggingpreset.enable-defaults")); 29 43 30 public void addGui(final PreferenceDialog gui) {31 taggingPresetSources = new JList(new DefaultListModel());32 44 String annos = Main.pref.get("taggingpreset.sources"); 33 45 StringTokenizer st = new StringTokenizer(annos, ";"); … … 78 90 deleteAnno.setToolTipText(tr("Delete the selected source from the list.")); 79 91 80 gui.map.add(new JLabel(tr("Tagging preset sources")), GBC.eol().insets(0,5,0,0)); 81 gui.map.add(new JScrollPane(taggingPresetSources), GBC.eol().fill(GBC.BOTH)); 92 JPanel tpPanel = new JPanel(); 93 tpPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Tagging Presets"))); 94 tpPanel.setLayout(new GridBagLayout()); 95 tpPanel.add(enableDefault, GBC.eol().insets(5,5,5,0)); 96 tpPanel.add(new JLabel(tr("Tagging preset sources")), GBC.eol().insets(5,5,5,0)); 97 tpPanel.add(new JScrollPane(taggingPresetSources), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH)); 82 98 JPanel buttonPanel = new JPanel(new GridBagLayout()); 83 gui.map.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));99 tpPanel.add(buttonPanel, GBC.eol().insets(5,0,5,5).fill(GBC.HORIZONTAL)); 84 100 buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 85 101 buttonPanel.add(addAnno, GBC.std().insets(0,5,0,0)); 86 102 buttonPanel.add(editAnno, GBC.std().insets(5,5,5,0)); 87 103 buttonPanel.add(deleteAnno, GBC.std().insets(0,5,0,0)); 104 gui.map.add(tpPanel, GBC.eol().fill(GBC.BOTH)); 88 105 } 89 106 90 107 public void ok() { 108 Main.pref.put("taggingpreset.enable-defaults", enableDefault.getSelectedObjects() != null); 91 109 if (taggingPresetSources.getModel().getSize() > 0) { 92 110 StringBuilder sb = new StringBuilder(); … … 103 121 public static void initialize() { 104 122 taggingPresets = TaggingPreset.readFromPreferences(); 123 for (final TaggingPreset p : taggingPresets) { 124 if (p.getValue(Action.NAME).equals(" ")) { 125 Main.main.menu.presetsMenu.add(new JSeparator()); 126 } else { 127 Main.main.menu.presetsMenu.add(new JMenuItem(p)); 128 } 129 } 105 130 } 106 131 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r304 r397 167 167 /** 168 168 * 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. 169 172 */ 170 173 public void setIcon(String iconName) { … … 172 175 if (icon == null) 173 176 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)); 176 179 putValue(Action.SMALL_ICON, icon); 177 180 } … … 225 228 LinkedList<TaggingPreset> allPresets = new LinkedList<TaggingPreset>(); 226 229 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 227 240 StringTokenizer st = new StringTokenizer(allTaggingPresets, ";"); 228 241 while (st.hasMoreTokens()) { … … 232 245 if (source.startsWith("http") || source.startsWith("ftp") || source.startsWith("file")) 233 246 in = new URL(source).openStream(); 234 else if (source.startsWith("resource://")) 247 else if (source.startsWith("resource://")) 235 248 in = Main.class.getResourceAsStream(source.substring("resource:/".length())); 236 249 else … … 248 261 return allPresets; 249 262 } 250 251 263 252 264 public JPanel createPanel() {
Note:
See TracChangeset
for help on using the changeset viewer.