-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormFrame.h
275 lines (249 loc) · 11.6 KB
/
FormFrame.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
// FormFrame.h: interface for the CFormFrame class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FORMFRAME_H__5EB2390C_5045_4995_A4DE_EC2BE9BEE3AE__INCLUDED_)
#define AFX_FORMFRAME_H__5EB2390C_5045_4995_A4DE_EC2BE9BEE3AE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#import "C:\Users\Fernando\source\repos\NO5TL sock clients\irc12\Redistributable\Unicode\DDForms.dll" raw_interfaces_only, raw_native_types, named_guids
class CExposedObjectInfo
{
public:
// name
CString m_Name;
// object
CComQIPtr<IDispatch> m_spDispatch;
};
class CPreviewDlg : \
public CAxDialogImpl<CPreviewDlg>,
public CMessageFilter
{
public:
enum { IDD = IDD_FORMVIEW2 };
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP(CPreviewDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_CLOSE,OnClose)
END_MSG_MAP()
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if(!m_bModeless)
EndDialog(IDOK);
else
DestroyWindow();
return 0;
}
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
CMessageLoop *p = _Module.GetMessageLoop();
p->RemoveMessageFilter(this);
return 0;
}
LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if(m_ax.IsWindow()){
m_ax.MoveWindow(0,0,LOWORD(lParam),HIWORD(lParam));
}
return 0;
}
CPreviewDlg(HWND hWndOwner,BOOL bModeless = TRUE);
virtual ~CPreviewDlg();
// this will be set TRUE if the preview should be auto sizing
BOOL m_AutoSizing;
// form file name
CString m_FileName;
// information about the objects which require exposing to the form viewer
CSimpleArray<CExposedObjectInfo> m_ExposedObjectInfoArray;
CComPtr<DDFORMSLib::IFormViewer2> m_spFormViewer;
CAxWindow m_ax;
const BOOL m_bModeless;
CWindow m_wndOwner;
};
typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_VISIBLE,0> CFFTraits;
typedef CDotNetTabCtrl<CTabViewTabItem> CFormTabCtrl;
class CFormFrame : \
public CTabbedFrameImpl<CFormFrame,CFormTabCtrl,CFrameWindowImpl<CFormFrame,CWindow, CFFTraits> >,
public CUpdateUI<CFormFrame>,
public CMessageFilter,
public IDispEventImpl<IDC_FORMEDITOR1, CFormFrame>
{
typedef CTabbedFrameImpl<CFormFrame,CFormTabCtrl,CFrameWindowImpl<CFormFrame,CWindow, CFFTraits> > baseClass;
public:
DECLARE_FRAME_WND_CLASS(_T("NO5IRCCLSFORM"), IDR_FORMFRAME)
CFormFrame(LPCTSTR file = NULL);
virtual ~CFormFrame();
virtual void OnFinalMessage(HWND /*hWnd*/)
{
delete this;
}
virtual BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_UPDATE_UI_MAP(CFormFrame)
UPDATE_ELEMENT(ID_VIEW_TOOLBAR, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_STATUS_BAR, 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_UNDO, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_REDO, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_DELETE, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_SELECT_ALL, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_UNSELECT_ALL, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
// etc ...
END_UPDATE_UI_MAP()
BEGIN_SINK_MAP(CFormFrame)
//Make sure the Event Handlers have __stdcall calling convention
SINK_ENTRY(IDC_FORMEDITOR1, 0x1, OnStateChanged)
SINK_ENTRY(IDC_FORMEDITOR1, 0x4, OnEditScriptError)
END_SINK_MAP()
HRESULT __stdcall OnStateChanged(VARIANT_BOOL Busy, VARIANT_BOOL Modified, VARIANT_BOOL CanPaste, VARIANT_BOOL CanUndo, VARIANT_BOOL CanRedo, LONG ItemCount, LONG SelectedItemCount);
HRESULT __stdcall OnEditScriptError(BSTR Source, long Number, BSTR description);
BEGIN_MSG_MAP(CFormFrame)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
//MESSAGE_HANDLER( (WM_USER + 1),OnModified)
MESSAGE_HANDLER(WM_FORMVIEW,OnDeleteViewer)
COMMAND_ID_HANDLER(ID_FILE_NEW,OnFileNew)
COMMAND_ID_HANDLER(ID_FILE_SAVE,OnFileSave)
COMMAND_ID_HANDLER(ID_FILE_SAVE_AS,OnFileSaveAs)
COMMAND_ID_HANDLER(ID_FILE_OPEN,OnFileOpen)
COMMAND_ID_HANDLER(ID_FRAME,OnAddFrame)
COMMAND_ID_HANDLER(ID_RECTANGLE,OnAddRect)
COMMAND_ID_HANDLER(ID_PICTURE,OnAddPicture)
COMMAND_ID_HANDLER(ID_LABEL,OnAddLabel)
COMMAND_ID_HANDLER(ID_BUTTON,OnAddButton)
COMMAND_ID_HANDLER(ID_CHECK,OnAddCheck)
COMMAND_ID_HANDLER(ID_RADIO,OnAddRadio)
COMMAND_ID_HANDLER(ID_TEXT,OnAddText)
COMMAND_ID_HANDLER(ID_COMBO,OnAddCombo)
COMMAND_ID_HANDLER(ID_LIST,OnAddList)
COMMAND_ID_HANDLER(ID_HSCROLL,OnAddHScroll)
COMMAND_ID_HANDLER(ID_VSCROLL,OnAddVScroll)
COMMAND_ID_HANDLER(ID_SPIN,OnAddSpin)
COMMAND_ID_HANDLER(ID_SLIDER,OnAddSlider)
COMMAND_ID_HANDLER(ID_PROGRESS,OnAddProgress)
COMMAND_ID_HANDLER(ID_ACTIVEX,OnAddActivex)
COMMAND_ID_HANDLER(ID_DELETE,OnDelete)
COMMAND_ID_HANDLER(ID_GRID,OnGrid)
COMMAND_ID_HANDLER(ID_GRID_SETTINGS,OnGridSettings)
COMMAND_ID_HANDLER(ID_TAB,OnTab)
COMMAND_ID_HANDLER(ID_SELECT_ALL,OnSelectAll)
COMMAND_ID_HANDLER(ID_UNSELECT_ALL,OnUnselectAll)
COMMAND_ID_HANDLER(ID_PROPERTIES,OnProperties)
//
COMMAND_RANGE_HANDLER(ID_LEFT,ID_DOWN,OnMoveCtl)
COMMAND_ID_HANDLER(ID_LAYOUT_SENDTOBACK,OnSendBack)
COMMAND_ID_HANDLER(ID_LAYOUT_BRINGTOFRONT,OnSendFront)
COMMAND_RANGE_HANDLER(ID_ALIGN_LEFT,ID_ALIGN_BOTTOM,OnAlignCtl)
COMMAND_RANGE_HANDLER(ID_SPACE_HORZ,ID_SPACE_VERT,OnSpaceCtl)
COMMAND_RANGE_HANDLER(ID_SIZE_LARGEST_WIDTH,ID_SIZE_SMALLEST,OnSizeCtl)
COMMAND_RANGE_HANDLER(ID_CENTER_HORZ,ID_CENTER,OnCenterCtl)
COMMAND_ID_HANDLER(ID_VALIDATE_SCRIPT,OnValidateScript)
COMMAND_ID_HANDLER(ID_PREVIEW_AUTO_SIZE,OnPreviewAuto)
COMMAND_ID_HANDLER(ID_PREVIEW,OnPreview)
//
COMMAND_RANGE_HANDLER(ID_EDIT_CUT,ID_REDO,OnEditCmd) // TODO NAO ESTA MAIS EM RANGE
NOTIFY_CODE_HANDLER(CTCN_SELCHANGE, OnTabSelChange)
NOTIFY_CODE_HANDLER(CTCN_SELCHANGING, OnTabSelChanging)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnModified(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SetModified(TRUE);
return 0;
}
LRESULT OnDeleteViewer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
CPreviewDlg *p = (CPreviewDlg *)lParam;
delete p;
return 0;
}
LRESULT OnFileNew(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFileSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnFileSaveAs(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//
LRESULT OnAddFrame(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddRect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddPicture(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddLabel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddButton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddRadio(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddText(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddCombo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddList(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddHScroll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddVScroll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddSpin(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddSlider(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddProgress(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddActivex(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnGrid(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnGridSettings(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTab(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnUnselectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnProperties(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//
LRESULT OnMoveCtl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSendBack(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSendFront(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAlignCtl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSpaceCtl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSizeCtl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCenterCtl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnValidateScript(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnPreviewAuto(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnPreview(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//
LRESULT OnEditCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTabSelChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnTabSelChanging(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
//
void SetModified(BOOL bSet)
{
m_bModified = bSet;
}
CCommandBarCtrl m_CmdBar;
CAxWindow m_axFormEdit;
CAxWindow m_axScriptEdit;
CAxWindow m_axFormView;
//CComPtr<DDFORMSLib::IFormEditor> m_spFormEditor;
CComPtr<DDFORMSLib::IFormEditor2> m_spFormEditor;
//CComDispatchDriver m_spFormEditor;
CComPtr<DDFORMSLib::IFormViewer2> m_spFormViewer;
CComPtr<DDFORMSLib::ISimpleScriptEditor> m_spScriptEditor;
BOOL m_bModified;
CString m_file;
private:
// form editor state
BOOL m_FES_Busy;
BOOL m_FES_Modified;
BOOL m_FES_CanPaste;
BOOL m_FES_CanUndo;
BOOL m_FES_CanRedo;
long m_FES_ItemCount;
long m_FES_SelectedItemCount;
//
void FileNew(void);
void FileSave(LPCTSTR file);
void FileOpen(LPCTSTR file);
CString MakeTempName(void);
DECLARE_REGISTRY_RESOURCEID(IDR_REGISTRY1);
};
#endif // !defined(AFX_FORMFRAME_H__5EB2390C_5045_4995_A4DE_EC2BE9BEE3AE__INCLUDED_)