Thomas Kho : notepad: Change window title to be like Windows' notepad.exe.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 13 10:12:21 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 3ec165fd990d1d62bfa5dacb30d2592285c4917f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=3ec165fd990d1d62bfa5dacb30d2592285c4917f

Author: Thomas Kho <tkho at ucla.edu>
Date:   Wed Jul 12 14:15:31 2006 -0700

notepad: Change window title to be like Windows' notepad.exe.

---

 programs/notepad/En.rc    |    2 +-
 programs/notepad/dialog.c |   29 +++++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/programs/notepad/En.rc b/programs/notepad/En.rc
index 3bf6475..af60994 100644
--- a/programs/notepad/En.rc
+++ b/programs/notepad/En.rc
@@ -108,7 +108,7 @@ STRING_ERROR,                           
 STRING_WARNING,                                 "WARNING"
 STRING_INFO,                                    "Information"
 
-STRING_UNTITLED,                                "(untitled)"
+STRING_UNTITLED,                                "Untitled"
 
 STRING_ALL_FILES,                               "All files (*.*)"
 STRING_TEXT_FILES_TXT,                  "Text files (*.txt)"
diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
index c487164..1488af0 100644
--- a/programs/notepad/dialog.c
+++ b/programs/notepad/dialog.c
@@ -54,30 +54,23 @@ VOID ShowLastError(void)
 
 /**
  * Sets the caption of the main window according to Globals.szFileTitle:
- *    Notepad - (untitled)      if no file is open
- *    Notepad - [filename]      if a file is given
+ *    Untitled - Notepad        if no file is open
+ *    filename - Notepad        if a file is given
  */
 static void UpdateWindowCaption(void)
 {
   WCHAR szCaption[MAX_STRING_LEN];
-  WCHAR szUntitled[MAX_STRING_LEN];
+  WCHAR szNotepad[MAX_STRING_LEN];
+  static const WCHAR hyphenW[] = { ' ','-',' ',0 };
 
-  LoadString(Globals.hInstance, STRING_NOTEPAD, szCaption, SIZEOF(szCaption));
-
-  if (Globals.szFileTitle[0] != '\0') {
-      static const WCHAR bracket_lW[] = { ' ','-',' ','[',0 };
-      static const WCHAR bracket_rW[] = { ']',0 };
-      lstrcat(szCaption, bracket_lW);
-      lstrcat(szCaption, Globals.szFileTitle);
-      lstrcat(szCaption, bracket_rW);
-  }
+  if (Globals.szFileTitle[0] != '\0')
+      lstrcpy(szCaption, Globals.szFileTitle);
   else
-  {
-      static const WCHAR hyphenW[] = { ' ','-',' ',0 };
-      LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
-      lstrcat(szCaption, hyphenW);
-      lstrcat(szCaption, szUntitled);
-  }
+      LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
+
+  LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
+  lstrcat(szCaption, hyphenW);
+  lstrcat(szCaption, szNotepad);
 
   SetWindowText(Globals.hMainWnd, szCaption);
 }




More information about the wine-cvs mailing list