- Timestamp:
- 2009-03-18T15:46:46+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r1482 r1498 134 134 if (c instanceof Helpful) 135 135 return ((Helpful)c).helpTopic(); 136 if (c instanceof JMenu) 137 return "Menu/"+((JMenu)c).getText(); 136 if (c instanceof JMenu) { 137 JMenu b = (JMenu)c; 138 if (b.getClientProperty("help") != null) 139 return (String)b.getClientProperty("help"); 140 return "Menu/"+b.getText(); 141 } 138 142 if (c instanceof AbstractButton) { 139 143 AbstractButton b = (AbstractButton)c; … … 163 167 */ 164 168 public void setHelpUrl(String url) { 165 int i = url.lastIndexOf("/")+1; 166 String title = url.substring(i); 167 if(!title.startsWith(languageCode) && !languageCode.equals("En:")) 168 title = languageCode + title; 169 String langurl = url.substring(0, i) + title; 169 int i = url.indexOf("/wiki/Help/")+6; 170 String langurl = url; 171 if(i > 0) 172 { 173 String title = url.substring(i); 174 if(!title.startsWith(languageCode) && !languageCode.equals("En:")) 175 title = languageCode + title; 176 langurl = url.substring(0, i) + title; 177 } 170 178 boolean loaded = false; 171 179 if(!langurl.equals(this.url) && !langurl.equals(url)) -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r1434 r1498 3 3 package org.openstreetmap.josm.gui; 4 4 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 … … 14 15 import javax.swing.JMenuItem; 15 16 import javax.swing.KeyStroke; 17 18 /* For the fullscreen action */ 19 import java.awt.Frame; 20 import java.awt.GraphicsEnvironment; 21 import java.awt.GraphicsDevice; 22 import org.openstreetmap.josm.tools.PlatformHookUnixoid; 16 23 17 24 import org.openstreetmap.josm.Main; … … 135 142 public final JosmAction statusreport = new ShowStatusReportAction(); 136 143 137 public final JMenu fileMenu = new JMenu(tr("File")); 138 public final JMenu editMenu = new JMenu(tr("Edit")); 139 public final JMenu viewMenu = new JMenu(tr("View")); 140 public final JMenu toolsMenu = new JMenu(tr("Tools")); 141 public final JMenu audioMenu = new JMenu(tr("Audio")); 142 public final JMenu presetsMenu = new JMenu(tr("Presets")); 143 public final JMenu helpMenu = new JMenu(tr("Help")); 144 public final JMenu fileMenu = addMenu(marktr("File"), KeyEvent.VK_F, 0); 145 public final JMenu editMenu = addMenu(marktr("Edit"), KeyEvent.VK_E, 1); 146 public final JMenu viewMenu = addMenu(marktr("View"), KeyEvent.VK_V, 2); 147 public final JMenu toolsMenu = addMenu(marktr("Tools"), KeyEvent.VK_T, 3); 148 public final JMenu presetsMenu = addMenu(marktr("Presets"), KeyEvent.VK_P, 4); 149 public JMenu audioMenu = null; 150 public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 5); 151 public final int defaultMenuPos = 5; 144 152 145 153 /** … … 160 168 return menuitem; 161 169 } 162 163 /** 164 * Add a menu to the main menu. 165 * 166 * This method handles all the shortcut handling. 167 */ 168 public void add(JMenu menu, int mnemonicKey, String shortName) { 169 Shortcut.registerShortcut("menu:" + shortName, tr("Menu: {0}", menu.getText()), mnemonicKey, 170 public JMenu addMenu(String name, int mnemonicKey, int position) 171 { 172 JMenu menu = new JMenu(tr(name)); 173 Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", tr(name)), mnemonicKey, 170 174 Shortcut.GROUP_MNEMONIC).setMnemonic(menu); 171 add(menu); 175 add(menu, position); 176 menu.putClientProperty("help", "Menu/"+name); 177 return menu; 172 178 } 173 179 … … 188 194 fileMenu.addSeparator(); 189 195 add(fileMenu, exit); 190 add(fileMenu, KeyEvent.VK_F, "file");191 196 192 197 add(editMenu, undo); … … 205 210 editMenu.addSeparator(); 206 211 add(editMenu, preferences); 207 add(editMenu, KeyEvent.VK_E, "edit");208 212 209 213 // TODO move code to an "action" like the others? … … 229 233 add(viewMenu, autoScaleAction); 230 234 } 231 add(viewMenu, KeyEvent.VK_V, "view"); 235 236 // 237 // Full Screen action 238 // 239 final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 240 241 if (Main.platform instanceof PlatformHookUnixoid && gd.isFullScreenSupported()) { 242 final JCheckBoxMenuItem fullscreen = new JCheckBoxMenuItem(tr("Full Screen")); 243 fullscreen.setSelected(Main.pref.getBoolean("draw.fullscreen", false)); 244 fullscreen.setAccelerator(Shortcut.registerShortcut("menu:view:fullscreen", tr("Toggle Full Screen view"), 245 KeyEvent.VK_F11, Shortcut.GROUP_DIRECT).getKeyStroke()); 246 247 fullscreen.addActionListener(new ActionListener() { 248 public void actionPerformed(ActionEvent ev) { 249 Main.pref.put("draw.fullscreen", fullscreen.isSelected()); 250 251 if (Main.pref.getBoolean("draw.fullscreen")) { 252 Frame frame = (Frame)Main.parent; 253 gd.setFullScreenWindow(frame); 254 } else { 255 gd.setFullScreenWindow(null); 256 } 257 } 258 }); 259 viewMenu.addSeparator(); 260 viewMenu.add(fullscreen); 261 } 232 262 233 263 add(toolsMenu, splitWay); … … 249 279 toolsMenu.addSeparator(); 250 280 add(toolsMenu, historyinfo); 251 add(toolsMenu, KeyEvent.VK_T, "tools");252 253 add(presetsMenu, KeyEvent.VK_P, "presets");254 281 255 282 if (!Main.pref.getBoolean("audio.menuinvisible", false)) { 283 audioMenu = addMenu(marktr("Audio"), KeyEvent.VK_A, 5); 256 284 add(audioMenu, audioPlayPause); 257 285 add(audioMenu, audioNext); … … 261 289 add(audioMenu, audioSlower); 262 290 add(audioMenu, audioFaster); 263 add(audioMenu, KeyEvent.VK_A, "audio");264 291 } 265 292 266 /* TODO: Anyone really using this feature? */267 /*JMenuItem check = new JMenuItem("DEBUG: Check Dataset");268 check.addActionListener(new ActionListener() {269 public void actionPerformed(ActionEvent e) {270 DataSetChecker.check();271 }272 });273 helpMenu.add(check);*/274 275 293 helpMenu.add(statusreport); 276 294 277 295 current = helpMenu.add(help); // FIXME why is help not a JosmAction? 278 296 current.setAccelerator(Shortcut.registerShortcut("system:help", tr("Help"), KeyEvent.VK_F1, 279 297 Shortcut.GROUP_DIRECT).getKeyStroke()); 280 298 add(helpMenu, about); 281 add(helpMenu, KeyEvent.VK_H, "help");282 299 } 283 300 }
Note:
See TracChangeset
for help on using the changeset viewer.