https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f91b92c3f9277b2d0bc1c…
commit f91b92c3f9277b2d0bc1ca7f93a0808a48304635
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Mar 9 03:41:11 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Mar 9 03:41:11 2023 +0900
[NOTEPAD] Delete main.h (#5133)
Reduce files to improve readability. Move the codes in main.h into notepad.h. Make the
size of Globals.szFilter 512.
CORE-18837
---
base/applications/notepad/dialog.h | 1 +
base/applications/notepad/main.h | 103 ------------------------------------
base/applications/notepad/notepad.h | 93 +++++++++++++++++++++++++++++---
3 files changed, 86 insertions(+), 111 deletions(-)
diff --git a/base/applications/notepad/dialog.h b/base/applications/notepad/dialog.h
index 5ebe3b227b2..43b70b4fa12 100644
--- a/base/applications/notepad/dialog.h
+++ b/base/applications/notepad/dialog.h
@@ -69,3 +69,4 @@ BOOL DoCloseFile(VOID);
VOID DoOpenFile(LPCTSTR szFileName);
VOID DoShowHideStatusBar(VOID);
VOID DoCreateEditWindow(VOID);
+void UpdateWindowCaption(BOOL clearModifyAlert);
diff --git a/base/applications/notepad/main.h b/base/applications/notepad/main.h
deleted file mode 100644
index a1ecae7e641..00000000000
--- a/base/applications/notepad/main.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Notepad (notepad.h)
- *
- * Copyright 1997,98 Marcel Baur <mbaur(a)g26.ethz.ch>
- * Copyright 2002 Sylvain Petreolle <spetreolle(a)yahoo.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#pragma once
-
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
-
-#include "notepad_res.h"
-
-#define EDIT_STYLE_WRAP (WS_CHILD | WS_VSCROLL \
- | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL)
-#define EDIT_STYLE (EDIT_STYLE_WRAP | WS_HSCROLL | ES_AUTOHSCROLL)
-
-#define EDIT_CLASS _T("EDIT")
-
-#define MAX_STRING_LEN 255
-
-/* Values are indexes of the items in the Encoding combobox. */
-typedef enum
-{
- ENCODING_AUTO = -1,
- ENCODING_ANSI = 0,
- ENCODING_UTF16LE = 1,
- ENCODING_UTF16BE = 2,
- ENCODING_UTF8 = 3,
- ENCODING_UTF8BOM = 4
-} ENCODING;
-
-#define ENCODING_DEFAULT ENCODING_UTF8 // ENCODING_ANSI
-
-typedef enum
-{
- EOLN_CRLF = 0, /* "\r\n" */
- EOLN_LF = 1, /* "\n" */
- EOLN_CR = 2 /* "\r" */
-} EOLN; /* End of line (NewLine) type */
-
-typedef struct
-{
- HINSTANCE hInstance;
- HWND hMainWnd;
- HWND hFindReplaceDlg;
- HWND hEdit;
- HWND hStatusBar;
- HFONT hFont; /* Font used by the edit control */
- HMENU hMenu;
- HGLOBAL hDevMode;
- HGLOBAL hDevNames;
- LOGFONT lfFont;
- BOOL bWrapLongLines;
- BOOL bShowStatusBar;
- TCHAR szFindText[MAX_PATH];
- TCHAR szReplaceText[MAX_PATH];
- TCHAR szFileName[MAX_PATH];
- TCHAR szFileTitle[MAX_PATH];
- TCHAR szFilter[2 * MAX_STRING_LEN + 100];
- RECT lMargins;
- TCHAR szHeader[MAX_PATH];
- TCHAR szFooter[MAX_PATH];
- TCHAR szStatusBarLineCol[MAX_PATH];
-
- ENCODING encFile;
- EOLN iEoln;
-
- FINDREPLACE find;
- WNDPROC EditProc;
- RECT main_rect;
- BOOL bWasModified;
-} NOTEPAD_GLOBALS;
-
-extern NOTEPAD_GLOBALS Globals;
-
-VOID SetFileName(LPCTSTR szFileName);
-
-/* from text.c */
-BOOL ReadText(HANDLE hFile, HLOCAL *phLocal, ENCODING *pencFile, EOLN *piEoln);
-BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, EOLN
iEoln);
-
-/* from settings.c */
-void NOTEPAD_LoadSettingsFromRegistry(void);
-void NOTEPAD_SaveSettingsToRegistry(void);
-
-/* from main.c */
-BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert);
-VOID NOTEPAD_EnableSearchMenu(VOID);
diff --git a/base/applications/notepad/notepad.h b/base/applications/notepad/notepad.h
index 2817acb58b4..af329f24dd6 100644
--- a/base/applications/notepad/notepad.h
+++ b/base/applications/notepad/notepad.h
@@ -1,12 +1,20 @@
-#ifndef _NOTEPAD_H
-#define _NOTEPAD_H
+/*
+ * PROJECT: ReactOS Notepad
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: Providing a Windows-compatible simple text editor for ReactOS
+ * COPYRIGHT: Copyright 1997,98 Marcel Baur <mbaur(a)g26.ethz.ch>
+ * Copyright 2002 Sylvain Petreolle <spetreolle(a)yahoo.fr>
+ * Copyright 2002 Andriy Palamarchuk
+ * Copyright 2000 Mike McCormack <Mike_McCormack(a)looksmart.com.au>
+ * Copyright 2020-2023 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
+ */
+
+#pragma once
#ifndef STRSAFE_NO_DEPRECATE
-#define STRSAFE_NO_DEPRECATE
+ #define STRSAFE_NO_DEPRECATE
#endif
-#include <stdarg.h>
-
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
@@ -17,9 +25,78 @@
#include <tchar.h>
#include <malloc.h>
-#include "main.h"
#include "dialog.h"
+#include "notepad_res.h"
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+#define EDIT_STYLE_WRAP (WS_CHILD | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE |
ES_NOHIDESEL)
+#define EDIT_STYLE (EDIT_STYLE_WRAP | WS_HSCROLL | ES_AUTOHSCROLL)
+#define EDIT_CLASS _T("EDIT")
+
+#define MAX_STRING_LEN 255
+
+/* Values are indexes of the items in the Encoding combobox. */
+typedef enum
+{
+ ENCODING_AUTO = -1,
+ ENCODING_ANSI = 0,
+ ENCODING_UTF16LE = 1,
+ ENCODING_UTF16BE = 2,
+ ENCODING_UTF8 = 3,
+ ENCODING_UTF8BOM = 4
+} ENCODING;
+
+#define ENCODING_DEFAULT ENCODING_UTF8 // ENCODING_ANSI
+
+typedef enum
+{
+ EOLN_CRLF = 0, /* "\r\n" */
+ EOLN_LF = 1, /* "\n" */
+ EOLN_CR = 2 /* "\r" */
+} EOLN; /* End of line (NewLine) type */
+
+typedef struct
+{
+ HINSTANCE hInstance;
+ HWND hMainWnd;
+ HWND hFindReplaceDlg;
+ HWND hEdit;
+ HWND hStatusBar;
+ HFONT hFont; /* Font used by the edit control */
+ HMENU hMenu;
+ HGLOBAL hDevMode;
+ HGLOBAL hDevNames;
+ LOGFONT lfFont;
+ BOOL bWrapLongLines;
+ BOOL bShowStatusBar;
+ TCHAR szFindText[MAX_PATH];
+ TCHAR szReplaceText[MAX_PATH];
+ TCHAR szFileName[MAX_PATH];
+ TCHAR szFileTitle[MAX_PATH];
+ TCHAR szFilter[512];
+ RECT lMargins; /* The margin values in 100th millimeters */
+ TCHAR szHeader[MAX_PATH];
+ TCHAR szFooter[MAX_PATH];
+ TCHAR szStatusBarLineCol[MAX_PATH];
+
+ ENCODING encFile;
+ EOLN iEoln;
+
+ FINDREPLACE find;
+ WNDPROC EditProc;
+ RECT main_rect;
+ BOOL bWasModified;
+} NOTEPAD_GLOBALS;
+
+extern NOTEPAD_GLOBALS Globals;
+
+BOOL ReadText(HANDLE hFile, HLOCAL *phLocal, ENCODING *pencFile, EOLN *piEoln);
+BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, EOLN
iEoln);
-void UpdateWindowCaption(BOOL clearModifyAlert);
+void NOTEPAD_LoadSettingsFromRegistry(void);
+void NOTEPAD_SaveSettingsToRegistry(void);
-#endif /* _NOTEPAD_H */
+BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert);
+VOID NOTEPAD_EnableSearchMenu(VOID);
+VOID SetFileName(LPCTSTR szFileName);