Sync with trunk r63192.
[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 SIZEOF(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 #define ENCODING_ANSI 0
37 #define ENCODING_UNICODE 1
38 #define ENCODING_UNICODE_BE 2
39 #define ENCODING_UTF8 3
40
41 #define EOLN_CRLF 0
42 #define EOLN_LF 1
43 #define EOLN_CR 2
44
45 typedef struct
46 {
47 HINSTANCE hInstance;
48 HWND hMainWnd;
49 HWND hFindReplaceDlg;
50 HWND hEdit;
51 HWND hStatusBar;
52 HFONT hFont; /* Font used by the edit control */
53 HMENU hMenu;
54 LOGFONT lfFont;
55 BOOL bWrapLongLines;
56 BOOL bShowStatusBar;
57 TCHAR szFindText[MAX_PATH];
58 TCHAR szReplaceText[MAX_PATH];
59 TCHAR szFileName[MAX_PATH];
60 TCHAR szFileTitle[MAX_PATH];
61 TCHAR szFilter[2 * MAX_STRING_LEN + 100];
62 TCHAR szMarginTop[MAX_PATH];
63 TCHAR szMarginBottom[MAX_PATH];
64 TCHAR szMarginLeft[MAX_PATH];
65 TCHAR szMarginRight[MAX_PATH];
66 TCHAR szHeader[MAX_PATH];
67 TCHAR szFooter[MAX_PATH];
68 TCHAR szStatusBarLineCol[MAX_PATH];
69 int iEncoding;
70 int iEoln;
71
72 FINDREPLACE find;
73 WNDPROC EditProc;
74 RECT main_rect;
75 } NOTEPAD_GLOBALS;
76
77 extern NOTEPAD_GLOBALS Globals;
78
79 VOID SetFileName(LPCTSTR szFileName);
80
81 /* from text.c */
82 BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int *piEoln);
83 BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding, int iEoln);
84
85 /* from settings.c */
86 void LoadSettings(void);
87 void SaveSettings(void);
88
89 /* from main.c */
90 BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL );
91 VOID NOTEPAD_EnableSearchMenu(VOID);