[REACTOS] Fix misc 64 bit issues (#783)
[reactos.git] / base / applications / notepad / main.h
1 /*
2 * Notepad (notepad.h)
3 *
4 * Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
5 * Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #pragma once
23
24 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
25
26 #include "notepad_res.h"
27
28 #define EDIT_STYLE_WRAP (WS_CHILD | WS_VSCROLL \
29 | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL)
30 #define EDIT_STYLE (EDIT_STYLE_WRAP | WS_HSCROLL | ES_AUTOHSCROLL)
31
32 #define EDIT_CLASS _T("EDIT")
33
34 #define MAX_STRING_LEN 255
35
36 /* Values are indexes of the items in the Encoding combobox. */
37 typedef enum
38 {
39 ENCODING_AUTO = -1,
40 ENCODING_ANSI = 0,
41 ENCODING_UTF16LE = 1,
42 ENCODING_UTF16BE = 2,
43 ENCODING_UTF8 = 3
44 } ENCODING;
45
46 // #define MIN_ENCODING 0
47 // #define MAX_ENCODING 3
48
49 #define EOLN_CRLF 0
50 #define EOLN_LF 1
51 #define EOLN_CR 2
52
53 typedef struct
54 {
55 HINSTANCE hInstance;
56 HWND hMainWnd;
57 HWND hFindReplaceDlg;
58 HWND hEdit;
59 HWND hStatusBar;
60 HFONT hFont; /* Font used by the edit control */
61 HMENU hMenu;
62 HGLOBAL hDevMode;
63 HGLOBAL hDevNames;
64 LOGFONT lfFont;
65 BOOL bWrapLongLines;
66 BOOL bShowStatusBar;
67 TCHAR szFindText[MAX_PATH];
68 TCHAR szReplaceText[MAX_PATH];
69 TCHAR szFileName[MAX_PATH];
70 TCHAR szFileTitle[MAX_PATH];
71 TCHAR szFilter[2 * MAX_STRING_LEN + 100];
72 RECT lMargins;
73 TCHAR szHeader[MAX_PATH];
74 TCHAR szFooter[MAX_PATH];
75 TCHAR szStatusBarLineCol[MAX_PATH];
76
77 ENCODING encFile;
78 int iEoln;
79
80 FINDREPLACE find;
81 WNDPROC EditProc;
82 RECT main_rect;
83 } NOTEPAD_GLOBALS;
84
85 extern NOTEPAD_GLOBALS Globals;
86
87 VOID SetFileName(LPCTSTR szFileName);
88
89 /* from text.c */
90 BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, int *piEoln);
91 BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile, int iEoln);
92
93 /* from settings.c */
94 void NOTEPAD_LoadSettingsFromRegistry(void);
95 void NOTEPAD_SaveSettingsToRegistry(void);
96
97 /* from main.c */
98 BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL );
99 VOID NOTEPAD_EnableSearchMenu(VOID);