[ros-diffs] [cfinck] 33079: - Make the "Exit" string translateable - Use the last possible ID for this command, so we can add as many keyboard layouts as possible to the popup menu - Send a WM_CLOSE message when clicking "Exit", don't duplicate the WM_DESTROY code here

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sun Apr 20 21:49:11 CEST 2008


Author: cfinck
Date: Sun Apr 20 14:49:10 2008
New Revision: 33079

URL: http://svn.reactos.org/svn/reactos?rev=33079&view=rev
Log:
- Make the "Exit" string translateable
- Use the last possible ID for this command, so we can add as many keyboard layouts as possible to the popup menu
- Send a WM_CLOSE message when clicking "Exit", don't duplicate the WM_DESTROY code here

Added:
    trunk/reactos/base/applications/kbswitch/lang/
    trunk/reactos/base/applications/kbswitch/lang/de-DE.rc   (with props)
    trunk/reactos/base/applications/kbswitch/lang/en-US.rc   (with props)
    trunk/reactos/base/applications/kbswitch/rsrc.rc   (with props)
Modified:
    trunk/reactos/base/applications/kbswitch/kbswitch.c
    trunk/reactos/base/applications/kbswitch/kbswitch.h
    trunk/reactos/base/applications/kbswitch/kbswitch.rc
    trunk/reactos/base/applications/kbswitch/resource.h

Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/kbswitch.c?rev=33079&r1=33078&r2=33079&view=diff
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -137,6 +137,7 @@
     HMENU hMenu;
     HKEY hKey;
     DWORD dwIndex, dwSize;
+    LPTSTR szExit;
     TCHAR szLayoutNum[CCH_ULONG_DEC + 1];
     TCHAR szName[MAX_PATH];
 
@@ -159,8 +160,9 @@
         RegCloseKey(hKey);
     }
 
-    AppendMenu(hMenu, MF_SEPARATOR, 0, _T(""));
-    AppendMenu(hMenu, MF_STRING, 1000, _T("Exit"));
+    LoadString(hInst, IDS_EXIT, (LPTSTR)&szExit, 0);
+    AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+    AppendMenu(hMenu, MF_STRING, MENU_ID_EXIT, szExit);
 
     return hMenu;
 }
@@ -194,16 +196,11 @@
             break;
 
         case WM_COMMAND:
-            if (LOWORD(wParam) == 1000)
-            {
-                DestroyMenu(hPopupMenu);
-                DelTrayIcon(hwnd);
-                PostQuitMessage(0);
-            }
+            if (LOWORD(wParam) == MENU_ID_EXIT)
+                SendMessage(hwnd, WM_CLOSE, 0, 0);
             else
-            {
                 ActivateLayout(LOWORD(wParam));
-            }
+
             break;
 
         case WM_DESTROY:

Modified: trunk/reactos/base/applications/kbswitch/kbswitch.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/kbswitch.h?rev=33079&r1=33078&r2=33079&view=diff
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -9,3 +9,5 @@
 
 // Maximum Character Count of a ULONG in decimal
 #define CCH_ULONG_DEC    10
+
+#define MENU_ID_EXIT     65535

Modified: trunk/reactos/base/applications/kbswitch/kbswitch.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/kbswitch.rc?rev=33079&r1=33078&r2=33079&view=diff
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.rc [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -3,4 +3,11 @@
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
+#define REACTOS_STR_FILE_DESCRIPTION	"ReactOS Keyboard Layout Switcher\0"
+#define REACTOS_STR_INTERNAL_NAME	"kbswitch\0"
+#define REACTOS_STR_ORIGINAL_FILENAME	"kbswitch.exe\0"
+#include <reactos/version.rc>
+
 IDI_MAIN ICON "res/kbswitch.ico"
+
+#include "rsrc.rc"

Added: trunk/reactos/base/applications/kbswitch/lang/de-DE.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/lang/de-DE.rc?rev=33079&view=auto
==============================================================================
--- trunk/reactos/base/applications/kbswitch/lang/de-DE.rc (added)
+++ trunk/reactos/base/applications/kbswitch/lang/de-DE.rc [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -1,0 +1,6 @@
+LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
+
+STRINGTABLE
+BEGIN
+	IDS_EXIT, "Beenden"
+END

Propchange: trunk/reactos/base/applications/kbswitch/lang/de-DE.rc
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/base/applications/kbswitch/lang/en-US.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/lang/en-US.rc?rev=33079&view=auto
==============================================================================
--- trunk/reactos/base/applications/kbswitch/lang/en-US.rc (added)
+++ trunk/reactos/base/applications/kbswitch/lang/en-US.rc [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -1,0 +1,6 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE
+BEGIN
+	IDS_EXIT, "Exit"
+END

Propchange: trunk/reactos/base/applications/kbswitch/lang/en-US.rc
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/base/applications/kbswitch/resource.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/resource.h?rev=33079&r1=33078&r2=33079&view=diff
==============================================================================
--- trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -1,2 +1,5 @@
 /* Icons */
 #define IDI_MAIN    100
+
+/* Strings */
+#define IDS_EXIT    1001

Added: trunk/reactos/base/applications/kbswitch/rsrc.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch/rsrc.rc?rev=33079&view=auto
==============================================================================
--- trunk/reactos/base/applications/kbswitch/rsrc.rc (added)
+++ trunk/reactos/base/applications/kbswitch/rsrc.rc [iso-8859-1] Sun Apr 20 14:49:10 2008
@@ -1,0 +1,2 @@
+#include "lang/de-DE.rc"
+#include "lang/en-US.rc"

Propchange: trunk/reactos/base/applications/kbswitch/rsrc.rc
------------------------------------------------------------------------------
    svn:eol-style = native



More information about the Ros-diffs mailing list