1 /* 2 * PROJECT: ReactOS Notepad 3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) 4 * PURPOSE: Providing a Windows-compatible simple text editor for ReactOS 5 * COPYRIGHT: Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch> 6 * Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr> 7 * Copyright 2002 Andriy Palamarchuk 8 * Copyright 2000 Mike McCormack <Mike_McCormack@looksmart.com.au> 9 * Copyright 2020-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 10 */ 11 12 #pragma once 13 14 #ifndef STRSAFE_NO_DEPRECATE 15 #define STRSAFE_NO_DEPRECATE 16 #endif 17 18 #include <windef.h> 19 #include <winbase.h> 20 #include <winuser.h> 21 #include <winnls.h> 22 #include <wingdi.h> 23 #include <shellapi.h> 24 #include <commdlg.h> 25 #include <tchar.h> 26 #include <stdlib.h> 27 #include <malloc.h> 28 29 #include "dialog.h" 30 #include "notepad_res.h" 31 32 #define EDIT_STYLE_WRAP (WS_CHILD | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL) 33 #define EDIT_STYLE (EDIT_STYLE_WRAP | WS_HSCROLL | ES_AUTOHSCROLL) 34 #define EDIT_CLASS _T("EDIT") 35 36 #define MAX_STRING_LEN 255 37 38 /* Values are indexes of the items in the Encoding combobox. */ 39 typedef enum 40 { 41 ENCODING_AUTO = -1, 42 ENCODING_ANSI = 0, 43 ENCODING_UTF16LE = 1, 44 ENCODING_UTF16BE = 2, 45 ENCODING_UTF8 = 3, 46 ENCODING_UTF8BOM = 4 47 } ENCODING; 48 49 #define ENCODING_DEFAULT ENCODING_UTF8 // ENCODING_ANSI 50 51 typedef enum 52 { 53 EOLN_CRLF = 0, /* "\r\n" */ 54 EOLN_LF = 1, /* "\n" */ 55 EOLN_CR = 2 /* "\r" */ 56 } EOLN; /* End of line (NewLine) type */ 57 58 typedef struct 59 { 60 HINSTANCE hInstance; 61 HWND hMainWnd; 62 HWND hFindReplaceDlg; 63 HWND hEdit; 64 HWND hStatusBar; 65 HFONT hFont; /* Font used by the edit control */ 66 HMENU hMenu; 67 HGLOBAL hDevMode; 68 HGLOBAL hDevNames; 69 LOGFONT lfFont; 70 BOOL bWrapLongLines; 71 BOOL bShowStatusBar; 72 TCHAR szFindText[MAX_PATH]; 73 TCHAR szReplaceText[MAX_PATH]; 74 TCHAR szFileName[MAX_PATH]; 75 TCHAR szFileTitle[MAX_PATH]; 76 TCHAR szFilter[512]; 77 RECT lMargins; /* The margin values in 100th millimeters */ 78 TCHAR szHeader[MAX_PATH]; 79 TCHAR szFooter[MAX_PATH]; 80 TCHAR szStatusBarLineCol[MAX_PATH]; 81 82 ENCODING encFile; 83 EOLN iEoln; 84 85 FINDREPLACE find; 86 WNDPROC EditProc; 87 BOOL bWasModified; 88 } NOTEPAD_GLOBALS; 89 90 extern NOTEPAD_GLOBALS Globals; 91 92 BOOL ReadText(HANDLE hFile, HLOCAL *phLocal, ENCODING *pencFile, EOLN *piEoln); 93 BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, EOLN iEoln); 94 95 void NOTEPAD_LoadSettingsFromRegistry(PWINDOWPLACEMENT pWP); 96 void NOTEPAD_SaveSettingsToRegistry(void); 97 98 BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert); 99 VOID NOTEPAD_EnableSearchMenu(VOID); 100 VOID SetFileName(LPCTSTR szFileName); 101