ReactOS 0.4.15-dev-5667-ged97270
dialog.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VOID DIALOG_FileNew (VOID)
 
VOID DIALOG_FileNewWindow (VOID)
 
VOID DIALOG_FileOpen (VOID)
 
BOOL DIALOG_FileSave (VOID)
 
BOOL DIALOG_FileSaveAs (VOID)
 
VOID DIALOG_FilePrint (VOID)
 
VOID DIALOG_FilePageSetup (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 DIALOG_EditWrap (VOID)
 
VOID DIALOG_Search (VOID)
 
VOID DIALOG_SearchNext (VOID)
 
VOID DIALOG_Replace (VOID)
 
VOID DIALOG_GoTo (VOID)
 
VOID DIALOG_SelectFont (VOID)
 
VOID DIALOG_ViewStatusBar (VOID)
 
VOID DIALOG_StatusBarAlignParts (VOID)
 
VOID DIALOG_StatusBarUpdateCaretPos (VOID)
 
VOID DIALOG_HelpContents (VOID)
 
VOID DIALOG_HelpSearch (VOID)
 
VOID DIALOG_HelpLicense (VOID)
 
VOID DIALOG_HelpNoWarranty (VOID)
 
VOID DIALOG_HelpAboutNotepad (VOID)
 
VOID DIALOG_TimeDate (VOID)
 
int DIALOG_StringMsgBox (HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
 
INT_PTR CALLBACK AboutDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
VOID ShowLastError (VOID)
 
BOOL FileExists (LPCTSTR szFilename)
 
BOOL HasFileExtension (LPCTSTR szFilename)
 
BOOL DoCloseFile (VOID)
 
VOID DoOpenFile (LPCTSTR szFileName)
 
VOID DoCreateStatusBar (VOID)
 
VOID DoCreateEditWindow (VOID)
 

Function Documentation

◆ AboutDialogProc()

INT_PTR CALLBACK AboutDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 4 of file about.c.

8{
9 HWND hLicenseEditWnd;
11 TCHAR strLicense[700];
12
13 switch (message)
14 {
15 case WM_INITDIALOG:
16
20 16,
21 16,
22 0);
23
24 SendMessage(hDlg,
25 WM_SETICON,
27 (LPARAM)hIcon);
28
29 hLicenseEditWnd = GetDlgItem(hDlg,
31
34 strLicense,
35 sizeof(strLicense) / sizeof(TCHAR));
36
37 SetWindowText(hLicenseEditWnd,
38 strLicense);
39 return TRUE;
40
41 case WM_COMMAND:
42 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
43 {
45 EndDialog(hDlg,
46 LOWORD(wParam));
47 return TRUE;
48 }
49
50 break;
51 }
52
53 return FALSE;
54}
#define IDC_LICENSE_EDIT
Definition: resource.h:20
#define IDI_ICON
Definition: resource.h:5
#define IDS_LICENSE
Definition: resource.h:28
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define LOWORD(l)
Definition: pedump.c:82
Definition: tftpd.h:60
#define ICON_SMALL
Definition: tnclass.cpp:48
LONG_PTR LPARAM
Definition: windef.h:208
#define IDCANCEL
Definition: winuser.h:825
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_COMMAND
Definition: winuser.h:1730
#define WM_INITDIALOG
Definition: winuser.h:1729
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:824
#define SendMessage
Definition: winuser.h:5833
#define LoadImage
Definition: winuser.h:5805
#define LoadString
Definition: winuser.h:5809
#define SetWindowText
Definition: winuser.h:5847
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
char TCHAR
Definition: xmlstorage.h:189

◆ DIALOG_EditCopy()

VOID DIALOG_EditCopy ( VOID  )

Definition at line 879 of file dialog.c.

880{
881 SendMessage(Globals.hEdit, WM_COPY, 0, 0);
882}
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define WM_COPY
Definition: winuser.h:1852

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditCut()

VOID DIALOG_EditCut ( VOID  )

Definition at line 874 of file dialog.c.

875{
876 SendMessage(Globals.hEdit, WM_CUT, 0, 0);
877}
#define WM_CUT
Definition: winuser.h:1851

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditDelete()

VOID DIALOG_EditDelete ( VOID  )

Definition at line 889 of file dialog.c.

890{
891 SendMessage(Globals.hEdit, WM_CLEAR, 0, 0);
892}
#define WM_CLEAR
Definition: winuser.h:1854

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditPaste()

VOID DIALOG_EditPaste ( VOID  )

Definition at line 884 of file dialog.c.

885{
886 SendMessage(Globals.hEdit, WM_PASTE, 0, 0);
887}
#define WM_PASTE
Definition: winuser.h:1853

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditSelectAll()

VOID DIALOG_EditSelectAll ( VOID  )

Definition at line 894 of file dialog.c.

895{
896 SendMessage(Globals.hEdit, EM_SETSEL, 0, (LPARAM)-1);
897}
#define EM_SETSEL
Definition: winuser.h:2008

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditTimeDate()

VOID DIALOG_EditTimeDate ( VOID  )

Definition at line 899 of file dialog.c.

900{
901 SYSTEMTIME st;
902 TCHAR szDate[MAX_STRING_LEN];
903 TCHAR szText[MAX_STRING_LEN * 2 + 2];
904
905 GetLocalTime(&st);
906
908 _tcscpy(szText, szDate);
909 _tcscat(szText, _T(" "));
911 _tcscat(szText, szDate);
912 SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szText);
913}
#define MAX_STRING_LEN
Definition: precomp.h:36
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define _tcscat
Definition: tchar.h:622
#define _tcscpy
Definition: tchar.h:623
#define LOCALE_USER_DEFAULT
#define _T(x)
Definition: vfdio.h:22
#define GetTimeFormat
Definition: winnls.h:1189
#define DATE_LONGDATE
Definition: winnls.h:197
#define GetDateFormat
Definition: winnls.h:1184
#define EM_REPLACESEL
Definition: winuser.h:1996

Referenced by DoOpenFile(), and NOTEPAD_MenuCommand().

◆ DIALOG_EditUndo()

VOID DIALOG_EditUndo ( VOID  )

Definition at line 869 of file dialog.c.

870{
871 SendMessage(Globals.hEdit, EM_UNDO, 0, 0);
872}
#define EM_UNDO
Definition: winuser.h:2011

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_EditWrap()

VOID DIALOG_EditWrap ( VOID  )

Definition at line 1099 of file dialog.c.

1100{
1101 Globals.bWrapLongLines = !Globals.bWrapLongLines;
1102
1103 if (Globals.bWrapLongLines)
1104 {
1106 }
1107 else
1108 {
1110 }
1111
1113}
VOID DoCreateEditWindow(VOID)
Definition: dialog.c:997
#define CMD_GOTO
Definition: notepad_res.h:56
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_GRAYED
Definition: winuser.h:129
#define MF_DISABLED
Definition: winuser.h:130

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileExit()

VOID DIALOG_FileExit ( VOID  )

Definition at line 864 of file dialog.c.

865{
867}
r l[0]
Definition: byte_order.h:167
#define WM_CLOSE
Definition: winuser.h:1611
#define PostMessage
Definition: winuser.h:5822

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileNew()

VOID DIALOG_FileNew ( VOID  )

Definition at line 475 of file dialog.c.

476{
477 /* Close any files and prompt to save changes */
478 if (DoCloseFile()) {
481 SetFocus(Globals.hEdit);
483 }
484}
static const TCHAR empty_str[]
Definition: dialog.c:32
BOOL DoCloseFile(VOID)
Definition: dialog.c:388
VOID NOTEPAD_EnableSearchMenu()
Definition: main.c:34
#define EM_EMPTYUNDOBUFFER
Definition: winuser.h:1975
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by _tWinMain(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileNewWindow()

VOID DIALOG_FileNewWindow ( VOID  )

Definition at line 486 of file dialog.c.

487{
488 TCHAR pszNotepadExe[MAX_PATH];
489 GetModuleFileName(NULL, pszNotepadExe, ARRAYSIZE(pszNotepadExe));
490 ShellExecute(NULL, NULL, pszNotepadExe, NULL, NULL, SW_SHOWNORMAL);
491}
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
#define ShellExecute
Definition: shellapi.h:690
#define GetModuleFileName
Definition: winbase.h:3702
#define SW_SHOWNORMAL
Definition: winuser.h:764

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FileOpen()

VOID DIALOG_FileOpen ( VOID  )

Definition at line 493 of file dialog.c.

494{
495 OPENFILENAME openfilename;
497
498 ZeroMemory(&openfilename, sizeof(openfilename));
499
500 if (Globals.szFileName[0] == 0)
502 else
503 _tcscpy(szPath, Globals.szFileName);
504
505 openfilename.lStructSize = sizeof(openfilename);
506 openfilename.hwndOwner = Globals.hMainWnd;
507 openfilename.hInstance = Globals.hInstance;
508 openfilename.lpstrFilter = Globals.szFilter;
509 openfilename.lpstrFile = szPath;
510 openfilename.nMaxFile = ARRAY_SIZE(szPath);
512 openfilename.lpstrDefExt = szDefaultExt;
513
514 if (GetOpenFileName(&openfilename)) {
515 if (FileExists(openfilename.lpstrFile))
516 DoOpenFile(openfilename.lpstrFile);
517 else
518 AlertFileNotFound(openfilename.lpstrFile);
519 }
520}
static void AlertFileNotFound(LPCTSTR szFileName)
Definition: dialog.c:188
static const TCHAR txt_files[]
Definition: dialog.c:34
BOOL FileExists(LPCTSTR szFilename)
Definition: dialog.c:220
static const TCHAR szDefaultExt[]
Definition: dialog.c:33
VOID DoOpenFile(LPCTSTR szFileName)
Definition: dialog.c:420
#define ARRAY_SIZE(a)
Definition: main.h:24
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define GetOpenFileName
Definition: commdlg.h:665
LPCWSTR szPath
Definition: env.c:37
HINSTANCE hInstance
Definition: precomp.h:43
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
#define ZeroMemory
Definition: winbase.h:1670

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FilePageSetup()

VOID DIALOG_FilePageSetup ( VOID  )

Definition at line 1305 of file dialog.c.

1306{
1308
1309 ZeroMemory(&page, sizeof(page));
1310 page.lStructSize = sizeof(page);
1311 page.hwndOwner = Globals.hMainWnd;
1313 page.hInstance = Globals.hInstance;
1314 page.rtMargin = Globals.lMargins;
1315 page.hDevMode = Globals.hDevMode;
1316 page.hDevNames = Globals.hDevNames;
1317 page.lpPageSetupTemplateName = MAKEINTRESOURCE(DIALOG_PAGESETUP);
1318 page.lpfnPageSetupHook = DIALOG_PAGESETUP_Hook;
1319
1321
1322 Globals.hDevMode = page.hDevMode;
1323 Globals.hDevNames = page.hDevNames;
1324 Globals.lMargins = page.rtMargin;
1325}
static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1332
#define PSD_ENABLEPAGESETUPHOOK
Definition: commdlg.h:183
#define PSD_ENABLEPAGESETUPTEMPLATE
Definition: commdlg.h:184
#define PSD_MARGINS
Definition: commdlg.h:173
#define PageSetupDlg
Definition: commdlg.h:667
#define DIALOG_PAGESETUP
Definition: notepad_res.h:25
Definition: module.h:566

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_FilePrint()

VOID DIALOG_FilePrint ( VOID  )

Definition at line 649 of file dialog.c.

650{
651 DOCINFO di;
653 PRINTDLG printer;
654 SIZE szMetric;
655 int border;
656 int xLeft, yTop, pagecount, dopage, copycount;
657 unsigned int i;
658 LOGFONT hdrFont;
659 HFONT font, old_font=0;
660 DWORD size;
661 LPTSTR pTemp;
662 static const TCHAR times_new_roman[] = _T("Times New Roman");
663 RECT rcPrintRect;
664
665 /* Get a small font and print some header info on each page */
666 ZeroMemory(&hdrFont, sizeof(hdrFont));
667 hdrFont.lfHeight = 100;
668 hdrFont.lfWeight = FW_BOLD;
669 hdrFont.lfCharSet = ANSI_CHARSET;
672 hdrFont.lfQuality = PROOF_QUALITY;
674 _tcscpy(hdrFont.lfFaceName, times_new_roman);
675
676 font = CreateFontIndirect(&hdrFont);
677
678 /* Get Current Settings */
679 ZeroMemory(&printer, sizeof(printer));
680 printer.lStructSize = sizeof(printer);
681 printer.hwndOwner = Globals.hMainWnd;
682 printer.hInstance = Globals.hInstance;
683
684 /* Set some default flags */
685 printer.Flags = PD_RETURNDC | PD_SELECTION;
686
687 /* Disable the selection radio button if there is no text selected */
689 {
690 printer.Flags = printer.Flags | PD_NOSELECTION;
691 }
692
693 printer.nFromPage = 0;
694 printer.nMinPage = 1;
695 /* we really need to calculate number of pages to set nMaxPage and nToPage */
696 printer.nToPage = (WORD)-1;
697 printer.nMaxPage = (WORD)-1;
698
699 /* Let commdlg manage copy settings */
701
702 printer.hDevMode = Globals.hDevMode;
703 printer.hDevNames = Globals.hDevNames;
704
705 if (!PrintDlg(&printer))
706 {
708 return;
709 }
710
711 Globals.hDevMode = printer.hDevMode;
712 Globals.hDevNames = printer.hDevNames;
713
714 assert(printer.hDC != 0);
715
716 /* initialize DOCINFO */
717 di.cbSize = sizeof(DOCINFO);
718 di.lpszDocName = Globals.szFileTitle;
719 di.lpszOutput = NULL;
720 di.lpszDatatype = NULL;
721 di.fwType = 0;
722
723 if (StartDoc(printer.hDC, &di) <= 0)
724 {
726 return;
727 }
728
729
730 /* Get the file text */
731 if (printer.Flags & PD_SELECTION)
732 {
734 }
735 else
736 {
737 size = GetWindowTextLength(Globals.hEdit) + 1;
738 }
739
740 pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(TCHAR));
741 if (!pTemp)
742 {
743 EndDoc(printer.hDC);
746 return;
747 }
748
749 if (printer.Flags & PD_SELECTION)
750 {
751 size = GetSelectionText(Globals.hEdit, pTemp, size);
752 }
753 else
754 {
755 size = GetWindowText(Globals.hEdit, pTemp, size);
756 }
757
758 /* Get the current printing area */
759 rcPrintRect = GetPrintingRect(printer.hDC, Globals.lMargins);
760
761 /* Ensure that each logical unit maps to one pixel */
762 SetMapMode(printer.hDC, MM_TEXT);
763
764 /* Needed to get the correct height of a text line */
765 GetTextMetrics(printer.hDC, &tm);
766
767 border = 15;
768 for (copycount=1; copycount <= printer.nCopies; copycount++) {
769 i = 0;
770 pagecount = 1;
771 do {
772 /* Don't start a page if none of the conditions below are true */
773 dopage = 0;
774
775 /* The user wants to print the current selection */
776 if (printer.Flags & PD_SELECTION)
777 {
778 dopage = 1;
779 }
780
781 /* The user wants to print the entire document */
782 if (!(printer.Flags & PD_PAGENUMS) && !(printer.Flags & PD_SELECTION))
783 {
784 dopage = 1;
785 }
786
787 /* The user wants to print a specified range of pages */
788 if ((pagecount >= printer.nFromPage && pagecount <= printer.nToPage))
789 {
790 dopage = 1;
791 }
792
793 old_font = SelectObject(printer.hDC, font);
794
795 if (dopage) {
796 if (StartPage(printer.hDC) <= 0) {
797 SelectObject(printer.hDC, old_font);
798 EndDoc(printer.hDC);
799 DeleteDC(printer.hDC);
800 HeapFree(GetProcessHeap(), 0, pTemp);
803 return;
804 }
805
806 SetViewportOrgEx(printer.hDC, rcPrintRect.left, rcPrintRect.top, NULL);
807
808 /* Write a rectangle and header at the top of each page */
809 Rectangle(printer.hDC, border, border, rcPrintRect.right - border, border + tm.tmHeight * 2);
810 /* I don't know what's up with this TextOut command. This comes out
811 kind of mangled.
812 */
813 TextOut(printer.hDC,
814 border * 2,
815 border + tm.tmHeight / 2,
816 Globals.szFileTitle,
817 lstrlen(Globals.szFileTitle));
818 }
819
820 /* The starting point for the main text */
821 xLeft = 0;
822 yTop = border + tm.tmHeight * 4;
823
824 SelectObject(printer.hDC, old_font);
825
826 /* Since outputting strings is giving me problems, output the main
827 * text one character at a time. */
828 do {
829 if (pTemp[i] == '\n') {
830 xLeft = 0;
831 yTop += tm.tmHeight;
832 }
833 else if (pTemp[i] != '\r') {
834 if (dopage)
835 TextOut(printer.hDC, xLeft, yTop, &pTemp[i], 1);
836
837 /* We need to get the width for each individual char, since a proportional font may be used */
838 GetTextExtentPoint32(printer.hDC, &pTemp[i], 1, &szMetric);
839 xLeft += szMetric.cx;
840
841 /* Insert a line break if the current line does not fit into the printing area */
842 if (xLeft > rcPrintRect.right)
843 {
844 xLeft = 0;
845 yTop = yTop + tm.tmHeight;
846 }
847 }
848 } while (i++ < size && yTop < rcPrintRect.bottom);
849
850 if (dopage)
851 EndPage(printer.hDC);
852 pagecount++;
853 } while (i < size);
854 }
855
856 if (old_font != 0)
857 SelectObject(printer.hDC, old_font);
858 EndDoc(printer.hDC);
859 DeleteDC(printer.hDC);
860 HeapFree(GetProcessHeap(), 0, pTemp);
862}
int GetSelectionText(HWND hWnd, LPTSTR lpString, int nMaxCount)
Definition: dialog.c:251
VOID ShowLastError(VOID)
Definition: dialog.c:59
static RECT GetPrintingRect(HDC hdc, RECT margins)
Definition: dialog.c:309
static void AlertPrintError(void)
Definition: dialog.c:204
int GetSelectionTextLength(HWND hWnd)
Definition: dialog.c:241
#define PD_NOSELECTION
Definition: commdlg.h:149
#define PD_SELECTION
Definition: commdlg.h:147
#define PD_USEDEVMODECOPIES
Definition: commdlg.h:165
#define PrintDlg
Definition: commdlg.h:668
#define PD_RETURNDC
Definition: commdlg.h:155
#define PD_PAGENUMS
Definition: commdlg.h:148
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define assert(x)
Definition: debug.h:53
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
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
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: mk_font.cpp:20
BYTE lfClipPrecision
Definition: dimm.idl:52
BYTE lfQuality
Definition: dimm.idl:53
BYTE lfOutPrecision
Definition: dimm.idl:51
BYTE lfPitchAndFamily
Definition: dimm.idl:54
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
int cbSize
Definition: wingdi.h:1676
LPCSTR lpszOutput
Definition: wingdi.h:1678
LPCSTR lpszDatatype
Definition: wingdi.h:1679
LPCSTR lpszDocName
Definition: wingdi.h:1677
DWORD fwType
Definition: wingdi.h:1680
WORD nMaxPage
Definition: commdlg.h:474
HDC hDC
Definition: commdlg.h:469
DWORD Flags
Definition: commdlg.h:470
HINSTANCE hInstance
Definition: commdlg.h:476
WORD nCopies
Definition: commdlg.h:475
WORD nFromPage
Definition: commdlg.h:471
HGLOBAL hDevMode
Definition: commdlg.h:467
WORD nToPage
Definition: commdlg.h:472
WORD nMinPage
Definition: commdlg.h:473
HGLOBAL hDevNames
Definition: commdlg.h:468
HWND hwndOwner
Definition: commdlg.h:466
DWORD lStructSize
Definition: commdlg.h:465
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG cx
Definition: windef.h:334
Definition: time.h:68
#define lstrlen
Definition: winbase.h:3747
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define VARIABLE_PITCH
Definition: wingdi.h:445
int WINAPI EndPage(_In_ HDC)
#define FF_ROMAN
Definition: wingdi.h:450
#define FW_BOLD
Definition: wingdi.h:378
#define GetTextExtentPoint32
Definition: wingdi.h:4472
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
int WINAPI EndDoc(_In_ HDC)
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
int WINAPI StartPage(_In_ HDC)
#define ANSI_CHARSET
Definition: wingdi.h:383
#define PROOF_QUALITY
Definition: wingdi.h:438
#define MM_TEXT
Definition: wingdi.h:873
DOCINFOA DOCINFO
Definition: wingdi.h:4414
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteDC(_In_ HDC)
#define GetTextMetrics
Definition: wingdi.h:4474
#define CreateFontIndirect
Definition: wingdi.h:4444
#define TextOut
Definition: wingdi.h:4483
#define StartDoc
Definition: wingdi.h:4482
#define GetWindowTextLength
Definition: winuser.h:5789
#define GetWindowText
Definition: winuser.h:5788
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by HandleCommandLine(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileSave()

BOOL DIALOG_FileSave ( VOID  )

Definition at line 522 of file dialog.c.

523{
524 if (Globals.szFileName[0] == 0)
525 {
526 return DIALOG_FileSaveAs();
527 }
528 else if (DoSaveFile())
529 {
531 return TRUE;
532 }
533 return FALSE;
534}
BOOL DIALOG_FileSaveAs(VOID)
Definition: dialog.c:597
static BOOL DoSaveFile(VOID)
Definition: dialog.c:333
void UpdateWindowCaption(BOOL clearModifyAlert)
Definition: dialog.c:87

Referenced by DoCloseFile(), and NOTEPAD_MenuCommand().

◆ DIALOG_FileSaveAs()

BOOL DIALOG_FileSaveAs ( VOID  )

Definition at line 597 of file dialog.c.

598{
599 OPENFILENAME saveas;
601
602 ZeroMemory(&saveas, sizeof(saveas));
603
604 if (Globals.szFileName[0] == 0)
606 else
607 _tcscpy(szPath, Globals.szFileName);
608
609 saveas.lStructSize = sizeof(OPENFILENAME);
610 saveas.hwndOwner = Globals.hMainWnd;
611 saveas.hInstance = Globals.hInstance;
612 saveas.lpstrFilter = Globals.szFilter;
613 saveas.lpstrFile = szPath;
614 saveas.nMaxFile = ARRAY_SIZE(szPath);
617 saveas.lpstrDefExt = szDefaultExt;
620
621 if (GetSaveFileName(&saveas))
622 {
623 /* HACK: Because in ROS, Save-As boxes don't check the validity
624 * of file names and thus, here, szPath can be invalid !! We only
625 * see its validity when we call DoSaveFile()... */
627 if (DoSaveFile())
628 {
630
631 /* Update line endings and encoding on the status bar */
634
635 return TRUE;
636 }
637 else
638 {
639 SetFileName(_T(""));
640 return FALSE;
641 }
642 }
643 else
644 {
645 return FALSE;
646 }
647}
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:180
static VOID DIALOG_StatusBarUpdateEncoding(VOID)
Definition: dialog.c:155
static VOID DIALOG_StatusBarUpdateLineEndings(VOID)
Definition: dialog.c:146
static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:538
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define GetSaveFileName
Definition: commdlg.h:666
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define DIALOG_ENCODING
Definition: notepad_res.h:27
LPCSTR lpTemplateName
Definition: commdlg.h:348
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347

Referenced by DIALOG_FileSave(), and NOTEPAD_MenuCommand().

◆ DIALOG_GoTo()

VOID DIALOG_GoTo ( VOID  )

Definition at line 1219 of file dialog.c.

1220{
1221 INT_PTR nLine;
1222 LPTSTR pszText;
1223 int nLength, i;
1224 DWORD dwStart, dwEnd;
1225
1227 pszText = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(*pszText));
1228 if (!pszText)
1229 return;
1230
1231 /* Retrieve current text */
1232 GetWindowText(Globals.hEdit, pszText, nLength + 1);
1233 SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd);
1234
1235 nLine = 1;
1236 for (i = 0; (i < (int) dwStart) && pszText[i]; i++)
1237 {
1238 if (pszText[i] == '\n')
1239 nLine++;
1240 }
1241
1246 nLine);
1247
1248 if (nLine >= 1)
1249 {
1250 for (i = 0; pszText[i] && (nLine > 1) && (i < nLength - 1); i++)
1251 {
1252 if (pszText[i] == '\n')
1253 nLine--;
1254 }
1255 SendMessage(Globals.hEdit, EM_SETSEL, i, i);
1256 SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0);
1257 }
1258 HeapFree(GetProcessHeap(), 0, pszText);
1259}
static INT_PTR CALLBACK DIALOG_GoTo_DialogProc(HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1185
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define DIALOG_GOTO
Definition: notepad_res.h:30
#define EM_SCROLLCARET
Definition: richedit.h:81
int32_t INT_PTR
Definition: typedefs.h:64
_In_ DWORD nLength
Definition: wincon.h:473
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:1987
#define DialogBoxParam
Definition: winuser.h:5754

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_HelpAboutNotepad()

VOID DIALOG_HelpAboutNotepad ( VOID  )

Definition at line 1287 of file dialog.c.

1288{
1289 TCHAR szNotepad[MAX_STRING_LEN];
1290 TCHAR szNotepadAuthors[MAX_STRING_LEN];
1291
1293
1294 LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
1295 LoadString(Globals.hInstance, STRING_NOTEPAD_AUTHORS, szNotepadAuthors, ARRAY_SIZE(szNotepadAuthors));
1296
1297 ShellAbout(Globals.hMainWnd, szNotepad, szNotepadAuthors, notepadIcon);
1298 DeleteObject(notepadIcon);
1299}
#define STRING_NOTEPAD_AUTHORS
Definition: notepad_res.h:107
#define STRING_NOTEPAD
Definition: notepad_res.h:75
#define IDI_NPICON
Definition: notepad_res.h:32
#define ShellAbout
Definition: shellapi.h:689
#define LoadIcon
Definition: winuser.h:5803

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_HelpContents()

VOID DIALOG_HelpContents ( VOID  )

Definition at line 1282 of file dialog.c.

1283{
1285}
static const TCHAR helpfile[]
Definition: dialog.c:31
#define WinHelp
Definition: winuser.h:5854
#define HELP_INDEX
Definition: winuser.h:2400

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_HelpLicense()

VOID DIALOG_HelpLicense ( VOID  )

◆ DIALOG_HelpNoWarranty()

VOID DIALOG_HelpNoWarranty ( VOID  )

◆ DIALOG_HelpSearch()

VOID DIALOG_HelpSearch ( VOID  )

◆ DIALOG_Replace()

VOID DIALOG_Replace ( VOID  )

Definition at line 1178 of file dialog.c.

1179{
1181}
static VOID DIALOG_SearchDialog(FINDPROC pfnProc)
Definition: dialog.c:1140
#define ReplaceText
Definition: commdlg.h:669

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_Search()

VOID DIALOG_Search ( VOID  )

Definition at line 1165 of file dialog.c.

1166{
1168}
#define FindText
Definition: commdlg.h:663

Referenced by DIALOG_SearchNext(), and NOTEPAD_MenuCommand().

◆ DIALOG_SearchNext()

VOID DIALOG_SearchNext ( VOID  )

Definition at line 1170 of file dialog.c.

1171{
1172 if (Globals.find.lpstrFindWhat != NULL)
1174 else
1175 DIALOG_Search();
1176}
VOID DIALOG_Search(VOID)
Definition: dialog.c:1165
BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
Definition: main.c:144

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_SelectFont()

VOID DIALOG_SelectFont ( VOID  )

Definition at line 1115 of file dialog.c.

1116{
1117 CHOOSEFONT cf;
1118 LOGFONT lf = Globals.lfFont;
1119
1120 ZeroMemory( &cf, sizeof(cf) );
1121 cf.lStructSize = sizeof(cf);
1122 cf.hwndOwner = Globals.hMainWnd;
1123 cf.lpLogFont = &lf;
1125
1126 if (ChooseFont(&cf))
1127 {
1128 HFONT currfont = Globals.hFont;
1129
1130 Globals.hFont = CreateFontIndirect(&lf);
1131 Globals.lfFont = lf;
1133 if (currfont != NULL)
1134 DeleteObject(currfont);
1135 }
1136}
#define ChooseFont
Definition: commdlg.h:662
#define CF_INITTOLOGFONTSTRUCT
Definition: commdlg.h:66
#define CF_NOVERTFONTS
Definition: commdlg.h:86
#define CF_SCREENFONTS
Definition: commdlg.h:59
#define WM_SETFONT
Definition: winuser.h:1640

Referenced by NOTEPAD_MenuCommand().

◆ DIALOG_StatusBarAlignParts()

VOID DIALOG_StatusBarAlignParts ( VOID  )

Definition at line 128 of file dialog.c.

129{
130 static const int defaultWidths[] = {120, 120, 120};
131 RECT rcStatusBar;
132 int parts[3];
133
134 GetClientRect(Globals.hStatusBar, &rcStatusBar);
135
136 parts[0] = rcStatusBar.right - (defaultWidths[1] + defaultWidths[2]);
137 parts[1] = rcStatusBar.right - defaultWidths[2];
138 parts[2] = -1; // the right edge of the status bar
139
140 parts[0] = max(parts[0], defaultWidths[0]);
141 parts[1] = max(parts[1], defaultWidths[0] + defaultWidths[1]);
142
144}
static const D3D_BLOB_PART parts[]
Definition: blob.c:76
#define SB_SETPARTS
Definition: commctrl.h:1954
#define max(a, b)
Definition: svc.c:63
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DoCreateStatusBar(), and NOTEPAD_WndProc().

◆ DIALOG_StatusBarUpdateCaretPos()

VOID DIALOG_StatusBarUpdateCaretPos ( VOID  )

Definition at line 1261 of file dialog.c.

1262{
1263 int line, col;
1265 DWORD dwStart, dwSize;
1266
1267 SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwSize);
1268 line = SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)dwStart, 0);
1269 col = dwStart - SendMessage(Globals.hEdit, EM_LINEINDEX, (WPARAM)line, 0);
1270
1271 _stprintf(buff, Globals.szStatusBarLineCol, line + 1, col + 1);
1273}
#define SBPART_CURPOS
Definition: dialog.c:37
static unsigned char buff[32768]
Definition: fatten.c:17
#define _stprintf
Definition: utility.h:124
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define SB_SETTEXT
Definition: commctrl.h:1949
Definition: parser.c:49
#define EM_LINEFROMCHAR
Definition: winuser.h:1991
#define EM_LINEINDEX
Definition: winuser.h:1992

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

◆ DIALOG_StringMsgBox()

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

Definition at line 167 of file dialog.c.

168{
169 TCHAR szMessage[MAX_STRING_LEN];
170 TCHAR szResource[MAX_STRING_LEN];
171
172 /* Load and format szMessage */
173 LoadString(Globals.hInstance, formatId, szResource, ARRAY_SIZE(szResource));
174 _sntprintf(szMessage, ARRAY_SIZE(szMessage), szResource, szString);
175
176 /* Load szCaption */
178 LoadString(Globals.hInstance, STRING_ERROR, szResource, ARRAY_SIZE(szResource));
179 else
180 LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, ARRAY_SIZE(szResource));
181
182 /* Display Modal Dialog */
183 // if (hParent == NULL)
184 // hParent = Globals.hMainWnd;
185 return MessageBox(hParent, szMessage, szResource, dwFlags);
186}
#define STRING_ERROR
Definition: notepad_res.h:76
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define MB_ICONMASK
Definition: winuser.h:813
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define MessageBox
Definition: winuser.h:5812
#define _sntprintf
Definition: xmlstorage.h:201

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

◆ DIALOG_TimeDate()

VOID DIALOG_TimeDate ( VOID  )

◆ DIALOG_ViewStatusBar()

VOID DIALOG_ViewStatusBar ( VOID  )

Definition at line 1275 of file dialog.c.

1276{
1277 Globals.bShowStatusBar = !Globals.bShowStatusBar;
1278
1280}
VOID DoCreateStatusBar(VOID)
Definition: dialog.c:915

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 388 of file dialog.c.

389{
390 int nResult;
391
392 if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
393 {
394 /* prompt user to save changes */
395 nResult = AlertFileNotSaved(Globals.szFileName);
396 switch (nResult)
397 {
398 case IDYES:
399 if(!DIALOG_FileSave())
400 return FALSE;
401 break;
402
403 case IDNO:
404 break;
405
406 case IDCANCEL:
407 return FALSE;
408
409 default:
410 return FALSE;
411 }
412 }
413
416
417 return TRUE;
418}
static int AlertFileNotSaved(LPCTSTR szFileName)
Definition: dialog.c:193
BOOL DIALOG_FileSave(VOID)
Definition: dialog.c:522
#define EM_GETMODIFY
Definition: winuser.h:1984
#define IDNO
Definition: winuser.h:830
#define IDYES
Definition: winuser.h:829

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

◆ DoCreateEditWindow()

VOID DoCreateEditWindow ( VOID  )

Definition at line 997 of file dialog.c.

998{
999 DWORD dwStyle;
1000 int iSize;
1001 LPTSTR pTemp = NULL;
1002 BOOL bModified = FALSE;
1003
1004 iSize = 0;
1005
1006 /* If the edit control already exists, try to save its content */
1007 if (Globals.hEdit != NULL)
1008 {
1009 /* number of chars currently written into the editor. */
1010 iSize = GetWindowTextLength(Globals.hEdit);
1011 if (iSize)
1012 {
1013 /* Allocates temporary buffer. */
1014 pTemp = HeapAlloc(GetProcessHeap(), 0, (iSize + 1) * sizeof(TCHAR));
1015 if (!pTemp)
1016 {
1017 ShowLastError();
1018 return;
1019 }
1020
1021 /* Recover the text into the control. */
1022 GetWindowText(Globals.hEdit, pTemp, iSize + 1);
1023
1024 if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
1025 bModified = TRUE;
1026 }
1027
1028 /* Restore original window procedure */
1030
1031 /* Destroy the edit control */
1032 DestroyWindow(Globals.hEdit);
1033 }
1034
1035 /* Update wrap status into the main menu and recover style flags */
1036 if (Globals.bWrapLongLines)
1037 {
1038 dwStyle = EDIT_STYLE_WRAP;
1040 } else {
1041 dwStyle = EDIT_STYLE;
1043 }
1044
1045 /* Update previous changes */
1047
1048 /* Create the new edit control */
1050 EDIT_CLASS,
1051 NULL,
1052 dwStyle,
1058 NULL,
1060 NULL);
1061
1062 if (Globals.hEdit == NULL)
1063 {
1064 if (pTemp)
1065 {
1066 HeapFree(GetProcessHeap(), 0, pTemp);
1067 }
1068
1069 ShowLastError();
1070 return;
1071 }
1072
1074 SendMessage(Globals.hEdit, EM_LIMITTEXT, 0, 0);
1075
1076 /* If some text was previously saved, restore it. */
1077 if (iSize != 0)
1078 {
1079 SetWindowText(Globals.hEdit, pTemp);
1080 HeapFree(GetProcessHeap(), 0, pTemp);
1081
1082 if (bModified)
1084 }
1085
1086 /* Sub-class a new window callback for row/column detection. */
1087 Globals.EditProc = (WNDPROC)SetWindowLongPtr(Globals.hEdit,
1090
1091 /* Create/update status bar */
1093
1094 /* Finally shows new edit control and set focus into it. */
1095 ShowWindow(Globals.hEdit, SW_SHOW);
1096 SetFocus(Globals.hEdit);
1097}
LRESULT CALLBACK EDIT_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.c:310
#define EDIT_STYLE
Definition: main.h:30
#define EDIT_STYLE_WRAP
Definition: main.h:28
#define EDIT_CLASS
Definition: main.h:32
unsigned int BOOL
Definition: ntddk_ex.h:94
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define CMD_STATUSBAR
Definition: notepad_res.h:61
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
#define CreateWindowEx
Definition: winuser.h:5745
#define EM_LIMITTEXT
Definition: winuser.h:1990
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:769
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_SETMODIFY
Definition: winuser.h:2003

Referenced by _tWinMain(), and DIALOG_EditWrap().

◆ DoCreateStatusBar()

VOID DoCreateStatusBar ( VOID  )

Definition at line 915 of file dialog.c.

916{
917 RECT rc;
918 RECT rcstatus;
919 BOOL bStatusBarVisible;
920
921 /* Check if status bar object already exists. */
922 if (Globals.hStatusBar == NULL)
923 {
924 /* Try to create the status bar */
926 NULL,
929
930 if (Globals.hStatusBar == NULL)
931 {
933 return;
934 }
935
936 /* Load the string for formatting column/row text output */
938 }
939
940 /* Set status bar visiblity according to the settings. */
941 if ((Globals.bWrapLongLines != FALSE) || (Globals.bShowStatusBar == FALSE))
942 {
943 bStatusBarVisible = FALSE;
944 ShowWindow(Globals.hStatusBar, SW_HIDE);
945 }
946 else
947 {
948 bStatusBarVisible = TRUE;
949 ShowWindow(Globals.hStatusBar, SW_SHOW);
950 SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
951 }
952
953 /* Set check state in show status bar item. */
954 if (bStatusBarVisible)
955 {
957 }
958 else
959 {
961 }
962
963 /* Update menu mar with the previous changes */
965
966 /* Sefety test is edit control exists */
967 if (Globals.hEdit != NULL)
968 {
969 /* Retrieve the sizes of the controls */
971 GetClientRect(Globals.hStatusBar, &rcstatus);
972
973 /* If status bar is currently visible, update dimensions of edit control */
974 if (bStatusBarVisible)
975 rc.bottom -= (rcstatus.bottom - rcstatus.top);
976
977 /* Resize edit control to right size. */
978 MoveWindow(Globals.hEdit,
979 rc.left,
980 rc.top,
981 rc.right - rc.left,
982 rc.bottom - rc.top,
983 TRUE);
984 }
985
986 /* Set the status bar for multiple-text output */
988
989 /* Update content with current row/column text */
991
992 /* Update line endings and encoding on the status bar */
995}
VOID DIALOG_StatusBarAlignParts(VOID)
Definition: dialog.c:128
VOID DIALOG_StatusBarUpdateCaretPos(VOID)
Definition: dialog.c:1261
#define CMD_STATUSBAR_WND_ID
Definition: notepad_res.h:62
#define STRING_LINE_COLUMN
Definition: notepad_res.h:101
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define CreateStatusWindow
Definition: commctrl.h:1933
#define CCS_BOTTOM
Definition: commctrl.h:2244
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
#define SW_HIDE
Definition: winuser.h:762
#define WM_SIZE
Definition: winuser.h:1601
#define MF_CHECKED
Definition: winuser.h:132
#define MF_UNCHECKED
Definition: winuser.h:204
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by DIALOG_ViewStatusBar(), and DoCreateEditWindow().

◆ DoOpenFile()

VOID DoOpenFile ( LPCTSTR  szFileName)

Definition at line 420 of file dialog.c.

421{
423 TCHAR log[5];
424 HLOCAL hLocal;
425
426 /* Close any files and prompt to save changes */
427 if (!DoCloseFile())
428 return;
429
433 {
435 goto done;
436 }
437
438 /* To make loading file quicker, we use the internal handle of EDIT control */
439 hLocal = (HLOCAL)SendMessageW(Globals.hEdit, EM_GETHANDLE, 0, 0);
440 if (!ReadText(hFile, &hLocal, &Globals.encFile, &Globals.iEoln))
441 {
443 goto done;
444 }
445 SendMessageW(Globals.hEdit, EM_SETHANDLE, (WPARAM)hLocal, 0);
446 /* No need of EM_SETMODIFY and EM_EMPTYUNDOBUFFER here. EM_SETHANDLE does instead. */
447
448 SetFocus(Globals.hEdit);
449
450 /* If the file starts with .LOG, add a time/date at the end and set cursor after
451 * See http://web.archive.org/web/20090627165105/http://support.microsoft.com/kb/260563
452 */
453 if (GetWindowText(Globals.hEdit, log, ARRAY_SIZE(log)) && !_tcscmp(log, _T(".LOG")))
454 {
455 static const TCHAR lf[] = _T("\r\n");
460 }
461
462 SetFileName(szFileName);
465
466 /* Update line endings and encoding on the status bar */
469
470done:
473}
VOID DIALOG_EditTimeDate(VOID)
Definition: dialog.c:899
BOOL ReadText(HANDLE hFile, HLOCAL *phLocal, ENCODING *pencFile, EOLN *piEoln)
Definition: text.c:166
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
#define _tcscmp
Definition: tchar.h:1424
#define OPEN_ALWAYS
Definition: disk.h:70
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define log(outFile, fmt,...)
Definition: util.h:15
#define CreateFile
Definition: winbase.h:3620
HANDLE HLOCAL
Definition: windef.h:244
#define EM_GETHANDLE
Definition: winuser.h:1979
#define EM_SETHANDLE
Definition: winuser.h:1999

Referenced by DIALOG_FileOpen().

◆ FileExists()

BOOL FileExists ( LPCTSTR  szFilename)

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

Definition at line 220 of file dialog.c.

221{
224
225 hFile = FindFirstFile(szFilename, &entry);
227
228 return (hFile != INVALID_HANDLE_VALUE);
229}
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
uint32_t entry
Definition: isohybrid.c:63
#define FindFirstFile
Definition: winbase.h:3653

Referenced by DIALOG_FileOpen(), and HandleCommandLine().

◆ HasFileExtension()

BOOL HasFileExtension ( LPCTSTR  szFilename)

Definition at line 231 of file dialog.c.

232{
233 LPCTSTR s;
234
235 s = _tcsrchr(szFilename, _T('\\'));
236 if (s)
237 szFilename = s;
238 return _tcsrchr(szFilename, _T('.')) != NULL;
239}
GLdouble s
Definition: gl.h:2039
#define _tcsrchr
Definition: utility.h:116
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Referenced by HandleCommandLine().

◆ ShowLastError()

VOID ShowLastError ( VOID  )

Definition at line 59 of file dialog.c.

60{
62 if (error != NO_ERROR)
63 {
64 LPTSTR lpMsgBuf = NULL;
66
68
70 NULL,
71 error,
72 0,
73 (LPTSTR) &lpMsgBuf,
74 0,
75 NULL);
76
78 LocalFree(lpMsgBuf);
79 }
80}
#define NO_ERROR
Definition: dderror.h:5
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define error(str)
Definition: mkdosfs.c:1605
#define FormatMessage
Definition: winbase.h:3666
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define MB_ICONERROR
Definition: winuser.h:781
#define MB_OK
Definition: winuser.h:784

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