ReactOS  0.4.15-dev-4871-g4471ee4
dialog.c File Reference
#include "notepad.h"
#include <assert.h>
#include <commctrl.h>
#include <strsafe.h>
Include dependency graph for dialog.c:

Go to the source code of this file.

Typedefs

typedef HWND(WINAPIFINDPROC) (LPFINDREPLACE lpfr)
 

Functions

LRESULT CALLBACK EDIT_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
VOID ShowLastError (VOID)
 
void UpdateWindowCaption (BOOL clearModifyAlert)
 
int DIALOG_StringMsgBox (HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
 
static void AlertFileNotFound (LPCTSTR szFileName)
 
static int AlertFileNotSaved (LPCTSTR szFileName)
 
static void AlertPrintError (void)
 
BOOL FileExists (LPCTSTR szFilename)
 
BOOL HasFileExtension (LPCTSTR szFilename)
 
int GetSelectionTextLength (HWND hWnd)
 
int GetSelectionText (HWND hWnd, LPTSTR lpString, int nMaxCount)
 
static RECT GetPrintingRect (HDC hdc, RECT margins)
 
static BOOL DoSaveFile (VOID)
 
BOOL DoCloseFile (VOID)
 
VOID DoOpenFile (LPCTSTR szFileName)
 
VOID DIALOG_FileNew (VOID)
 
VOID DIALOG_FileNewWindow (VOID)
 
VOID DIALOG_FileOpen (VOID)
 
BOOL DIALOG_FileSave (VOID)
 
static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL DIALOG_FileSaveAs (VOID)
 
VOID DIALOG_FilePrint (VOID)
 
VOID DIALOG_FileExit (VOID)
 
VOID DIALOG_EditUndo (VOID)
 
VOID DIALOG_EditCut (VOID)
 
VOID DIALOG_EditCopy (VOID)
 
VOID DIALOG_EditPaste (VOID)
 
VOID DIALOG_EditDelete (VOID)
 
VOID DIALOG_EditSelectAll (VOID)
 
VOID DIALOG_EditTimeDate (VOID)
 
VOID DoCreateStatusBar (VOID)
 
VOID DoCreateEditWindow (VOID)
 
VOID DIALOG_EditWrap (VOID)
 
VOID DIALOG_SelectFont (VOID)
 
static VOID DIALOG_SearchDialog (FINDPROC pfnProc)
 
VOID DIALOG_Search (VOID)
 
VOID DIALOG_SearchNext (VOID)
 
VOID DIALOG_Replace (VOID)
 
static INT_PTR CALLBACK DIALOG_GoTo_DialogProc (HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID DIALOG_GoTo (VOID)
 
VOID DIALOG_StatusBarUpdateCaretPos (VOID)
 
VOID DIALOG_ViewStatusBar (VOID)
 
VOID DIALOG_HelpContents (VOID)
 
VOID DIALOG_HelpAboutNotepad (VOID)
 
VOID DIALOG_FilePageSetup (void)
 

Variables

static const TCHAR helpfile [] = _T("notepad.hlp")
 
static const TCHAR empty_str [] = _T("")
 
static const TCHAR szDefaultExt [] = _T("txt")
 
static const TCHAR txt_files [] = _T("*.txt")
 

Typedef Documentation

◆ FINDPROC

typedef HWND(WINAPI * FINDPROC) (LPFINDREPLACE lpfr)

Definition at line 1064 of file dialog.c.

Function Documentation

◆ AlertFileNotFound()

static void AlertFileNotFound ( LPCTSTR  szFileName)
static

Definition at line 128 of file dialog.c.

129 {
131 }
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
Definition: dialog.c:107
#define MB_OK
Definition: winuser.h:784
#define STRING_NOTFOUND
Definition: notepad_res.h:87

Referenced by DIALOG_FileOpen().

◆ AlertFileNotSaved()

static int AlertFileNotSaved ( LPCTSTR  szFileName)
static

Definition at line 133 of file dialog.c.

134 {
135  TCHAR szUntitled[MAX_STRING_LEN];
136 
137  LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, ARRAY_SIZE(szUntitled));
138 
140  szFileName[0] ? szFileName : szUntitled,
142 }
#define MAX_STRING_LEN
Definition: precomp.h:36
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_NOTSAVED
Definition: notepad_res.h:85
#define MB_ICONQUESTION
Definition: winuser.h:783
#define MB_YESNOCANCEL
Definition: winuser.h:812
char TCHAR
Definition: xmlstorage.h:189
#define STRING_UNTITLED
Definition: notepad_res.h:79
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
Definition: dialog.c:107
#define ARRAY_SIZE(a)
Definition: main.h:24
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

Referenced by DoCloseFile().

◆ AlertPrintError()

static void AlertPrintError ( void  )
static

Definition at line 144 of file dialog.c.

145 {
146  TCHAR szUntitled[MAX_STRING_LEN];
147 
148  LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, ARRAY_SIZE(szUntitled));
149 
151  Globals.szFileName[0] ? Globals.szFileName : szUntitled,
153 }
#define MAX_STRING_LEN
Definition: precomp.h:36
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_PRINTERROR
Definition: notepad_res.h:101
char TCHAR
Definition: xmlstorage.h:189
#define STRING_UNTITLED
Definition: notepad_res.h:79
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
Definition: dialog.c:107
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

Referenced by DIALOG_FilePrint().

◆ DIALOG_EditCopy()

VOID DIALOG_EditCopy ( VOID  )

Definition at line 809 of file dialog.c.

810 {
811  SendMessage(Globals.hEdit, WM_COPY, 0, 0);
812 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define WM_COPY
Definition: winuser.h:1849
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditCut()

VOID DIALOG_EditCut ( VOID  )

Definition at line 804 of file dialog.c.

805 {
806  SendMessage(Globals.hEdit, WM_CUT, 0, 0);
807 }
#define WM_CUT
Definition: winuser.h:1848
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditDelete()

VOID DIALOG_EditDelete ( VOID  )

Definition at line 819 of file dialog.c.

820 {
821  SendMessage(Globals.hEdit, WM_CLEAR, 0, 0);
822 }
#define WM_CLEAR
Definition: winuser.h:1851
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditPaste()

VOID DIALOG_EditPaste ( VOID  )

Definition at line 814 of file dialog.c.

815 {
816  SendMessage(Globals.hEdit, WM_PASTE, 0, 0);
817 }
#define WM_PASTE
Definition: winuser.h:1850
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditSelectAll()

VOID DIALOG_EditSelectAll ( VOID  )

Definition at line 824 of file dialog.c.

825 {
826  SendMessage(Globals.hEdit, EM_SETSEL, 0, (LPARAM)-1);
827 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_SETSEL
Definition: winuser.h:2005
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditTimeDate()

VOID DIALOG_EditTimeDate ( VOID  )

Definition at line 829 of file dialog.c.

830 {
831  SYSTEMTIME st;
832  TCHAR szDate[MAX_STRING_LEN];
833  TCHAR szText[MAX_STRING_LEN * 2 + 2];
834 
835  GetLocalTime(&st);
836 
838  _tcscpy(szText, szDate);
839  _tcscat(szText, _T(" "));
841  _tcscat(szText, szDate);
842  SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szText);
843 }
#define TRUE
Definition: types.h:120
#define LOCALE_USER_DEFAULT
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define MAX_STRING_LEN
Definition: precomp.h:36
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
LONG_PTR LPARAM
Definition: windef.h:208
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define GetTimeFormat
Definition: winnls.h:1189
#define GetDateFormat
Definition: winnls.h:1184
#define DATE_LONGDATE
Definition: winnls.h:197
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5823
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
#define EM_REPLACESEL
Definition: winuser.h:1993

Referenced by DoOpenFile(), and NOTEPAD_MenuCommand().

◆ DIALOG_EditUndo()

VOID DIALOG_EditUndo ( VOID  )

Definition at line 799 of file dialog.c.

800 {
801  SendMessage(Globals.hEdit, EM_UNDO, 0, 0);
802 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define EM_UNDO
Definition: winuser.h:2008
#define SendMessage
Definition: winuser.h:5823

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditWrap()

VOID DIALOG_EditWrap ( VOID  )

Definition at line 1025 of file dialog.c.

1026 {
1027  Globals.bWrapLongLines = !Globals.bWrapLongLines;
1028 
1029  if (Globals.bWrapLongLines)
1030  {
1032  }
1033  else
1034  {
1036  }
1037 
1039 }
#define MF_DISABLED
Definition: winuser.h:130
#define MF_BYCOMMAND
Definition: winuser.h:202
#define CMD_GOTO
Definition: notepad_res.h:56
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
VOID DoCreateEditWindow(VOID)
Definition: dialog.c:923
#define MF_ENABLED
Definition: winuser.h:128
#define MF_GRAYED
Definition: winuser.h:129

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileExit()

VOID DIALOG_FileExit ( VOID  )

Definition at line 794 of file dialog.c.

795 {
797 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define PostMessage
Definition: winuser.h:5812
r l[0]
Definition: byte_order.h:167
#define WM_CLOSE
Definition: winuser.h:1608

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileNew()

VOID DIALOG_FileNew ( VOID  )

Definition at line 413 of file dialog.c.

414 {
415  /* Close any files and prompt to save changes */
416  if (DoCloseFile()) {
418  SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
419  SetFocus(Globals.hEdit);
421  }
422 }
static const TCHAR empty_str[]
Definition: dialog.c:32
HWND WINAPI SetFocus(_In_opt_ HWND)
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
BOOL DoCloseFile(VOID)
Definition: dialog.c:328
#define EM_EMPTYUNDOBUFFER
Definition: winuser.h:1972
#define SetWindowText
Definition: winuser.h:5837
VOID NOTEPAD_EnableSearchMenu()
Definition: main.c:34
#define SendMessage
Definition: winuser.h:5823

Referenced by _tWinMain(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileNewWindow()

VOID DIALOG_FileNewWindow ( VOID  )

Definition at line 424 of file dialog.c.

425 {
426  TCHAR pszNotepadExe[MAX_PATH];
427  GetModuleFileName(NULL, pszNotepadExe, ARRAYSIZE(pszNotepadExe));
428  ShellExecute(NULL, NULL, pszNotepadExe, NULL, NULL, SW_SHOWNORMAL);
429 }
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ShellExecute
Definition: shellapi.h:691
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:34
#define GetModuleFileName
Definition: winbase.h:3692
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define NULL
Definition: types.h:112

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileOpen()

VOID DIALOG_FileOpen ( VOID  )

Definition at line 431 of file dialog.c.

432 {
433  OPENFILENAME openfilename;
435 
436  ZeroMemory(&openfilename, sizeof(openfilename));
437 
438  if (Globals.szFileName[0] == 0)
440  else
441  _tcscpy(szPath, Globals.szFileName);
442 
443  openfilename.lStructSize = sizeof(openfilename);
444  openfilename.hwndOwner = Globals.hMainWnd;
445  openfilename.hInstance = Globals.hInstance;
446  openfilename.lpstrFilter = Globals.szFilter;
447  openfilename.lpstrFile = szPath;
448  openfilename.nMaxFile = ARRAY_SIZE(szPath);
450  openfilename.lpstrDefExt = szDefaultExt;
451 
452  if (GetOpenFileName(&openfilename)) {
453  if (FileExists(openfilename.lpstrFile))
454  DoOpenFile(openfilename.lpstrFile);
455  else
456  AlertFileNotFound(openfilename.lpstrFile);
457  }
458 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
VOID DoOpenFile(LPCTSTR szFileName)
Definition: dialog.c:360
HWND hwndOwner
Definition: commdlg.h:330
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define ZeroMemory
Definition: winbase.h:1667
LPCSTR lpstrDefExt
Definition: commdlg.h:345
static void AlertFileNotFound(LPCTSTR szFileName)
Definition: dialog.c:128
#define GetOpenFileName
Definition: commdlg.h:665
DWORD nMaxFile
Definition: commdlg.h:337
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
BOOL FileExists(LPCTSTR szFilename)
Definition: dialog.c:160
HINSTANCE hInstance
Definition: commdlg.h:331
static const TCHAR szDefaultExt[]
Definition: dialog.c:33
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
static const TCHAR txt_files[]
Definition: dialog.c:34
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
LPSTR lpstrFile
Definition: commdlg.h:336
LPCWSTR szPath
Definition: env.c:37
#define ARRAY_SIZE(a)
Definition: main.h:24
LPCSTR lpstrFilter
Definition: commdlg.h:332
HINSTANCE hInstance
Definition: precomp.h:43
DWORD Flags
Definition: commdlg.h:342

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FilePageSetup()

VOID DIALOG_FilePageSetup ( void  )

Definition at line 1231 of file dialog.c.

1232 {
1234 
1235  ZeroMemory(&page, sizeof(page));
1236  page.lStructSize = sizeof(page);
1237  page.hwndOwner = Globals.hMainWnd;
1239  page.hInstance = Globals.hInstance;
1240  page.rtMargin = Globals.lMargins;
1241  page.hDevMode = Globals.hDevMode;
1242  page.hDevNames = Globals.hDevNames;
1243  page.lpPageSetupTemplateName = MAKEINTRESOURCE(DIALOG_PAGESETUP);
1244  page.lpfnPageSetupHook = DIALOG_PAGESETUP_Hook;
1245 
1246  PageSetupDlg(&page);
1247 
1248  Globals.hDevMode = page.hDevMode;
1249  Globals.hDevNames = page.hDevNames;
1250  Globals.lMargins = page.rtMargin;
1251 }
static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1258
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define PSD_ENABLEPAGESETUPTEMPLATE
Definition: commdlg.h:184
#define PageSetupDlg
Definition: commdlg.h:667
#define PSD_MARGINS
Definition: commdlg.h:173
#define ZeroMemory
Definition: winbase.h:1667
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define DIALOG_PAGESETUP
Definition: notepad_res.h:25
Definition: module.h:566
#define PSD_ENABLEPAGESETUPHOOK
Definition: commdlg.h:183
HINSTANCE hInstance
Definition: precomp.h:43

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FilePrint()

VOID DIALOG_FilePrint ( VOID  )

Definition at line 579 of file dialog.c.

580 {
581  DOCINFO di;
582  TEXTMETRIC tm;
583  PRINTDLG printer;
584  SIZE szMetric;
585  int border;
586  int xLeft, yTop, pagecount, dopage, copycount;
587  unsigned int i;
588  LOGFONT hdrFont;
589  HFONT font, old_font=0;
590  DWORD size;
591  LPTSTR pTemp;
592  static const TCHAR times_new_roman[] = _T("Times New Roman");
593  RECT rcPrintRect;
594 
595  /* Get a small font and print some header info on each page */
596  ZeroMemory(&hdrFont, sizeof(hdrFont));
597  hdrFont.lfHeight = 100;
598  hdrFont.lfWeight = FW_BOLD;
599  hdrFont.lfCharSet = ANSI_CHARSET;
602  hdrFont.lfQuality = PROOF_QUALITY;
604  _tcscpy(hdrFont.lfFaceName, times_new_roman);
605 
606  font = CreateFontIndirect(&hdrFont);
607 
608  /* Get Current Settings */
609  ZeroMemory(&printer, sizeof(printer));
610  printer.lStructSize = sizeof(printer);
611  printer.hwndOwner = Globals.hMainWnd;
612  printer.hInstance = Globals.hInstance;
613 
614  /* Set some default flags */
615  printer.Flags = PD_RETURNDC | PD_SELECTION;
616 
617  /* Disable the selection radio button if there is no text selected */
618  if (!GetSelectionTextLength(Globals.hEdit))
619  {
620  printer.Flags = printer.Flags | PD_NOSELECTION;
621  }
622 
623  printer.nFromPage = 0;
624  printer.nMinPage = 1;
625  /* we really need to calculate number of pages to set nMaxPage and nToPage */
626  printer.nToPage = (WORD)-1;
627  printer.nMaxPage = (WORD)-1;
628 
629  /* Let commdlg manage copy settings */
630  printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
631 
632  printer.hDevMode = Globals.hDevMode;
633  printer.hDevNames = Globals.hDevNames;
634 
635  if (!PrintDlg(&printer))
636  {
638  return;
639  }
640 
641  Globals.hDevMode = printer.hDevMode;
642  Globals.hDevNames = printer.hDevNames;
643 
644  assert(printer.hDC != 0);
645 
646  /* initialize DOCINFO */
647  di.cbSize = sizeof(DOCINFO);
648  di.lpszDocName = Globals.szFileTitle;
649  di.lpszOutput = NULL;
650  di.lpszDatatype = NULL;
651  di.fwType = 0;
652 
653  if (StartDoc(printer.hDC, &di) <= 0)
654  {
656  return;
657  }
658 
659 
660  /* Get the file text */
661  if (printer.Flags & PD_SELECTION)
662  {
663  size = GetSelectionTextLength(Globals.hEdit) + 1;
664  }
665  else
666  {
667  size = GetWindowTextLength(Globals.hEdit) + 1;
668  }
669 
670  pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(TCHAR));
671  if (!pTemp)
672  {
673  EndDoc(printer.hDC);
675  ShowLastError();
676  return;
677  }
678 
679  if (printer.Flags & PD_SELECTION)
680  {
681  size = GetSelectionText(Globals.hEdit, pTemp, size);
682  }
683  else
684  {
685  size = GetWindowText(Globals.hEdit, pTemp, size);
686  }
687 
688  /* Get the current printing area */
689  rcPrintRect = GetPrintingRect(printer.hDC, Globals.lMargins);
690 
691  /* Ensure that each logical unit maps to one pixel */
692  SetMapMode(printer.hDC, MM_TEXT);
693 
694  /* Needed to get the correct height of a text line */
695  GetTextMetrics(printer.hDC, &tm);
696 
697  border = 15;
698  for (copycount=1; copycount <= printer.nCopies; copycount++) {
699  i = 0;
700  pagecount = 1;
701  do {
702  /* Don't start a page if none of the conditions below are true */
703  dopage = 0;
704 
705  /* The user wants to print the current selection */
706  if (printer.Flags & PD_SELECTION)
707  {
708  dopage = 1;
709  }
710 
711  /* The user wants to print the entire document */
712  if (!(printer.Flags & PD_PAGENUMS) && !(printer.Flags & PD_SELECTION))
713  {
714  dopage = 1;
715  }
716 
717  /* The user wants to print a specified range of pages */
718  if ((pagecount >= printer.nFromPage && pagecount <= printer.nToPage))
719  {
720  dopage = 1;
721  }
722 
723  old_font = SelectObject(printer.hDC, font);
724 
725  if (dopage) {
726  if (StartPage(printer.hDC) <= 0) {
727  SelectObject(printer.hDC, old_font);
728  EndDoc(printer.hDC);
729  DeleteDC(printer.hDC);
730  HeapFree(GetProcessHeap(), 0, pTemp);
732  AlertPrintError();
733  return;
734  }
735 
736  SetViewportOrgEx(printer.hDC, rcPrintRect.left, rcPrintRect.top, NULL);
737 
738  /* Write a rectangle and header at the top of each page */
739  Rectangle(printer.hDC, border, border, rcPrintRect.right - border, border + tm.tmHeight * 2);
740  /* I don't know what's up with this TextOut command. This comes out
741  kind of mangled.
742  */
743  TextOut(printer.hDC,
744  border * 2,
745  border + tm.tmHeight / 2,
746  Globals.szFileTitle,
747  lstrlen(Globals.szFileTitle));
748  }
749 
750  /* The starting point for the main text */
751  xLeft = 0;
752  yTop = border + tm.tmHeight * 4;
753 
754  SelectObject(printer.hDC, old_font);
755 
756  /* Since outputting strings is giving me problems, output the main
757  * text one character at a time. */
758  do {
759  if (pTemp[i] == '\n') {
760  xLeft = 0;
761  yTop += tm.tmHeight;
762  }
763  else if (pTemp[i] != '\r') {
764  if (dopage)
765  TextOut(printer.hDC, xLeft, yTop, &pTemp[i], 1);
766 
767  /* We need to get the width for each individual char, since a proportional font may be used */
768  GetTextExtentPoint32(printer.hDC, &pTemp[i], 1, &szMetric);
769  xLeft += szMetric.cx;
770 
771  /* Insert a line break if the current line does not fit into the printing area */
772  if (xLeft > rcPrintRect.right)
773  {
774  xLeft = 0;
775  yTop = yTop + tm.tmHeight;
776  }
777  }
778  } while (i++ < size && yTop < rcPrintRect.bottom);
779 
780  if (dopage)
781  EndPage(printer.hDC);
782  pagecount++;
783  } while (i < size);
784  }
785 
786  if (old_font != 0)
787  SelectObject(printer.hDC, old_font);
788  EndDoc(printer.hDC);
789  DeleteDC(printer.hDC);
790  HeapFree(GetProcessHeap(), 0, pTemp);
792 }
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define PD_NOSELECTION
Definition: commdlg.h:149
WORD nMaxPage
Definition: commdlg.h:474
#define VARIABLE_PITCH
Definition: wingdi.h:445
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
Definition: mk_font.cpp:20
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define assert(x)
Definition: debug.h:53
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BYTE lfCharSet
Definition: dimm.idl:50
WORD nCopies
Definition: commdlg.h:475
LONG left
Definition: windef.h:306
#define GetTextMetrics
Definition: wingdi.h:4474
LONG right
Definition: windef.h:308
#define PROOF_QUALITY
Definition: wingdi.h:438
CHAR * LPTSTR
Definition: xmlstorage.h:192
int WINAPI EndPage(_In_ HDC)
static RECT GetPrintingRect(HDC hdc, RECT margins)
Definition: dialog.c:249
BYTE lfOutPrecision
Definition: dimm.idl:51
WORD nMinPage
Definition: commdlg.h:473
#define GetWindowText
Definition: winuser.h:5778
int WINAPI StartPage(_In_ HDC)
#define PrintDlg
Definition: commdlg.h:668
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
int WINAPI SetMapMode(_In_ HDC, _In_ int)
LONG lfHeight
Definition: dimm.idl:42
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
LONG lfWeight
Definition: dimm.idl:46
WORD nFromPage
Definition: commdlg.h:471
int GetSelectionText(HWND hWnd, LPTSTR lpString, int nMaxCount)
Definition: dialog.c:191
LONG cx
Definition: windef.h:334
#define PD_SELECTION
Definition: commdlg.h:147
#define PD_RETURNDC
Definition: commdlg.h:155
BYTE lfPitchAndFamily
Definition: dimm.idl:54
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
DWORD fwType
Definition: wingdi.h:1680
VOID ShowLastError(VOID)
Definition: dialog.c:38
GLsizeiptr size
Definition: glext.h:5919
LPCSTR lpszOutput
Definition: wingdi.h:1678
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: gl.h:1546
unsigned short WORD
Definition: ntddk_ex.h:93
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL hDevMode
Definition: commdlg.h:467
#define PD_PAGENUMS
Definition: commdlg.h:148
LPCSTR lpszDatatype
Definition: wingdi.h:1679
#define PD_USEDEVMODECOPIES
Definition: commdlg.h:165
Definition: time.h:68
#define FF_ROMAN
Definition: wingdi.h:450
int cbSize
Definition: wingdi.h:1676
BYTE lfQuality
Definition: dimm.idl:53
HWND hwndOwner
Definition: commdlg.h:466
#define lstrlen
Definition: winbase.h:3737
#define FW_BOLD
Definition: wingdi.h:378
HINSTANCE hInstance
Definition: commdlg.h:476
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI DeleteDC(_In_ HDC)
LPCSTR lpszDocName
Definition: wingdi.h:1677
BYTE lfClipPrecision
Definition: dimm.idl:52
HGLOBAL hDevNames
Definition: commdlg.h:468
#define CreateFontIndirect
Definition: wingdi.h:4444
#define NULL
Definition: types.h:112
DWORD lStructSize
Definition: commdlg.h:465
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WORD nToPage
Definition: commdlg.h:472
#define MM_TEXT
Definition: wingdi.h:873
#define GetTextExtentPoint32
Definition: wingdi.h:4472
#define TextOut
Definition: wingdi.h:4483
#define GetWindowTextLength
Definition: winuser.h:5779
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG bottom
Definition: windef.h:309
DWORD Flags
Definition: commdlg.h:470
#define StartDoc
Definition: wingdi.h:4482
static void AlertPrintError(void)
Definition: dialog.c:144
int GetSelectionTextLength(HWND hWnd)
Definition: dialog.c:181
#define ANSI_CHARSET
Definition: wingdi.h:383
HINSTANCE hInstance
Definition: precomp.h:43
HDC hDC
Definition: commdlg.h:469
#define HeapFree(x, y, z)
Definition: compat.h:594
DOCINFOA DOCINFO
Definition: wingdi.h:4414
int WINAPI EndDoc(_In_ HDC)

Referenced by HandleCommandLine(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileSave()

BOOL DIALOG_FileSave ( VOID  )

Definition at line 460 of file dialog.c.

461 {
462  if (Globals.szFileName[0] == 0)
463  {
464  return DIALOG_FileSaveAs();
465  }
466  else if (DoSaveFile())
467  {
469  return TRUE;
470  }
471  return FALSE;
472 }
void UpdateWindowCaption(BOOL clearModifyAlert)
Definition: dialog.c:66
static BOOL DoSaveFile(VOID)
Definition: dialog.c:273
#define TRUE
Definition: types.h:120
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
BOOL DIALOG_FileSaveAs(VOID)
Definition: dialog.c:532

Referenced by DoCloseFile(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileSaveAs()

BOOL DIALOG_FileSaveAs ( VOID  )

Definition at line 532 of file dialog.c.

533 {
534  OPENFILENAME saveas;
536 
537  ZeroMemory(&saveas, sizeof(saveas));
538 
539  if (Globals.szFileName[0] == 0)
541  else
542  _tcscpy(szPath, Globals.szFileName);
543 
544  saveas.lStructSize = sizeof(OPENFILENAME);
545  saveas.hwndOwner = Globals.hMainWnd;
546  saveas.hInstance = Globals.hInstance;
547  saveas.lpstrFilter = Globals.szFilter;
548  saveas.lpstrFile = szPath;
549  saveas.nMaxFile = ARRAY_SIZE(szPath);
552  saveas.lpstrDefExt = szDefaultExt;
555 
556  if (GetSaveFileName(&saveas))
557  {
558  /* HACK: Because in ROS, Save-As boxes don't check the validity
559  * of file names and thus, here, szPath can be invalid !! We only
560  * see its validity when we call DoSaveFile()... */
562  if (DoSaveFile())
563  {
565  return TRUE;
566  }
567  else
568  {
569  SetFileName(_T(""));
570  return FALSE;
571  }
572  }
573  else
574  {
575  return FALSE;
576  }
577 }
void UpdateWindowCaption(BOOL clearModifyAlert)
Definition: dialog.c:66
#define OFN_EXPLORER
Definition: commdlg.h:104
#define MAKEINTRESOURCE
Definition: winuser.h:591
static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:476
HWND hwndOwner
Definition: commdlg.h:330
static BOOL DoSaveFile(VOID)
Definition: dialog.c:273
#define TRUE
Definition: types.h:120
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define ZeroMemory
Definition: winbase.h:1667
LPCSTR lpstrDefExt
Definition: commdlg.h:345
LPCSTR lpTemplateName
Definition: commdlg.h:348
DWORD nMaxFile
Definition: commdlg.h:337
#define GetSaveFileName
Definition: commdlg.h:666
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define FALSE
Definition: types.h:117
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HINSTANCE hInstance
Definition: commdlg.h:331
static const TCHAR szDefaultExt[]
Definition: dialog.c:33
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:179
#define DIALOG_ENCODING
Definition: notepad_res.h:27
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
static const TCHAR txt_files[]
Definition: dialog.c:34
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
LPSTR lpstrFile
Definition: commdlg.h:336
LPCWSTR szPath
Definition: env.c:37
#define ARRAY_SIZE(a)
Definition: main.h:24
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
HINSTANCE hInstance
Definition: precomp.h:43
DWORD Flags
Definition: commdlg.h:342

Referenced by DIALOG_FileSave(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileSaveAs_Hook()

static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook ( HWND  hDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 476 of file dialog.c.

477 {
478  TCHAR szText[128];
479  HWND hCombo;
480 
482 
483  switch(msg)
484  {
485  case WM_INITDIALOG:
486  hCombo = GetDlgItem(hDlg, ID_ENCODING);
487 
489  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
490 
492  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
493 
495  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
496 
498  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
499 
500  SendMessage(hCombo, CB_SETCURSEL, Globals.encFile, 0);
501 
502  hCombo = GetDlgItem(hDlg, ID_EOLN);
503 
505  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
506 
507  LoadString(Globals.hInstance, STRING_LF, szText, ARRAY_SIZE(szText));
508  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
509 
510  LoadString(Globals.hInstance, STRING_CR, szText, ARRAY_SIZE(szText));
511  SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
512 
513  SendMessage(hCombo, CB_SETCURSEL, Globals.iEoln, 0);
514  break;
515 
516  case WM_NOTIFY:
517  if (((NMHDR *) lParam)->code == CDN_FILEOK)
518  {
519  hCombo = GetDlgItem(hDlg, ID_ENCODING);
520  if (hCombo)
521  Globals.encFile = (ENCODING) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
522 
523  hCombo = GetDlgItem(hDlg, ID_EOLN);
524  if (hCombo)
525  Globals.iEoln = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
526  }
527  break;
528  }
529  return 0;
530 }
#define STRING_LF
Definition: notepad_res.h:97
#define STRING_ANSI
Definition: notepad_res.h:91
#define STRING_UTF8
Definition: notepad_res.h:94
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define CB_GETCURSEL
Definition: winuser.h:1930
WPARAM wParam
Definition: combotst.c:138
#define ID_ENCODING
Definition: notepad_res.h:28
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define CB_ADDSTRING
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
#define STRING_UNICODE_BE
Definition: notepad_res.h:93
#define STRING_CRLF
Definition: notepad_res.h:96
char TCHAR
Definition: xmlstorage.h:189
#define CDN_FILEOK
Definition: commdlg.h:38
#define ID_EOLN
Definition: notepad_res.h:29
#define CB_SETCURSEL
Definition: winuser.h:1948
Definition: inflate.c:139
ENCODING
Definition: more.c:491
#define ARRAY_SIZE(a)
Definition: main.h:24
#define msg(x)
Definition: auth_time.c:54
#define STRING_UNICODE
Definition: notepad_res.h:92
#define SendMessage
Definition: winuser.h:5823
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2181
HINSTANCE hInstance
Definition: precomp.h:43
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define STRING_CR
Definition: notepad_res.h:98
#define LoadString
Definition: winuser.h:5799
#define WM_NOTIFY
Definition: richedit.h:61
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by DIALOG_FileSaveAs().

◆ DIALOG_GoTo()

VOID DIALOG_GoTo ( VOID  )

Definition at line 1145 of file dialog.c.

1146 {
1147  INT_PTR nLine;
1148  LPTSTR pszText;
1149  int nLength, i;
1150  DWORD dwStart, dwEnd;
1151 
1153  pszText = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(*pszText));
1154  if (!pszText)
1155  return;
1156 
1157  /* Retrieve current text */
1158  GetWindowText(Globals.hEdit, pszText, nLength + 1);
1159  SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd);
1160 
1161  nLine = 1;
1162  for (i = 0; (i < (int) dwStart) && pszText[i]; i++)
1163  {
1164  if (pszText[i] == '\n')
1165  nLine++;
1166  }
1167 
1170  Globals.hMainWnd,
1172  nLine);
1173 
1174  if (nLine >= 1)
1175  {
1176  for (i = 0; pszText[i] && (nLine > 1) && (i < nLength - 1); i++)
1177  {
1178  if (pszText[i] == '\n')
1179  nLine--;
1180  }
1181  SendMessage(Globals.hEdit, EM_SETSEL, i, i);
1182  SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0);
1183  }
1184  HeapFree(GetProcessHeap(), 0, pszText);
1185 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
_In_ DWORD nLength
Definition: wincon.h:473
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT_PTR
Definition: typedefs.h:64
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define GetWindowText
Definition: winuser.h:5778
#define EM_GETSEL
Definition: winuser.h:1984
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
LONG_PTR LPARAM
Definition: windef.h:208
#define DIALOG_GOTO
Definition: notepad_res.h:30
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define EM_SETSEL
Definition: winuser.h:2005
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DialogBoxParam
Definition: winuser.h:5744
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SendMessage
Definition: winuser.h:5823
#define GetWindowTextLength
Definition: winuser.h:5779
HINSTANCE hInstance
Definition: precomp.h:43
#define HeapFree(x, y, z)
Definition: compat.h:594
#define EM_SCROLLCARET
Definition: richedit.h:81
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static INT_PTR CALLBACK DIALOG_GoTo_DialogProc(HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1111

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_GoTo_DialogProc()

static INT_PTR CALLBACK DIALOG_GoTo_DialogProc ( HWND  hwndDialog,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1111 of file dialog.c.

1112 {
1113  BOOL bResult = FALSE;
1114  HWND hTextBox;
1115  TCHAR szText[32];
1116 
1117  switch(uMsg) {
1118  case WM_INITDIALOG:
1119  hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER);
1120  _sntprintf(szText, ARRAY_SIZE(szText), _T("%Id"), lParam);
1121  SetWindowText(hTextBox, szText);
1122  break;
1123  case WM_COMMAND:
1124  if (HIWORD(wParam) == BN_CLICKED)
1125  {
1126  if (LOWORD(wParam) == IDOK)
1127  {
1128  hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER);
1129  GetWindowText(hTextBox, szText, ARRAY_SIZE(szText));
1130  EndDialog(hwndDialog, _ttoi(szText));
1131  bResult = TRUE;
1132  }
1133  else if (LOWORD(wParam) == IDCANCEL)
1134  {
1135  EndDialog(hwndDialog, 0);
1136  bResult = TRUE;
1137  }
1138  }
1139  break;
1140  }
1141 
1142  return bResult;
1143 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
#define GetWindowText
Definition: winuser.h:5778
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define BN_CLICKED
Definition: winuser.h:1912
#define _sntprintf
Definition: xmlstorage.h:201
#define WM_COMMAND
Definition: winuser.h:1727
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2083
#define ARRAY_SIZE(a)
Definition: main.h:24
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
#define SetWindowText
Definition: winuser.h:5837
#define ID_LINENUMBER
Definition: notepad_res.h:31
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2181
#define HIWORD(l)
Definition: typedefs.h:247
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DIALOG_GoTo().

◆ DIALOG_HelpAboutNotepad()

VOID DIALOG_HelpAboutNotepad ( VOID  )

Definition at line 1213 of file dialog.c.

1214 {
1215  TCHAR szNotepad[MAX_STRING_LEN];
1216  TCHAR szNotepadAuthors[MAX_STRING_LEN];
1217 
1219 
1220  LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
1221  LoadString(Globals.hInstance, STRING_NOTEPAD_AUTHORS, szNotepadAuthors, ARRAY_SIZE(szNotepadAuthors));
1222 
1223  ShellAbout(Globals.hMainWnd, szNotepad, szNotepadAuthors, notepadIcon);
1224  DeleteObject(notepadIcon);
1225 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define MAX_STRING_LEN
Definition: precomp.h:36
#define STRING_NOTEPAD_AUTHORS
Definition: notepad_res.h:105
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_NOTEPAD
Definition: notepad_res.h:75
char TCHAR
Definition: xmlstorage.h:189
#define ShellAbout
Definition: shellapi.h:690
#define ARRAY_SIZE(a)
Definition: main.h:24
#define IDI_NPICON
Definition: notepad_res.h:32
#define LoadIcon
Definition: winuser.h:5793
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_HelpContents()

VOID DIALOG_HelpContents ( VOID  )

Definition at line 1208 of file dialog.c.

1209 {
1211 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define HELP_INDEX
Definition: winuser.h:2390
static const TCHAR helpfile[]
Definition: dialog.c:31
#define WinHelp
Definition: winuser.h:5844

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_PAGESETUP_Hook()

static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook ( HWND  hDlg,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1258 of file dialog.c.

1259 {
1260  switch (msg)
1261  {
1262  case WM_COMMAND:
1263  if (HIWORD(wParam) == BN_CLICKED)
1264  {
1265  switch (LOWORD(wParam))
1266  {
1267  case IDOK:
1268  /* save user input and close dialog */
1269  GetDlgItemText(hDlg, 0x141, Globals.szHeader, ARRAY_SIZE(Globals.szHeader));
1270  GetDlgItemText(hDlg, 0x143, Globals.szFooter, ARRAY_SIZE(Globals.szFooter));
1271  return FALSE;
1272 
1273  case IDCANCEL:
1274  /* discard user input and close dialog */
1275  return FALSE;
1276 
1277  case IDHELP:
1278  {
1279  /* FIXME: Bring this to work */
1280  static const TCHAR sorry[] = _T("Sorry, no help available");
1281  static const TCHAR help[] = _T("Help");
1283  return TRUE;
1284  }
1285 
1286  default:
1287  break;
1288  }
1289  }
1290  break;
1291 
1292  case WM_INITDIALOG:
1293  /* fetch last user input prior to display dialog */
1294  SetDlgItemText(hDlg, 0x141, Globals.szHeader);
1295  SetDlgItemText(hDlg, 0x143, Globals.szFooter);
1296  break;
1297  }
1298 
1299  return FALSE;
1300 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
#define IDHELP
Definition: resource_2.h:8
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define GetDlgItemText
Definition: winuser.h:5765
#define BN_CLICKED
Definition: winuser.h:1912
#define SetDlgItemText
Definition: winuser.h:5829
#define MessageBox
Definition: winuser.h:5802
#define WM_COMMAND
Definition: winuser.h:1727
#define ARRAY_SIZE(a)
Definition: main.h:24
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:247
#define IDCANCEL
Definition: winuser.h:825
int help
Definition: sort.c:20
#define WM_INITDIALOG
Definition: winuser.h:1726
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DIALOG_FilePageSetup().

◆ DIALOG_Replace()

VOID DIALOG_Replace ( VOID  )

Definition at line 1104 of file dialog.c.

1105 {
1107 }
#define ReplaceText
Definition: commdlg.h:669
static VOID DIALOG_SearchDialog(FINDPROC pfnProc)
Definition: dialog.c:1066

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_Search()

VOID DIALOG_Search ( VOID  )

Definition at line 1091 of file dialog.c.

1092 {
1094 }
static VOID DIALOG_SearchDialog(FINDPROC pfnProc)
Definition: dialog.c:1066
#define FindText
Definition: commdlg.h:663

Referenced by DIALOG_SearchNext(), and NOTEPAD_MenuCommand().

◆ DIALOG_SearchDialog()

static VOID DIALOG_SearchDialog ( FINDPROC  pfnProc)
static

Definition at line 1066 of file dialog.c.

1067 {
1068  if (Globals.hFindReplaceDlg != NULL)
1069  {
1070  SetFocus(Globals.hFindReplaceDlg);
1071  return;
1072  }
1073 
1074  ZeroMemory(&Globals.find, sizeof(Globals.find));
1075  Globals.find.lStructSize = sizeof(Globals.find);
1076  Globals.find.hwndOwner = Globals.hMainWnd;
1078  Globals.find.lpstrFindWhat = Globals.szFindText;
1079  Globals.find.wFindWhatLen = ARRAY_SIZE(Globals.szFindText);
1080  Globals.find.lpstrReplaceWith = Globals.szReplaceText;
1081  Globals.find.wReplaceWithLen = ARRAY_SIZE(Globals.szReplaceText);
1082  Globals.find.Flags = FR_DOWN;
1083 
1084  /* We only need to create the modal FindReplace dialog which will */
1085  /* notify us of incoming events using hMainWnd Window Messages */
1086 
1087  Globals.hFindReplaceDlg = pfnProc(&Globals.find);
1088  assert(Globals.hFindReplaceDlg != NULL);
1089 }
#define assert(x)
Definition: debug.h:53
#define ZeroMemory
Definition: winbase.h:1667
HWND WINAPI SetFocus(_In_opt_ HWND)
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define FR_DOWN
Definition: commdlg.h:127
HINSTANCE hInstance
Definition: precomp.h:43

Referenced by DIALOG_Replace(), and DIALOG_Search().

◆ DIALOG_SearchNext()

VOID DIALOG_SearchNext ( VOID  )

Definition at line 1096 of file dialog.c.

1097 {
1098  if (Globals.find.lpstrFindWhat != NULL)
1100  else
1101  DIALOG_Search();
1102 }
VOID DIALOG_Search(VOID)
Definition: dialog.c:1091
#define TRUE
Definition: types.h:120
BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
Definition: main.c:144
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_SelectFont()

VOID DIALOG_SelectFont ( VOID  )

Definition at line 1041 of file dialog.c.

1042 {
1043  CHOOSEFONT cf;
1044  LOGFONT lf = Globals.lfFont;
1045 
1046  ZeroMemory( &cf, sizeof(cf) );
1047  cf.lStructSize = sizeof(cf);
1048  cf.hwndOwner = Globals.hMainWnd;
1049  cf.lpLogFont = &lf;
1051 
1052  if (ChooseFont(&cf))
1053  {
1054  HFONT currfont = Globals.hFont;
1055 
1056  Globals.hFont = CreateFontIndirect(&lf);
1057  Globals.lfFont = lf;
1059  if (currfont != NULL)
1060  DeleteObject(currfont);
1061  }
1062 }
static IClassFactory * cf
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
#define ChooseFont
Definition: commdlg.h:662
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define CF_SCREENFONTS
Definition: commdlg.h:59
LONG_PTR LPARAM
Definition: windef.h:208
#define CreateFontIndirect
Definition: wingdi.h:4444
#define NULL
Definition: types.h:112
#define WM_SETFONT
Definition: winuser.h:1637
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SendMessage
Definition: winuser.h:5823
#define CF_NOVERTFONTS
Definition: commdlg.h:86
#define CF_INITTOLOGFONTSTRUCT
Definition: commdlg.h:66

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_StatusBarUpdateCaretPos()

VOID DIALOG_StatusBarUpdateCaretPos ( VOID  )

Definition at line 1187 of file dialog.c.

1188 {
1189  int line, col;
1190  TCHAR buff[MAX_PATH];
1191  DWORD dwStart, dwSize;
1192 
1193  SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwSize);
1194  line = SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)dwStart, 0);
1195  col = dwStart - SendMessage(Globals.hEdit, EM_LINEINDEX, (WPARAM)line, 0);
1196 
1197  _stprintf(buff, Globals.szStatusBarLineCol, line + 1, col + 1);
1199 }
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:1984
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define SB_SIMPLEID
Definition: precomp.h:15
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SB_SETTEXT
Definition: commctrl.h:1949
IN PCTCH line
Definition: pager.h:36
#define _stprintf
Definition: utility.h:124
#define EM_LINEFROMCHAR
Definition: winuser.h:1988
#define SendMessage
Definition: winuser.h:5823
#define EM_LINEINDEX
Definition: winuser.h:1989
static unsigned char buff[32768]
Definition: fatten.c:17
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by DoCreateStatusBar(), EDIT_WndProc(), and NOTEPAD_WndProc().

◆ DIALOG_StringMsgBox()

int DIALOG_StringMsgBox ( HWND  hParent,
int  formatId,
LPCTSTR  szString,
DWORD  dwFlags 
)

Definition at line 107 of file dialog.c.

108 {
109  TCHAR szMessage[MAX_STRING_LEN];
110  TCHAR szResource[MAX_STRING_LEN];
111 
112  /* Load and format szMessage */
113  LoadString(Globals.hInstance, formatId, szResource, ARRAY_SIZE(szResource));
114  _sntprintf(szMessage, ARRAY_SIZE(szMessage), szResource, szString);
115 
116  /* Load szCaption */
118  LoadString(Globals.hInstance, STRING_ERROR, szResource, ARRAY_SIZE(szResource));
119  else
120  LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, ARRAY_SIZE(szResource));
121 
122  /* Display Modal Dialog */
123  // if (hParent == NULL)
124  // hParent = Globals.hMainWnd;
125  return MessageBox(hParent, szMessage, szResource, dwFlags);
126 }
#define MB_ICONMASK
Definition: winuser.h:813
#define MAX_STRING_LEN
Definition: precomp.h:36
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_NOTEPAD
Definition: notepad_res.h:75
char TCHAR
Definition: xmlstorage.h:189
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define _sntprintf
Definition: xmlstorage.h:201
#define MessageBox
Definition: winuser.h:5802
#define ARRAY_SIZE(a)
Definition: main.h:24
#define STRING_ERROR
Definition: notepad_res.h:76
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

Referenced by AlertFileDoesNotExist(), AlertFileNotFound(), AlertFileNotSaved(), and AlertPrintError().

◆ DIALOG_ViewStatusBar()

VOID DIALOG_ViewStatusBar ( VOID  )

Definition at line 1201 of file dialog.c.

1202 {
1203  Globals.bShowStatusBar = !Globals.bShowStatusBar;
1204 
1206 }
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
VOID DoCreateStatusBar(VOID)
Definition: dialog.c:845

Referenced by _tWinMain(), and NOTEPAD_MenuCommand().

◆ DoCloseFile()

BOOL DoCloseFile ( VOID  )

Returns: TRUE - User agreed to close (both save/don't save) FALSE - User cancelled close by selecting "Cancel"

Definition at line 328 of file dialog.c.

329 {
330  int nResult;
331 
332  if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
333  {
334  /* prompt user to save changes */
335  nResult = AlertFileNotSaved(Globals.szFileName);
336  switch (nResult)
337  {
338  case IDYES:
339  if(!DIALOG_FileSave())
340  return FALSE;
341  break;
342 
343  case IDNO:
344  break;
345 
346  case IDCANCEL:
347  return FALSE;
348 
349  default:
350  return FALSE;
351  }
352  }
353 
356 
357  return TRUE;
358 }
void UpdateWindowCaption(BOOL clearModifyAlert)
Definition: dialog.c:66
static const TCHAR empty_str[]
Definition: dialog.c:32
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:179
#define EM_GETMODIFY
Definition: winuser.h:1981
#define SendMessage
Definition: winuser.h:5823
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
static int AlertFileNotSaved(LPCTSTR szFileName)
Definition: dialog.c:133
BOOL DIALOG_FileSave(VOID)
Definition: dialog.c:460

Referenced by DIALOG_FileNew(), DoOpenFile(), and NOTEPAD_WndProc().

◆ DoCreateEditWindow()

VOID DoCreateEditWindow ( VOID  )

Definition at line 923 of file dialog.c.

924 {
925  DWORD dwStyle;
926  int iSize;
927  LPTSTR pTemp = NULL;
928  BOOL bModified = FALSE;
929 
930  iSize = 0;
931 
932  /* If the edit control already exists, try to save its content */
933  if (Globals.hEdit != NULL)
934  {
935  /* number of chars currently written into the editor. */
936  iSize = GetWindowTextLength(Globals.hEdit);
937  if (iSize)
938  {
939  /* Allocates temporary buffer. */
940  pTemp = HeapAlloc(GetProcessHeap(), 0, (iSize + 1) * sizeof(TCHAR));
941  if (!pTemp)
942  {
943  ShowLastError();
944  return;
945  }
946 
947  /* Recover the text into the control. */
948  GetWindowText(Globals.hEdit, pTemp, iSize + 1);
949 
950  if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
951  bModified = TRUE;
952  }
953 
954  /* Restore original window procedure */
956 
957  /* Destroy the edit control */
958  DestroyWindow(Globals.hEdit);
959  }
960 
961  /* Update wrap status into the main menu and recover style flags */
962  if (Globals.bWrapLongLines)
963  {
964  dwStyle = EDIT_STYLE_WRAP;
966  } else {
967  dwStyle = EDIT_STYLE;
969  }
970 
971  /* Update previous changes */
973 
974  /* Create the new edit control */
976  EDIT_CLASS,
977  NULL,
978  dwStyle,
984  NULL,
986  NULL);
987 
988  if (Globals.hEdit == NULL)
989  {
990  if (pTemp)
991  {
992  HeapFree(GetProcessHeap(), 0, pTemp);
993  }
994 
995  ShowLastError();
996  return;
997  }
998 
1000  SendMessage(Globals.hEdit, EM_LIMITTEXT, 0, 0);
1001 
1002  /* If some text was previously saved, restore it. */
1003  if (iSize != 0)
1004  {
1005  SetWindowText(Globals.hEdit, pTemp);
1006  HeapFree(GetProcessHeap(), 0, pTemp);
1007 
1008  if (bModified)
1009  SendMessage(Globals.hEdit, EM_SETMODIFY, TRUE, 0);
1010  }
1011 
1012  /* Sub-class a new window callback for row/column detection. */
1013  Globals.EditProc = (WNDPROC)SetWindowLongPtr(Globals.hEdit,
1014  GWLP_WNDPROC,
1016 
1017  /* Create/update status bar */
1019 
1020  /* Finally shows new edit control and set focus into it. */
1021  ShowWindow(Globals.hEdit, SW_SHOW);
1022  SetFocus(Globals.hEdit);
1023 }
#define EM_LIMITTEXT
Definition: winuser.h:1987
#define MF_DISABLED
Definition: winuser.h:130
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TRUE
Definition: types.h:120
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SetWindowLongPtr
Definition: treelist.c:70
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define GetWindowText
Definition: winuser.h:5778
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define CMD_STATUSBAR
Definition: notepad_res.h:61
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateWindowEx
Definition: winuser.h:5735
#define CW_USEDEFAULT
Definition: winuser.h:225
VOID DoCreateStatusBar(VOID)
Definition: dialog.c:845
#define SW_SHOW
Definition: winuser.h:769
char TCHAR
Definition: xmlstorage.h:189
VOID ShowLastError(VOID)
Definition: dialog.c:38
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define EDIT_CLASS
Definition: main.h:32
#define MF_ENABLED
Definition: winuser.h:128
#define EM_GETMODIFY
Definition: winuser.h:1981
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EM_SETMODIFY
Definition: winuser.h:2000
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
LRESULT CALLBACK EDIT_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:310
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowText
Definition: winuser.h:5837
#define NULL
Definition: types.h:112
#define WM_SETFONT
Definition: winuser.h:1637
#define SendMessage
Definition: winuser.h:5823
#define EDIT_STYLE_WRAP
Definition: main.h:28
#define EDIT_STYLE
Definition: main.h:30
#define GetWindowTextLength
Definition: winuser.h:5779
#define MF_GRAYED
Definition: winuser.h:129
HINSTANCE hInstance
Definition: precomp.h:43
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by _tWinMain(), and DIALOG_EditWrap().

◆ DoCreateStatusBar()

VOID DoCreateStatusBar ( VOID  )

Definition at line 845 of file dialog.c.

846 {
847  RECT rc;
848  RECT rcstatus;
849  BOOL bStatusBarVisible;
850 
851  /* Check if status bar object already exists. */
852  if (Globals.hStatusBar == NULL)
853  {
854  /* Try to create the status bar */
856  NULL,
859 
860  if (Globals.hStatusBar == NULL)
861  {
862  ShowLastError();
863  return;
864  }
865 
866  /* Load the string for formatting column/row text output */
867  LoadString(Globals.hInstance, STRING_LINE_COLUMN, Globals.szStatusBarLineCol, MAX_PATH - 1);
868 
869  /* Set the status bar for single-text output */
870  SendMessage(Globals.hStatusBar, SB_SIMPLE, (WPARAM)TRUE, (LPARAM)0);
871  }
872 
873  /* Set status bar visiblity according to the settings. */
874  if ((Globals.bWrapLongLines != FALSE) || (Globals.bShowStatusBar == FALSE))
875  {
876  bStatusBarVisible = FALSE;
877  ShowWindow(Globals.hStatusBar, SW_HIDE);
878  }
879  else
880  {
881  bStatusBarVisible = TRUE;
882  ShowWindow(Globals.hStatusBar, SW_SHOW);
883  SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
884  }
885 
886  /* Set check state in show status bar item. */
887  if (bStatusBarVisible)
888  {
890  }
891  else
892  {
894  }
895 
896  /* Update menu mar with the previous changes */
898 
899  /* Sefety test is edit control exists */
900  if (Globals.hEdit != NULL)
901  {
902  /* Retrieve the sizes of the controls */
904  GetClientRect(Globals.hStatusBar, &rcstatus);
905 
906  /* If status bar is currently visible, update dimensions of edit control */
907  if (bStatusBarVisible)
908  rc.bottom -= (rcstatus.bottom - rcstatus.top);
909 
910  /* Resize edit control to right size. */
911  MoveWindow(Globals.hEdit,
912  rc.left,
913  rc.top,
914  rc.right - rc.left,
915  rc.bottom - rc.top,
916  TRUE);
917  }
918 
919  /* Update content with current row/column text */
921 }
#define STRING_LINE_COLUMN
Definition: notepad_res.h:100
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LONG top
Definition: windef.h:307
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define CMD_STATUSBAR
Definition: notepad_res.h:61
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateStatusWindow
Definition: commctrl.h:1933
#define SB_SIMPLE
Definition: commctrl.h:1958
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
#define MF_CHECKED
Definition: winuser.h:132
VOID ShowLastError(VOID)
Definition: dialog.c:38
#define WM_SIZE
Definition: winuser.h:1598
#define MAX_PATH
Definition: compat.h:34
VOID DIALOG_StatusBarUpdateCaretPos(VOID)
Definition: dialog.c:1187
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5823
LONG bottom
Definition: windef.h:309
HINSTANCE hInstance
Definition: precomp.h:43
#define WS_VISIBLE
Definition: pedump.c:620
#define CMD_STATUSBAR_WND_ID
Definition: notepad_res.h:62
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define LoadString
Definition: winuser.h:5799

Referenced by DIALOG_ViewStatusBar(), and DoCreateEditWindow().

◆ DoOpenFile()

VOID DoOpenFile ( LPCTSTR  szFileName)

Definition at line 360 of file dialog.c.

361 {
362  static const TCHAR dotlog[] = _T(".LOG");
363  HANDLE hFile;
364  LPTSTR pszText = NULL;
365  DWORD dwTextLen;
366  TCHAR log[5];
367 
368  /* Close any files and prompt to save changes */
369  if (!DoCloseFile())
370  return;
371 
375  {
376  ShowLastError();
377  goto done;
378  }
379 
380  if (!ReadText(hFile, (LPWSTR *)&pszText, &dwTextLen, &Globals.encFile, &Globals.iEoln))
381  {
382  ShowLastError();
383  goto done;
384  }
385  SetWindowText(Globals.hEdit, pszText);
386 
388  SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
389  SetFocus(Globals.hEdit);
390 
391  /* If the file starts with .LOG, add a time/date at the end and set cursor after
392  * See http://support.microsoft.com/?kbid=260563
393  */
394  if (GetWindowText(Globals.hEdit, log, ARRAY_SIZE(log)) && !_tcscmp(log, dotlog))
395  {
396  static const TCHAR lf[] = _T("\r\n");
401  }
402 
403  SetFileName(szFileName);
406 done:
409  if (pszText)
410  HeapFree(GetProcessHeap(), 0, pszText);
411 }
void UpdateWindowCaption(BOOL clearModifyAlert)
Definition: dialog.c:66
#define CloseHandle
Definition: compat.h:598
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
HWND WINAPI SetFocus(_In_opt_ HWND)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FILE_SHARE_READ
Definition: compat.h:136
#define GetWindowText
Definition: winuser.h:5778
BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, int *piEoln)
Definition: text.c:96
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
BOOL DoCloseFile(VOID)
Definition: dialog.c:328
LONG_PTR LPARAM
Definition: windef.h:208
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:179
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
VOID ShowLastError(VOID)
Definition: dialog.c:38
#define GetProcessHeap()
Definition: compat.h:595
#define EM_SETSEL
Definition: winuser.h:2005
unsigned long DWORD
Definition: ntddk_ex.h:95
#define OPEN_ALWAYS
Definition: disk.h:70
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define EM_EMPTYUNDOBUFFER
Definition: winuser.h:1972
#define GENERIC_READ
Definition: compat.h:135
#define EM_SETMODIFY
Definition: winuser.h:2000
_In_ HANDLE hFile
Definition: mswsock.h:90
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:913
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SetWindowText
Definition: winuser.h:5837
#define NULL
Definition: types.h:112
VOID NOTEPAD_EnableSearchMenu()
Definition: main.c:34
#define SendMessage
Definition: winuser.h:5823
#define GetWindowTextLength
Definition: winuser.h:5779
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID DIALOG_EditTimeDate(VOID)
Definition: dialog.c:829
#define HeapFree(x, y, z)
Definition: compat.h:594
#define log(outFile, fmt,...)
Definition: util.h:15
#define EM_REPLACESEL
Definition: winuser.h:1993

Referenced by DIALOG_FileOpen().

◆ DoSaveFile()

static BOOL DoSaveFile ( VOID  )
static

Definition at line 273 of file dialog.c.

274 {
275  BOOL bRet = TRUE;
276  HANDLE hFile;
277  LPTSTR pTemp;
278  DWORD size;
279 
283  {
284  ShowLastError();
285  return FALSE;
286  }
287 
288  size = GetWindowTextLength(Globals.hEdit) + 1;
289  pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*pTemp));
290  if (!pTemp)
291  {
293  ShowLastError();
294  return FALSE;
295  }
296  size = GetWindowText(Globals.hEdit, pTemp, size);
297 
298  if (size)
299  {
300  if (!WriteText(hFile, (LPWSTR)pTemp, size, Globals.encFile, Globals.iEoln))
301  {
302  ShowLastError();
303  bRet = FALSE;
304  }
305  else
306  {
308  bRet = TRUE;
309  }
310  }
311 
313  HeapFree(GetProcessHeap(), 0, pTemp);
314 
315  if (bRet)
316  {
317  SetFileName(Globals.szFileName);
318  }
319 
320  return bRet;
321 }
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, int iEoln)
Definition: text.c:368
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define GetWindowText
Definition: winuser.h:5778
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:179
VOID ShowLastError(VOID)
Definition: dialog.c:38
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define EM_SETMODIFY
Definition: winuser.h:2000
_In_ HANDLE hFile
Definition: mswsock.h:90
#define CREATE_ALWAYS
Definition: disk.h:72
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:913
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5823
#define GetWindowTextLength
Definition: winuser.h:5779
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by DIALOG_FileSave(), and DIALOG_FileSaveAs().

◆ EDIT_WndProc()

LRESULT CALLBACK EDIT_WndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 310 of file main.c.

311 {
312  switch (msg)
313  {
314  case WM_KEYDOWN:
315  case WM_KEYUP:
316  {
317  switch (wParam)
318  {
319  case VK_UP:
320  case VK_DOWN:
321  case VK_LEFT:
322  case VK_RIGHT:
324  break;
325  default:
326  {
328  break;
329  }
330  }
331  }
332  case WM_LBUTTONUP:
333  {
335  break;
336  }
337  }
339 }
#define CallWindowProc
Definition: winuser.h:5715
NOTEPAD_GLOBALS Globals
Definition: main.c:31
HWND hWnd
Definition: settings.c:17
#define VK_LEFT
Definition: winuser.h:2204
#define VK_DOWN
Definition: winuser.h:2207
WNDPROC EditProc
Definition: main.h:81
WPARAM wParam
Definition: combotst.c:138
#define VK_UP
Definition: winuser.h:2205
#define FALSE
Definition: types.h:117
#define WM_KEYDOWN
Definition: winuser.h:1702
VOID DIALOG_StatusBarUpdateCaretPos(VOID)
Definition: dialog.c:1187
#define WM_KEYUP
Definition: winuser.h:1703
#define VK_RIGHT
Definition: winuser.h:2206
#define WM_LBUTTONUP
Definition: winuser.h:1764
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102

Referenced by DoCreateEditWindow().

◆ FileExists()

BOOL FileExists ( LPCTSTR  szFilename)

Returns: TRUE - if file exists FALSE - if file does not exist

Definition at line 160 of file dialog.c.

161 {
163  HANDLE hFile;
164 
165  hFile = FindFirstFile(szFilename, &entry);
166  FindClose(hFile);
167 
168  return (hFile != INVALID_HANDLE_VALUE);
169 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define FindFirstFile
Definition: winbase.h:3643
uint32_t entry
Definition: isohybrid.c:63
_In_ HANDLE hFile
Definition: mswsock.h:90
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by DIALOG_FileOpen(), and HandleCommandLine().

◆ GetPrintingRect()

static RECT GetPrintingRect ( HDC  hdc,
RECT  margins 
)
static

Definition at line 249 of file dialog.c.

250 {
251  int iLogPixelsX, iLogPixelsY;
252  int iHorzRes, iVertRes;
253  int iPhysPageX, iPhysPageY, iPhysPageW, iPhysPageH;
254  RECT rcPrintRect;
255 
256  iPhysPageX = GetDeviceCaps(hdc, PHYSICALOFFSETX);
257  iPhysPageY = GetDeviceCaps(hdc, PHYSICALOFFSETY);
258  iPhysPageW = GetDeviceCaps(hdc, PHYSICALWIDTH);
259  iPhysPageH = GetDeviceCaps(hdc, PHYSICALHEIGHT);
260  iLogPixelsX = GetDeviceCaps(hdc, LOGPIXELSX);
261  iLogPixelsY = GetDeviceCaps(hdc, LOGPIXELSY);
262  iHorzRes = GetDeviceCaps(hdc, HORZRES);
263  iVertRes = GetDeviceCaps(hdc, VERTRES);
264 
265  rcPrintRect.left = (margins.left * iLogPixelsX / 2540) - iPhysPageX;
266  rcPrintRect.top = (margins.top * iLogPixelsY / 2540) - iPhysPageY;
267  rcPrintRect.right = iHorzRes - (((margins.left * iLogPixelsX / 2540) - iPhysPageX) + ((margins.right * iLogPixelsX / 2540) - (iPhysPageW - iPhysPageX - iHorzRes)));
268  rcPrintRect.bottom = iVertRes - (((margins.top * iLogPixelsY / 2540) - iPhysPageY) + ((margins.bottom * iLogPixelsY / 2540) - (iPhysPageH - iPhysPageY - iVertRes)));
269 
270  return rcPrintRect;
271 }
#define HORZRES
Definition: wingdi.h:716
#define LOGPIXELSX
Definition: wingdi.h:718
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define PHYSICALHEIGHT
Definition: wingdi.h:736
#define PHYSICALOFFSETY
Definition: wingdi.h:738
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static RECT margins
Definition: print.c:55
#define PHYSICALOFFSETX
Definition: wingdi.h:737
#define PHYSICALWIDTH
Definition: wingdi.h:735
#define VERTRES
Definition: wingdi.h:717
LONG bottom
Definition: windef.h:309
#define LOGPIXELSY
Definition: wingdi.h:719

Referenced by DIALOG_FilePrint().

◆ GetSelectionText()

int GetSelectionText ( HWND  hWnd,
LPTSTR  lpString,
int  nMaxCount 
)

Definition at line 191 of file dialog.c.

192 {
193  DWORD dwStart = 0;
194  DWORD dwEnd = 0;
195  DWORD dwSize;
196  HRESULT hResult;
197  LPTSTR lpTemp;
198 
199  if (!lpString)
200  {
201  return 0;
202  }
203 
204  SendMessage(hWnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
205 
206  if (dwStart == dwEnd)
207  {
208  return 0;
209  }
210 
212  lpTemp = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(TCHAR));
213  if (!lpTemp)
214  {
215  return 0;
216  }
217 
218  dwSize = GetWindowText(hWnd, lpTemp, dwSize);
219 
220  if (!dwSize)
221  {
222  HeapFree(GetProcessHeap(), 0, lpTemp);
223  return 0;
224  }
225 
226  hResult = StringCchCopyN(lpString, nMaxCount, lpTemp + dwStart, dwEnd - dwStart);
227  HeapFree(GetProcessHeap(), 0, lpTemp);
228 
229  switch (hResult)
230  {
231  case S_OK:
232  {
233  return dwEnd - dwStart;
234  }
235 
237  {
238  return nMaxCount - 1;
239  }
240 
241  default:
242  {
243  return 0;
244  }
245  }
246 }
HWND hWnd
Definition: settings.c:17
#define StringCchCopyN
Definition: strsafe.h:227
UINT_PTR WPARAM
Definition: windef.h:207
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define GetWindowText
Definition: winuser.h:5778
#define EM_GETSEL
Definition: winuser.h:1984
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define SendMessage
Definition: winuser.h:5823
#define GetWindowTextLength
Definition: winuser.h:5779
_In_ int nMaxCount
Definition: winuser.h:4857
#define HeapFree(x, y, z)
Definition: compat.h:594
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by DIALOG_FilePrint().

◆ GetSelectionTextLength()

int GetSelectionTextLength ( HWND  hWnd)

Definition at line 181 of file dialog.c.

182 {
183  DWORD dwStart = 0;
184  DWORD dwEnd = 0;
185 
186  SendMessage(hWnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
187 
188  return dwEnd - dwStart;
189 }
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:1984
LONG_PTR LPARAM
Definition: windef.h:208
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SendMessage
Definition: winuser.h:5823

Referenced by DIALOG_FilePrint().

◆ HasFileExtension()

BOOL HasFileExtension ( LPCTSTR  szFilename)

Definition at line 171 of file dialog.c.

172 {
173  LPCTSTR s;
174 
175  s = _tcsrchr(szFilename, _T('\\'));
176  if (s)
177  szFilename = s;
178  return _tcsrchr(szFilename, _T('.')) != NULL;
179 }
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define _T(x)
Definition: vfdio.h:22
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4

Referenced by HandleCommandLine().

◆ ShowLastError()

VOID ShowLastError ( VOID  )

Definition at line 38 of file dialog.c.

39 {
41  if (error != NO_ERROR)
42  {
43  LPTSTR lpMsgBuf = NULL;
45 
47 
49  NULL,
50  error,
51  0,
52  (LPTSTR) &lpMsgBuf,
53  0,
54  NULL);
55 
56  MessageBox(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
57  LocalFree(lpMsgBuf);
58  }
59 }
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define MAX_STRING_LEN
Definition: precomp.h:36
#define NO_ERROR
Definition: dderror.h:5
CHAR * LPTSTR
Definition: xmlstorage.h:192
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
char TCHAR
Definition: xmlstorage.h:189
unsigned long DWORD
Definition: ntddk_ex.h:95
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define FormatMessage
Definition: winbase.h:3656
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5802
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define STRING_ERROR
Definition: notepad_res.h:76
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

Referenced by _tWinMain(), DIALOG_FilePrint(), DoCreateEditWindow(), DoCreateStatusBar(), DoOpenFile(), and DoSaveFile().

◆ 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.

67 {
68  TCHAR szCaption[MAX_STRING_LEN];
69  TCHAR szNotepad[MAX_STRING_LEN];
70  TCHAR szFilename[MAX_STRING_LEN];
71  BOOL isModified;
72 
73  if (clearModifyAlert)
74  {
75  /* When a file is being opened or created, there is no need to have
76  * the edited flag shown when the file has not been edited yet. */
77  isModified = FALSE;
78  }
79  else
80  {
81  /* Check whether the user has modified the file or not. If we are
82  * in the same state as before, don't change the caption. */
83  isModified = !!SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0);
84  if (isModified == Globals.bWasModified)
85  return;
86  }
87 
88  /* Remember the state for later calls */
89  Globals.bWasModified = isModified;
90 
91  /* Load the name of the application */
92  LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
93 
94  /* Determine if the file has been saved or if this is a new file */
95  if (Globals.szFileTitle[0] != 0)
96  StringCchCopy(szFilename, ARRAY_SIZE(szFilename), Globals.szFileTitle);
97  else
98  LoadString(Globals.hInstance, STRING_UNTITLED, szFilename, ARRAY_SIZE(szFilename));
99 
100  /* Update the window caption based upon whether the user has modified the file or not */
101  StringCbPrintf(szCaption, sizeof(szCaption), _T("%s%s - %s"),
102  (isModified ? _T("*") : _T("")), szFilename, szNotepad);
103 
104  SetWindowText(Globals.hMainWnd, szCaption);
105 }
#define MAX_STRING_LEN
Definition: precomp.h:36
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define STRING_NOTEPAD
Definition: notepad_res.h:75
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define STRING_UNTITLED
Definition: notepad_res.h:79
#define StringCbPrintf
Definition: strsafe.h:544
#define EM_GETMODIFY
Definition: winuser.h:1981
#define StringCchCopy
Definition: strsafe.h:139
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SetWindowText
Definition: winuser.h:5837
#define SendMessage
Definition: winuser.h:5823
HINSTANCE hInstance
Definition: precomp.h:43
#define LoadString
Definition: winuser.h:5799

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

Variable Documentation

◆ empty_str

◆ helpfile

const TCHAR helpfile[] = _T("notepad.hlp")
static

◆ szDefaultExt

const TCHAR szDefaultExt[] = _T("txt")
static

Definition at line 33 of file dialog.c.

Referenced by DIALOG_FileOpen(), and DIALOG_FileSaveAs().

◆ txt_files

const TCHAR txt_files[] = _T("*.txt")
static

Definition at line 34 of file dialog.c.

Referenced by DIALOG_FileOpen(), DIALOG_FileSaveAs(), and NOTEPAD_InitData().