[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 6 Jun 2014 21:05:59 +0000 (21:05 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 6 Jun 2014 21:05:59 +0000 (21:05 +0000)
- Rename a macro to something meaningful.
- Localize selection type strings.

svn path=/trunk/; revision=63545

25 files changed:
reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/bg-BG.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/cs-CZ.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/de-DE.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/el-GR.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/en-US.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/es-ES.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/fr-FR.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/he-IL.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/id-ID.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/it-IT.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/ja-JP.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/no-NO.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/pl-PL.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/pt-BR.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/ro-RO.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/ru-RU.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/sk-SK.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/sv-SE.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/tr-TR.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/uk-UA.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/zh-CN.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/lang/zh-TW.rc
reactos/win32ss/user/winsrv/consrv/frontends/gui/resource.h
reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c

index f660e34..adbbb08 100644 (file)
@@ -731,8 +731,8 @@ UpdateSelection(PGUI_CONSOLE_DATA GuiData, PCOORD coord)
 
         if ((GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0)
         {
-            LPWSTR SelectionType, WindowTitle = NULL;
-            SIZE_T Length = 0;
+            LPWSTR SelTypeStr = NULL   , WindowTitle = NULL;
+            SIZE_T SelTypeStrLength = 0, Length = 0;
 
             /* Clear the old selection */
             if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY)
@@ -740,21 +740,34 @@ UpdateSelection(PGUI_CONSOLE_DATA GuiData, PCOORD coord)
                 InvalidateRect(GuiData->hWindow, &oldRect, FALSE);
             }
 
-            if (GuiData->Selection.dwFlags & CONSOLE_MOUSE_SELECTION)
-            {
-                SelectionType = L"Selection - ";
-            }
-            else
+            /*
+             * When passing a zero-length buffer size, LoadString(...) returns
+             * a read-only pointer buffer to the program's resource string.
+             */
+            SelTypeStrLength =
+                LoadStringW(ConSrvDllInstance,
+                            (GuiData->Selection.dwFlags & CONSOLE_MOUSE_SELECTION)
+                                ? IDS_SELECT_TITLE : IDS_MARK_TITLE,
+                            (LPWSTR)&SelTypeStr, 0);
+
+            /*
+             * Prepend the selection type string to the current console title
+             * if we succeeded in retrieving a valid localized string.
+             */
+            if (SelTypeStr)
             {
-                SelectionType = L"Mark - ";
-            }
+                // 3 for " - " and 1 for NULL
+                Length = Console->Title.Length + (SelTypeStrLength + 3 + 1) * sizeof(WCHAR);
+                WindowTitle = ConsoleAllocHeap(0, Length);
 
-            Length = Console->Title.Length + wcslen(SelectionType) + 1;
-            WindowTitle = ConsoleAllocHeap(0, Length * sizeof(WCHAR));
-            wcscpy(WindowTitle, SelectionType);
-            wcscat(WindowTitle, Console->Title.Buffer);
-            SetWindowText(GuiData->hWindow, WindowTitle);
-            ConsoleFreeHeap(WindowTitle);
+                wcsncpy(WindowTitle, SelTypeStr, SelTypeStrLength);
+                WindowTitle[SelTypeStrLength] = L'\0';
+                wcscat(WindowTitle, L" - ");
+                wcscat(WindowTitle, Console->Title.Buffer);
+
+                SetWindowText(GuiData->hWindow, WindowTitle);
+                ConsoleFreeHeap(WindowTitle);
+            }
 
             GuiData->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS;
             ConioPause(Console, PAUSED_FROM_SELECTION);
@@ -771,6 +784,7 @@ UpdateSelection(PGUI_CONSOLE_DATA GuiData, PCOORD coord)
         GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION;
         ConioUnpause(Console, PAUSED_FROM_SELECTION);
 
+        /* Restore the console title */
         SetWindowText(GuiData->hWindow, Console->Title.Buffer);
     }
 }
@@ -1305,10 +1319,7 @@ OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
 
                 if (GetType(Buffer) == TEXTMODE_BUFFER)
                 {
-#ifdef IS_WHITESPACE
-#undef IS_WHITESPACE
-#endif
-#define IS_WHITESPACE(c)    \
+#define IS_WORD_SEP(c)  \
     ((c) == L'\0' || (c) == L' ' || (c) == L'\t' || (c) == L'\r' || (c) == L'\n')
 
                     PTEXTMODE_SCREEN_BUFFER TextBuffer = (PTEXTMODE_SCREEN_BUFFER)Buffer;
@@ -1320,15 +1331,15 @@ OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
                     ptrL = ptrR = ConioCoordToPointer(TextBuffer, cL.X, cL.Y);
 
                     /* Enlarge the selection by checking for whitespace */
-                    while ((0 < cL.X) && !IS_WHITESPACE(ptrL->Char.UnicodeChar)
-                                      && !IS_WHITESPACE((ptrL-1)->Char.UnicodeChar))
+                    while ((0 < cL.X) && !IS_WORD_SEP(ptrL->Char.UnicodeChar)
+                                      && !IS_WORD_SEP((ptrL-1)->Char.UnicodeChar))
                     {
                         --cL.X;
                         --ptrL;
                     }
                     while ((cR.X < TextBuffer->ScreenBufferSize.X - 1) &&
-                           !IS_WHITESPACE(ptrR->Char.UnicodeChar)      &&
-                           !IS_WHITESPACE((ptrR+1)->Char.UnicodeChar))
+                           !IS_WORD_SEP(ptrR->Char.UnicodeChar)        &&
+                           !IS_WORD_SEP((ptrR+1)->Char.UnicodeChar))
                     {
                         ++cR.X;
                         ++ptrR;
index fd09239..6f56be2 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index b40524a..6cf5faf 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index fcac477..31ee03f 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Eingabeaufforderung"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 696823b..4ed65aa 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index d1d8174..1a32b48 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index ca10531..60d1bdc 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 7b6f76a..0dde509 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Marquage"
+    IDS_SELECT_TITLE "Sélection"
+END
index 513298c..26e9a42 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 97904b6..6020733 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 5c2e0ce..e5da7b6 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index b94590d..701e292 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 776e909..b73c535 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index b20c766..0402356 100644 (file)
@@ -30,3 +30,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "Konsola ReactOS"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index f4b90ec..c58d175 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 46c2de9..2de1451 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "Consola ReactOS"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index dcdc2b3..826cefb 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index a586c39..2289078 100644 (file)
@@ -27,3 +27,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 35255a8..466ea20 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index aba643b..9632005 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index bafa79d..b0ecb8e 100644 (file)
@@ -24,3 +24,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 57ac95b..c0d14a2 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 2b62adb..5848be0 100644 (file)
@@ -22,3 +22,9 @@ BEGIN
 */
     IDS_TERMINAL_TITLE "ReactOS Console"
 END
+
+STRINGTABLE
+BEGIN
+    IDS_MARK_TITLE "Mark"
+    IDS_SELECT_TITLE "Select"
+END
index 1b79e6e..2762cd9 100644 (file)
 #define ID_SYSTEM_DEFAULTS       0xFFF6
 #define ID_SYSTEM_PROPERTIES     0xFFF7
 
-#define NCPOPUP_MENU 103
+#define IDS_EDIT            204
+#define IDS_MARK            205
+#define IDS_COPY            206
+#define IDS_PASTE           207
+#define IDS_SELECTALL       208
+#define IDS_SCROLL          209
+#define IDS_FIND            210
+#define IDS_DEFAULTS        211
+#define IDS_PROPERTIES      212
 
-#define IDS_EDIT       204
-#define IDS_MARK       205
-#define IDS_COPY       206
-#define IDS_PASTE      207
-#define IDS_SELECTALL  208
-#define IDS_SCROLL     209
-#define IDS_FIND       210
-#define IDS_DEFAULTS   211
-#define IDS_PROPERTIES 212
+#define IDS_MARK_TITLE      220
+#define IDS_SELECT_TITLE    221
 
 // Scrollbar resource ids. Unused.
 /*
index 84d0101..2de3b11 100644 (file)
@@ -59,9 +59,6 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
            GuiData->Selection.srSelection.Right,
            GuiData->Selection.srSelection.Bottom);
 
-#ifdef IS_WHITESPACE
-#undef IS_WHITESPACE
-#endif
 #define IS_WHITESPACE(c)    ((c) == L'\0' || (c) == L' ' || (c) == L'\t')
 
     /* Basic size for one line... */