forked from FlatGlobus/WTLBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainFrm.h
320 lines (298 loc) · 13.5 KB
/
MainFrm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
// Copyright (C) FlatGlobus([email protected]) All rights reserved.
//
// This file is a part of the WTLBuilder.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file MS-PL.txt at the root folder.
#pragma once
#include "Package\Package.h"
#include "SDK\Property\register.h"
#include "SDK\Property\Component.h"
#include "ToolPanel.h"
#include "CToolBoxWnd.h"
#include "Project.h"
#include "ScriptHandler.h"
#include "OutputWindow.h"
#include "atldispa.h"
#include "ValueListHelper.h"
#include<LayoutMgr.h>
#include <atlscrl.h>
//{{WTLBUILDER_INCLUDE_DECLARATION
#include "resource.h"
#include "ButtonST.h"
//}}WTLBUILDER_INCLUDE_DECLARATION
//{{WTLBUILDER_CONTROL_ID_DECLARATION
#define IDC_PANEL 1001
#define IDC_PANEL1 1041
#define IDC_TOOLTAB 1000
#define IDC_ALIGN_LEFT 1003
#define IDC_ALIGN_RIGHT 1004
#define IDC_ALIGN_TOP 1005
#define IDC_ALIGN_BOTTOM 1006
#define IDC_CMAINFRAME_PANEL7 1007
#define IDC_SAME_WIDTH 1008
#define IDC_CMAINFRAME_EDIT10 1010
#define IDC_CMAINFRAME_UPDOWNCTRL11 1011
#define IDC_SAME_HEIGHT 1012
#define IDC_CMAINFRAME_PANEL13 1013
#define IDC_SAME_SIZE 1014
#define IDC_GS_HORIZ 1015
#define IDC_GS_VERT 1016
#define IDC_CMAINFRAME_PANEL17 1017
#define IDC_CENTER_HORIZ 1018
#define IDC_CENTER_VERT 1019
#define IDC_HORIZ_ORDER 1021
#define IDC_VERT_ORDER 1022
#define IDC_CMAINFRAME_PANEL28 1028
#define IDC_TOPARENT 1029
#define IDC_CMAINFRAME_PANEL30 1030
#define IDC_CREATION_ORDER 1033
#define IDC_CENTER_GROUP_HORIZ 1037
#define IDC_CENTER_GROUP_VERT 1038
#define IDC_SHOW_GRID 1048
#define IDC_CMAINFRAME_STATIC49 1049
#define IDC_XEDIT 1050
#define IDC_CMAINFRAME_UPDOWNCTRL51 1051
#define IDC_CMAINFRAME_STATIC52 1052
#define IDC_YEDIT 1053
#define IDC_CMAINFRAME_PANEL55 1055
#define IDC_SHOW_GSGRID 1056
#define IDC_CMAINFRAME_UPDOWNCTRL57 1057
#define IDC_CHANGEPARENT 1058
#define IDC_TABORDER 1059
#define IDC_HORIZ_ORDER_RIGHT 1060
#define IDC_VERT_ORDER_BOTTOM 1061
#define IDC_CMAINFRAME_STATIC62 1062
#define IDC_XCURSOR 1063
#define IDC_STATICY 1064
#define IDC_YCURSOR 1065
//}}WTLBUILDER_CONTROL_ID_DECLARATION
#define MIN_USER_MENU_ID 5000U
#define MAX_USER_MENU_ID 6000U
typedef CAtlMap<UINT, CString> CUserMenuMap;
//{{WTLBUILDER_WINDOW_STYLE
typedef CWinTraits<WS_OVERLAPPED|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX,WS_EX_WINDOWEDGE> CMainFrameWinTraits;
//}}WTLBUILDER_WINDOW_STYLE
class CMainFrame : public CFrameWindowImpl<CMainFrame, CWindow, CMainFrameWinTraits>,
public CScrollImpl<CMainFrame>,
public LayoutMgr<CMainFrame>,
public CUpdateUI<CMainFrame>,
public CMessageFilter,
public CIdleHandler,
protected Component,
public IDispDynImpl<CMainFrame>
{
CToolTipCtrl m_toolTip;
//{{WTLBUILDER_MEMBER_DECLARATION
CFont m_formFont;
Panel::CPanel m_panel;
Panel::CPanel m_panel1;
CToolTab m_toolTab;
CButtonST m_buttonst3;
CButtonST m_buttonst4;
CButtonST m_buttonst5;
CButtonST m_buttonst6;
Panel::CPanel m_panel7;
CButtonST m_buttonst8;
CEdit m_edit;
CUpDownCtrl m_updownctrl11;
CButtonST m_buttonst12;
Panel::CPanel m_panel13;
CButtonST m_buttonst14;
CButtonST m_buttonst15;
CButtonST m_buttonst16;
Panel::CPanel m_panel17;
CButtonST m_buttonst18;
CButtonST m_buttonst19;
CButtonST m_buttonst21;
CButtonST m_buttonst22;
CButtonST m_new;
CButtonST m_open;
CButtonST m_buttonst26;
CButtonST m_saveAll;
Panel::CPanel m_panel28;
CButtonST m_buttonst29;
Panel::CPanel m_panel30;
CButtonST m_buttonst33;
CButtonST m_buttonst37;
CButtonST m_buttonst38;
CButtonST m_showgrid;
CStatic m_static49;
CFont m_static49Font;
CEdit m_xedit;
CUpDownCtrl m_updownctrl51;
CStatic m_static52;
CFont m_static52Font;
CEdit m_yedit;
Panel::CPanel m_panel55;
CButtonST m_buttonst56;
CUpDownCtrl m_updownctrl57;
CButtonST m_buttonst58;
CButtonST m_tabOrder;
CButtonST m_buttonst60;
CButtonST m_buttonst61;
CStatic m_static62;
CFont m_static62Font;
CStatic m_XCursor;
CStatic m_static64;
CFont m_static64Font;
CStatic m_YCursor;
//}}WTLBUILDER_MEMBER_DECLARATION
CUserMenuMap userMenuMap;
UINT userMenuCount;
CComObjectGlobal<CScriptHandler> m_ScriptHost;
long windowHeight;
BOOL enableUndo;
COutputWindow outputWindow;
CValueListHelper valueListHelper;
void FormSavedLoaded(Component *, LPCTSTR);
void InitLayout(void);
virtual void DefineLayout();
void SetGridButton(void *, BOOL);
void SetGridWidth(void *obj, long val);
void SetGridHeight(void *obj, long val);
void EnableUndo(BOOL);
void OnEditCommand(WORD wID, Component *comp, CPoint *);
void SetActiveForm(Component *form);
void LoadScriptFromFile(LPCSTR);
public:
virtual void GetDialogRect(LPRECT r);
virtual void GetOffset(LPPOINT offset);
virtual void DoPaint(CDCHandle /*dc*/);
static const UINT _controlsToClip[];
typedef CFrameWindowImpl<CMainFrame, CWindow, CMainFrameWinTraits> baseClass;
//{{WTLBUILDER_WINCLASS_DECLARATION
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
//}}WTLBUILDER_WINCLASS_DECLARATION
//CToolTipCtrl m_toolTip;
//CToolTab toolTab;
CToolBoxWnd toolBox;
CProject project;
//CCommandBarCtrl m_CmdBar;
//HWND hWndToolBar;
//HWND hWndAlignToolBar;
CRecentDocumentList mru;
CMainFrame(void);
~CMainFrame(void);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CMainFrame)
UPDATE_ELEMENT(ID_EDIT_UNDO, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_CUT, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_COPY, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_PASTE, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_SELECT_ALL, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_CLEAR, UPDUI_MENUPOPUP)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CMainFrame)
MESSAGE_HANDLER(WM_SIZE, LayoutMgr<CMainFrame>::OnSize)
MESSAGE_HANDLER(WM_ERASEBKGND, LayoutMgr<CMainFrame>::OnEraseBackground)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
COMMAND_ID_HANDLER(ID_FILE_NEW, OnFileNewForm)
COMMAND_ID_HANDLER(ID_FILE_NEW_CONTROL, OnFileNewControl)
COMMAND_ID_HANDLER(ID_FILE_OPEN, OnFileOpen)
COMMAND_ID_HANDLER(ID_FILE_SAVE, OnFileSave)
COMMAND_ID_HANDLER(ID_FILE_SAVE_AS, OnFileSaveAs)
COMMAND_ID_HANDLER(ID_FILE_SAVEALL, OnFileSaveAll)
COMMAND_ID_HANDLER(ID_FILE_CLOSE, OnFileClose)
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
COMMAND_ID_HANDLER(ID_FILE_SAVEAS_TEMPLATE, OnSaveAsTemplate)
COMMAND_ID_HANDLER(ID_FILE_GENERATE_LOC_FILE, OnGenerateLocFile)
COMMAND_ID_HANDLER(ID_OPTIONS_OPTIONS, OnOptions)
COMMAND_ID_HANDLER(IDC_ALIGN_LEFT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_ALIGN_RIGHT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_ALIGN_TOP, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_ALIGN_BOTTOM, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_SAME_WIDTH, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_SAME_HEIGHT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_SAME_SIZE, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_GS_HORIZ, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_GS_VERT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_CENTER_HORIZ, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_CENTER_VERT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_HORIZ_ORDER, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_VERT_ORDER, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_HORIZ_ORDER_RIGHT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_VERT_ORDER_BOTTOM, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_TOPARENT, OnAlignCommand)
//COMMAND_ID_HANDLER(IDC_TOBACKGROUND,OnAlignCommand)
//COMMAND_ID_HANDLER(IDC_TOFOREGROUND,OnAlignCommand)
COMMAND_ID_HANDLER(IDC_CENTER_GROUP_HORIZ, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_CENTER_GROUP_VERT, OnAlignCommand)
COMMAND_ID_HANDLER(IDC_CHANGEPARENT, OnAlignCommand)
COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEdit)
COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEdit)
COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEdit)
COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEdit)
COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEdit)
COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEdit)
COMMAND_ID_HANDLER(ID_VIEW_PROPERTY, OnView)
COMMAND_ID_HANDLER(ID_VIEW_OUTPUT, OnView)
COMMAND_ID_HANDLER(IDC_SHOW_GRID, OnShowGrid)
COMMAND_ID_HANDLER(IDC_TABORDER, OnTabOrder)
COMMAND_ID_HANDLER(ID_CTRL_BUILDER, OnCtrlBuilder)
COMMAND_RANGE_HANDLER(ID_FILE_MRU_FIRST, ID_FILE_MRU_LAST, OnFileRecent)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_INITMENUPOPUP, OnMenuSelect)
MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect)
MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect)
MESSAGE_HANDLER(WM_SELCHANGE, OnSelectComponent)
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
MESSAGE_HANDLER(WM_WININICHANGE, OnWinIniChange)
COMMAND_HANDLER(IDC_XEDIT, EN_CHANGE, OnXEditChange)
COMMAND_HANDLER(IDC_YEDIT, EN_CHANGE, OnYEditChange)
//for user menu
COMMAND_RANGE_HANDLER(MIN_USER_MENU_ID, MAX_USER_MENU_ID, OnUserMenu)
//
REFLECT_NOTIFICATIONS_EX()
CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFileNewForm(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFileNewControl(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCommonCommand(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnFileSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnFileSaveAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnFileSaveAs(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnFileClose(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
//LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnSaveAsTemplate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnGenerateLocFile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnAlignCommand(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOptions(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnWinIniChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnFileRecent(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnEdit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnView(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnShowGrid(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnXEditChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnYEditChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTabOrder(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCtrlBuilder(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnUserMenu(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
void AddMenu(const CMenuHandle * pMenuAdd, bool bTopLevel);
void FillToolPanel(LPCTSTR _name, LPCTSTR _page, HBITMAP _bitmap, int type);
LRESULT OnSelectComponent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
void ResetSelectedComponent(void);
virtual HANDLE GetHandle(void);
long CalcWindowSize();
void LoadFormFromFile(LPCSTR);
void XYCursor(CPoint);
////////////////////////////////
BEGIN_DISPATCH_MAP(CMainFrame)
DISP_METHOD(InsertPopupItem, VT_EMPTY, 2, VTS_BSTR VTS_BSTR)
DISP_METHOD(AppendItem, VT_EMPTY, 3, VTS_BSTR VTS_BSTR VTS_BSTR)
END_DISPATCH_MAP()
void __stdcall InsertPopupItem(BSTR after, BSTR popitem);
void __stdcall AppendItem(BSTR popup, BSTR item, BSTR scriptName);
};