Package Manager: fixed HotKeys (thanks to w3seek) *shamed*
authorMaarten Bosma <maarten@bosma.de>
Mon, 11 Apr 2005 20:27:20 +0000 (20:27 +0000)
committerMaarten Bosma <maarten@bosma.de>
Mon, 11 Apr 2005 20:27:20 +0000 (20:27 +0000)
svn path=/trunk/; revision=14592

rosapps/packmgr/gui/generic.rc
rosapps/packmgr/gui/main.cpp
rosapps/packmgr/gui/main.h
rosapps/packmgr/gui/resource.h

index 2548649..8aaed69 100644 (file)
@@ -22,3 +22,13 @@ IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp"
 13 ICON DISCARDABLE "res/update.ico"\r
 14 ICON DISCARDABLE "res/uninstall.ico"\r
 \r
+/* HotKeys */\r
+\r
+IDR_HOTKEYS ACCELERATORS DISCARDABLE \r
+BEGIN\r
+    "1",   2,   VIRTKEY, CONTROL\r
+    "2",   3,   VIRTKEY, CONTROL\r
+    "3",   4,   VIRTKEY, CONTROL\r
+    "4",   5,   VIRTKEY, CONTROL\r
+    "0",   1,   VIRTKEY, CONTROL\r
+END\r
index eb06779..7e33cca 100644 (file)
@@ -67,8 +67,11 @@ int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, in
        // Start getting messages\r
        while(GetMessage(&msg,NULL,0,0))\r
        {\r
-         TranslateMessage(&msg);\r
-         DispatchMessage(&msg);\r
+               if(!TranslateAccelerator(hwnd, hHotKeys, &msg))\r
+               {\r
+                       TranslateMessage(&msg);\r
+                       DispatchMessage(&msg);\r
+               }\r
        }\r
        \r
        // Close our handle\r
@@ -152,11 +155,7 @@ void InitControls (HWND hwnd)
        ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(10))); \r
 \r
        // Setup Hotkeys\r
-       RegisterHotKey(hwnd, 1, MOD_CONTROL, VK_1);\r
-       RegisterHotKey(hwnd, 2, MOD_CONTROL, VK_2);\r
-       RegisterHotKey(hwnd, 3, MOD_CONTROL, VK_3);\r
-       RegisterHotKey(hwnd, 4, MOD_CONTROL, VK_4);\r
-       RegisterHotKey(hwnd, 0, MOD_CONTROL, VK_0);\r
+       hHotKeys = LoadAccelerators (hinst, MAKEINTRESOURCE(IDR_HOTKEYS));\r
 }\r
 \r
 // Set the Icons\r
index 93451f9..0a82ae2 100644 (file)
@@ -19,6 +19,7 @@ int selected, splitter_pos = 50;
 \r
 pTree tree;\r
 HMENU hPopup;\r
+HACCEL hHotKeys;\r
 HWND hTBar, hTree, hEdit, hStatus;\r
 HTREEITEM nodes [MAXNODES];\r
 \r
index 90aa5f7..b52531e 100644 (file)
@@ -12,3 +12,4 @@
 #define IDC_STATUS2            0x111 \r
 #define IDC_CANCEL             0x112 \r
 #define IDC_TSTATUS            0x113 \r
+#define IDR_HOTKEYS            0x114\r