1 #ifndef __WORDPAD_PRECOMP_H
2 #define __WORDPAD_PRECOMP_H
3 
4 //#define WIN32_LEAN_AND_MEAN
5 #include <windows.h>
6 #include <windowsx.h> /* GET_X/Y_LPARAM */
7 #include <stdio.h>
8 #include <tchar.h>
9 #include <richedit.h>
10 #include <commctrl.h>
11 #include "resource.h"
12 
13 /* FIXME - add to headers !!! */
14 #ifndef SB_SIMPLEID
15 #define SB_SIMPLEID 0xFF
16 #endif
17 
18 #define MAX_KEY_LENGTH 256
19 
20 #define DOC_TYPE_RICH_TEXT      0
21 #define DOC_TYPE_UNICODE_TEXT   1
22 #define DOC_TYPE_TEXT           2
23 
24 #ifdef _MSC_VER
25 #pragma warning(disable : 4100)
26 #endif
27 
28 /* generic definitions and forward declarations */
29 struct _MAIN_WND_INFO;
30 struct _EDIT_WND_INFO;
31 
32 typedef enum _MDI_EDITOR_TYPE {
33     metUnknown = 0,
34     metImageEditor,
35 } MDI_EDITOR_TYPE, *PMDI_EDITOR_TYPE;
36 
37 
38 /* wordpad.c */
39 extern HINSTANCE hInstance;
40 extern HANDLE ProcessHeap;
41 
42 
43 /* editwnd.c */
44 typedef struct _OPEN_EDIT_INFO
45 {
46     BOOL CreateNew;
47     union
48     {
49         UINT DocType;       /* new */
50         LPTSTR lpDocumentPath; /* open */
51     };
52     LPTSTR lpDocumentName;
53 
54 } OPEN_EDIT_INFO, *POPEN_EDIT_INFO;
55 
56 typedef struct _EDIT_WND_INFO
57 {
58     MDI_EDITOR_TYPE MdiEditorType; /* Must be first member! */
59 
60     HWND hSelf;
61     HWND hEdit;
62     struct _MAIN_WND_INFO *MainWnd;
63     struct _EDIT_WND_INFO *Next;
64     POINT ScrollPos;
65     USHORT Zoom;
66 
67     POPEN_EDIT_INFO OpenInfo; /* Only valid during initialization */
68 
69     LONG Width;
70     LONG Height;
71 
72 } EDIT_WND_INFO, *PEDIT_WND_INFO;
73 
74 BOOL InitEditWindowImpl(VOID);
75 VOID UninitEditWindowImpl(VOID);
76 BOOL CreateEditWindow(struct _MAIN_WND_INFO *MainWnd,
77                       POPEN_EDIT_INFO OpenInfo);
78 VOID SetEditorEnvironment(PEDIT_WND_INFO Info,
79                           BOOL Setup);
80 
81 
82 /* mainwnd.c */
83 typedef struct _MENU_HINT
84 {
85     WORD CmdId;
86     UINT HintId;
87 } MENU_HINT, *PMENU_HINT;
88 
89 typedef struct _MAIN_WND_INFO
90 {
91     HWND hSelf;
92     HWND hMdiClient;
93     HWND hStatus;
94     int nCmdShow;
95 
96     /* Editors */
97     PEDIT_WND_INFO ImageEditors;
98     UINT ImagesCreated;
99     PVOID ActiveEditor;
100 
101     /* status flags */
102     UINT InMenuLoop : 1;
103 } MAIN_WND_INFO, *PMAIN_WND_INFO;
104 
105 BOOL InitMainWindowImpl(VOID);
106 VOID UninitMainWindowImpl(VOID);
107 HWND CreateMainWindow(LPCTSTR lpCaption,
108                       int nCmdShow);
109 BOOL MainWndTranslateMDISysAccel(HWND hwnd,
110                                  LPMSG lpMsg);
111 VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info,
112                                 HWND hDeactivate,
113                                 HWND hActivate);
114 MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd,
115                                         PVOID *Info);
116 
117 
118 
119 /* misc.c */
120 INT AllocAndLoadString(OUT LPTSTR *lpTarget,
121                        IN HINSTANCE hInst,
122                        IN UINT uID);
123 
124 DWORD LoadAndFormatString(IN HINSTANCE hInstance,
125                           IN UINT uID,
126                           OUT LPTSTR *lpTarget,
127                           ...);
128 
129 BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
130                                   IN INT PartId,
131                                   IN HINSTANCE hInstance,
132                                   IN UINT uID,
133                                   ...);
134 
135 BOOL StatusBarLoadString(IN HWND hStatusBar,
136                          IN INT PartId,
137                          IN HINSTANCE hInstance,
138                          IN UINT uID);
139 
140 INT GetTextFromEdit(OUT LPTSTR lpString,
141                     IN HWND hDlg,
142                     IN UINT Res);
143 
144 VOID GetError(DWORD err);
145 
146 
147 /* opensave.c */
148 VOID FileInitialize(HWND hwnd);
149 BOOL DoOpenFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpName);
150 BOOL DoSaveFile(HWND hwnd);
151 
152 /* about.c */
153 INT_PTR CALLBACK
154 AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
155 
156 INT_PTR CALLBACK
157 NewDocSelDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
158 
159 
160 #endif /* __WORDPAD_PRECOMP_H */
161