ReactOS  0.4.12-dev-102-g4b7f1e0
notepad.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winnls.h>
#include <wingdi.h>
#include <shellapi.h>
#include <commdlg.h>
#include <tchar.h>
#include <malloc.h>
#include "main.h"
#include "dialog.h"
Include dependency graph for notepad.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STRSAFE_NO_DEPRECATE
 

Functions

void UpdateWindowCaption (BOOL clearModifyAlert)
 

Macro Definition Documentation

◆ STRSAFE_NO_DEPRECATE

#define STRSAFE_NO_DEPRECATE

Definition at line 5 of file notepad.h.

Function Documentation

◆ UpdateWindowCaption()

void UpdateWindowCaption ( BOOL  clearModifyAlert)

Sets the caption of the main window according to Globals.szFileTitle: (untitled) - Notepad if no file is open [filename] - Notepad if a file is given

Definition at line 66 of file dialog.c.

Referenced by DIALOG_FileSave(), DIALOG_FileSaveAs(), DoCloseFile(), and DoOpenFile().

67 {
68  TCHAR szCaption[MAX_STRING_LEN];
69  TCHAR szNotepad[MAX_STRING_LEN];
70  TCHAR szFilename[MAX_STRING_LEN];
71 
72  /* Load the name of the application */
73  LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
74 
75  /* Determine if the file has been saved or if this is a new file */
76  if (Globals.szFileTitle[0] != 0)
77  StringCchCopy(szFilename, ARRAY_SIZE(szFilename), Globals.szFileTitle);
78  else
79  LoadString(Globals.hInstance, STRING_UNTITLED, szFilename, ARRAY_SIZE(szFilename));
80 
81  /* When a file is being opened or created, there is no need to have the edited flag shown
82  when the new or opened file has not been edited yet */
83  if (clearModifyAlert)
84  StringCbPrintf(szCaption, ARRAY_SIZE(szCaption), _T("%s - %s"), szFilename, szNotepad);
85  else
86  {
87  BOOL isModified = (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0) ? TRUE : FALSE);
88 
89  /* Update the caption based upon if the user has modified the contents of the file or not */
90  StringCbPrintf(szCaption, ARRAY_SIZE(szCaption), _T("%s%s - %s"),
91  (isModified ? _T("*") : _T("")), szFilename, szNotepad);
92  }
93 
94  /* Update the window caption */
95  SetWindowText(Globals.hMainWnd, szCaption);
96 }
#define TRUE
Definition: types.h:120
#define MAX_STRING_LEN
Definition: precomp.h:36
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_NOTEPAD
Definition: notepad_res.h:74
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
unsigned int BOOL
Definition: ntddk_ex.h:94
#define STRING_UNTITLED
Definition: notepad_res.h:78
#define StringCbPrintf
Definition: strsafe.h:544
#define EM_GETMODIFY
Definition: winuser.h:1955
#define StringCchCopy
Definition: strsafe.h:139
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SetWindowText
Definition: winuser.h:5723
#define SendMessage
Definition: winuser.h:5709
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5685