source: josm/trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java@ 1862

Last change on this file since 1862 was 1415, checked in by stoecker, 16 years ago

applied patch #2185 by bruce89

File size: 4.4 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import org.openstreetmap.josm.tools.Shortcut;
5import org.openstreetmap.josm.tools.PlatformHookUnixoid;
6import org.openstreetmap.josm.Main;
7
8import java.awt.event.KeyEvent;
9import java.io.IOException;
10
11/**
12 * see PlatformHook.java
13 */
14public class PlatformHookWindows extends PlatformHookUnixoid implements PlatformHook {
15 public void preStartupHook(){
16 }
17 public void startupHook() {
18 }
19 public void openUrl(String url) throws IOException {
20 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
21 }
22 public void initShortcutGroups() {
23 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_NONE), Integer.toString(-1));
24 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_HOTKEY), Integer.toString(KeyEvent.CTRL_DOWN_MASK));
25 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_MENU), Integer.toString(KeyEvent.CTRL_DOWN_MASK));
26 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_EDIT), Integer.toString(0));
27 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_LAYER), Integer.toString(KeyEvent.ALT_DOWN_MASK));
28 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_DIRECT), Integer.toString(0));
29 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_MNEMONIC),Integer.toString(KeyEvent.ALT_DOWN_MASK));
30
31 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_NONE), Integer.toString(-1));
32 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), Integer.toString(KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
33 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_MENU), Integer.toString(KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
34 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_EDIT), Integer.toString(KeyEvent.SHIFT_DOWN_MASK));
35 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_LAYER), Integer.toString(KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
36 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT), Integer.toString(KeyEvent.SHIFT_DOWN_MASK));
37 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT1+Shortcut.GROUP_MNEMONIC), Integer.toString(KeyEvent.ALT_DOWN_MASK));
38
39 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_NONE), Integer.toString(-1));
40 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_HOTKEY), Integer.toString(KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
41 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_MENU), Integer.toString(KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
42 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_EDIT), Integer.toString(KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
43 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_LAYER), Integer.toString(KeyEvent.ALT_DOWN_MASK));
44 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_DIRECT), Integer.toString(KeyEvent.CTRL_DOWN_MASK));
45 Main.pref.put("shortcut.groups."+(Shortcut.GROUPS_ALT2+Shortcut.GROUP_MNEMONIC), Integer.toString(KeyEvent.ALT_DOWN_MASK));
46 }
47 public void initSystemShortcuts() {
48 // This list if far from complete!
49 Shortcut.registerSystemShortcut("system:exit", "unused", KeyEvent.VK_F4, KeyEvent.ALT_DOWN_MASK).setAutomatic(); // items with automatic shortcuts will not be added to the menu bar at all
50 Shortcut.registerSystemShortcut("system:menuexit", "unused", KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK);
51 Shortcut.registerSystemShortcut("system:copy", "unused", KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK);
52 Shortcut.registerSystemShortcut("system:paste", "unused", KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK);
53 Shortcut.registerSystemShortcut("system:cut", "unused", KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK);
54 Shortcut.registerSystemShortcut("system:duplicate", "unused", KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK); // not really system, but to avoid odd results
55 Shortcut.registerSystemShortcut("system:help", "unused", KeyEvent.VK_F1, 0);
56 }
57}
58
59
60
61
Note: See TracBrowser for help on using the repository browser.