提交 | 用户 | age
|
0ed438
|
1 |
|
Q |
2 |
// MainFrm.cpp: CMainFrame 类的实现
|
|
3 |
//
|
|
4 |
|
|
5 |
#include "pch.h"
|
|
6 |
#include "framework.h"
|
|
7 |
#include "MTerm1.h"
|
|
8 |
#include "MainFrm.h"
|
418cb3
|
9 |
#include "ChildFrm.h"
|
Q |
10 |
|
|
11 |
#include "MTerm1Doc.h"
|
|
12 |
#include "MTerm1View.h"
|
|
13 |
#include "MTerm1CtrlView.h"
|
|
14 |
#include "MTerm1TestView.h"
|
|
15 |
#include "MTerm1ProgTxt.h"
|
|
16 |
#include <windows.h>
|
61deef
|
17 |
#include "MyChildFrm.h"
|
Q |
18 |
#include "MyChildFrmConfig.h"
|
0ed438
|
19 |
|
Q |
20 |
#ifdef _DEBUG
|
|
21 |
#define new DEBUG_NEW
|
|
22 |
#endif
|
|
23 |
|
|
24 |
// CMainFrame
|
|
25 |
|
|
26 |
|
418cb3
|
27 |
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx)
|
0ed438
|
28 |
|
Q |
29 |
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
|
|
30 |
ON_WM_CREATE()
|
418cb3
|
31 |
ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc)
|
Q |
32 |
ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar)
|
|
33 |
ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar)
|
|
34 |
ON_COMMAND(ID_VIEW_INPUT_BAR, &CMainFrame::OnViewInputBar)
|
|
35 |
ON_UPDATE_COMMAND_UI(ID_VIEW_INPUT_BAR, &CMainFrame::OnUpdateViewInputBar)
|
|
36 |
ON_COMMAND(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnViewNumkeyBar)
|
|
37 |
ON_UPDATE_COMMAND_UI(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnUpdateViewNumkeyBar)
|
|
38 |
ON_COMMAND(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnViewInputsegBar)
|
|
39 |
ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar)
|
|
40 |
ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar)
|
|
41 |
ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar)
|
df0321
|
42 |
|
418cb3
|
43 |
// ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds)
|
Q |
44 |
// ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld)
|
|
45 |
// ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl)
|
|
46 |
|
61deef
|
47 |
ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog)
|
Q |
48 |
ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev)
|
|
49 |
ON_COMMAND(ID_MENU_SHOWNAV, &CMainFrame::OnMenuShownav)
|
|
50 |
ON_COMMAND(ID_COMMTEST, &CMainFrame::OnCommtest)
|
|
51 |
ON_COMMAND(ID_DEVICE_CONFIG, &CMainFrame::OnDeviceConfig)
|
|
52 |
|
0ed438
|
53 |
END_MESSAGE_MAP()
|
Q |
54 |
|
|
55 |
static UINT indicators[] =
|
|
56 |
{
|
|
57 |
ID_SEPARATOR, // 状态行指示器
|
418cb3
|
58 |
ID_INDICATOR_SEL_TYPE,
|
0ed438
|
59 |
ID_INDICATOR_CAPS,
|
Q |
60 |
ID_INDICATOR_NUM,
|
|
61 |
ID_INDICATOR_SCRL,
|
|
62 |
};
|
|
63 |
|
|
64 |
// CMainFrame 构造/析构
|
|
65 |
|
|
66 |
CMainFrame::CMainFrame() noexcept
|
|
67 |
{
|
|
68 |
// TODO: 在此添加成员初始化代码
|
|
69 |
}
|
|
70 |
|
|
71 |
CMainFrame::~CMainFrame()
|
|
72 |
{
|
|
73 |
}
|
|
74 |
|
418cb3
|
75 |
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
|
Q |
76 |
{
|
|
77 |
// TODO: 在此添加专用代码和/或调用基类
|
|
78 |
// if (m_wndDlgBar_Func_Key.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) return TRUE;
|
|
79 |
|
|
80 |
return CMDIFrameWndEx::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
|
81 |
}
|
|
82 |
|
0ed438
|
83 |
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
Q |
84 |
{
|
|
85 |
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
|
|
86 |
return -1;
|
418cb3
|
87 |
// m_dlgMyLog.Create(m_dlgMyLog.IDD, GetParent());
|
Q |
88 |
// m_dlgMyLog.ShowWindow(SW_SHOW);
|
0ed438
|
89 |
|
418cb3
|
90 |
// BOOL bNameValid;
|
61deef
|
91 |
CMainFrame::EnableLoadDockState(FALSE);
|
418cb3
|
92 |
// 创建类视图
|
Q |
93 |
CString strNavView;
|
|
94 |
// bNameValid = strNavView.LoadString(IDS_CLASS_VIEW);
|
|
95 |
// ASSERT(bNameValid);
|
|
96 |
///*
|
|
97 |
strNavView = _T("导航视图");
|
|
98 |
if (!m_wndNavView.Create(strNavView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_NAVVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
|
0ed438
|
99 |
{
|
418cb3
|
100 |
TRACE0("未能创建“导航视图”窗口\n");
|
Q |
101 |
return FALSE; // 未能创建
|
0ed438
|
102 |
}
|
418cb3
|
103 |
m_wndNavView.EnableDocking(CBRS_ALIGN_LEFT);
|
Q |
104 |
DockPane(&m_wndNavView);
|
|
105 |
//DockControlBar(&m_wndNavView);
|
|
106 |
//*/
|
0ed438
|
107 |
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
418cb3
|
108 |
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
0ed438
|
109 |
{
|
Q |
110 |
TRACE0("未能创建工具栏\n");
|
|
111 |
return -1; // 未能创建
|
|
112 |
}
|
|
113 |
|
418cb3
|
114 |
/* 输入栏
|
Q |
115 |
if (!m_wndTBar_InputShow.CreateEx(this, TBSTYLE_FLAT,
|
|
116 |
WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
117 |
CRect(1, 1, 1, 1), IDW_TOOL_BAR2) ||
|
|
118 |
!m_wndTBar_InputShow.LoadToolBar(IDR_TOOLBAR_INPUT_SHOW))
|
|
119 |
{
|
|
120 |
TRACE0("未能创建数字工具栏\n");
|
|
121 |
return -1; // 未能创建
|
|
122 |
}
|
|
123 |
CRect rect1;
|
|
124 |
int index = m_wndTBar_InputShow.CommandToIndex(ID_BUTTON_INPUT_SHOW);
|
|
125 |
UINT nID,nStyle;
|
|
126 |
int iImage;
|
|
127 |
m_wndTBar_InputShow.GetButtonInfo(0, nID, nStyle, iImage);
|
|
128 |
m_wndTBar_InputShow.SetButtonInfo(index, ID_BUTTON_INPUT_SHOW, TBBS_SEPARATOR, 100);
|
|
129 |
m_wndTBar_InputShow.GetItemRect(index, &rect1);
|
|
130 |
rect1.left = 1;
|
|
131 |
rect1.top = 2;
|
|
132 |
rect1.right = rect1.left + 100;
|
|
133 |
rect1.bottom = rect1.top + 20;
|
|
134 |
//*/
|
|
135 |
/*
|
|
136 |
if (!m_InputShowEdit.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rect1, \
|
|
137 |
&m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW))
|
|
138 |
{
|
|
139 |
TRACE(_T("Failed to create CEdit\n"));
|
|
140 |
return FALSE;
|
|
141 |
}
|
0ed438
|
142 |
|
418cb3
|
143 |
if (!m_InputShowStatic.Create(_T("Test1"),WS_CHILD | WS_VISIBLE |WS_EX_CLIENTEDGE, rect1, \
|
Q |
144 |
&m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW))
|
|
145 |
{
|
|
146 |
TRACE(_T("Failed to create CStaticEx\n"));
|
|
147 |
return FALSE;
|
|
148 |
}
|
|
149 |
m_InputShowStatic.SetBkColor(RGB(255, 255, 255));
|
|
150 |
m_InputShowStatic.SetTextColor(RGB(255, 128, 128));
|
|
151 |
m_InputShowStatic.SetTextSize(20);
|
|
152 |
//*/
|
|
153 |
//m_InputShowEdit.SetReadOnly(true);
|
|
154 |
/*
|
|
155 |
if (!m_wndTBar_Num_Key.CreateEx(this, TBSTYLE_FLAT,
|
|
156 |
WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
157 |
CRect(1,1,1,1),IDW_TOOL_BAR2) ||
|
|
158 |
!m_wndTBar_Num_Key.LoadToolBar(IDR_TOOLBAR_NUM_KEY))
|
|
159 |
{
|
|
160 |
TRACE0("未能创建数字键工具栏\n");
|
|
161 |
return -1; // 未能创建
|
|
162 |
}
|
|
163 |
//*/
|
0ed438
|
164 |
|
418cb3
|
165 |
/*
|
Q |
166 |
if (!m_wndTBar_Edit_Key.CreateEx(this, TBSTYLE_FLAT,
|
|
167 |
WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
168 |
CRect(1, 1, 1, 1), IDR_TOOLBAR_EDIT_KEY) ||
|
|
169 |
!m_wndTBar_Edit_Key.LoadToolBar(IDR_TOOLBAR_EDIT_KEY))
|
|
170 |
{
|
|
171 |
TRACE0("未能创建编辑键工具栏\n");
|
|
172 |
return -1; // 未能创建
|
|
173 |
}
|
|
174 |
//*/
|
|
175 |
/*
|
|
176 |
if (!m_wndToolBar_Func_Key.CreateEx(this, TBSTYLE_FLAT,
|
|
177 |
WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
178 |
CRect(1, 1, 1, 1), IDW_TOOL_BAR_FUNC_KEY) ||
|
|
179 |
!m_wndToolBar_Func_Key.LoadToolBar(IDR_TOOLBAR_FUNC_KEY2))
|
|
180 |
{
|
|
181 |
TRACE0("未能创建功能键工具栏\n");
|
|
182 |
return -1; // 未能创建
|
|
183 |
}
|
|
184 |
//m_wndToolBar_Func_Key.SetTwoRowsWithSibling();
|
|
185 |
//*/
|
|
186 |
/*
|
|
187 |
if (!m_wndDlgBar_InputShow.Create(this, IDD_DIALOGBAR_INPUT_SHOW, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
188 |
IDD_DIALOGBAR_INPUT_SHOW))
|
|
189 |
{
|
|
190 |
TRACE0("未能创建功能键2工具栏\n");
|
|
191 |
return -1; // 未能创建
|
|
192 |
}
|
|
193 |
//*/
|
|
194 |
/*
|
|
195 |
if (!m_wndDlgBar_Func_Key.Create(this, IDD_DIALOGBAR_FUNC_KEYS,WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
196 |
IDD_DIALOGBAR_FUNC_KEYS))
|
|
197 |
{
|
|
198 |
TRACE0("未能创建功能键2工具栏\n");
|
|
199 |
return -1; // 未能创建
|
|
200 |
}
|
|
201 |
// ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, TRUE);
|
|
202 |
// m_wndDlgBar_Func_Key.MoveWindow(100, 100, 200, 200);
|
|
203 |
//*/
|
0ed438
|
204 |
|
Q |
205 |
if (!m_wndStatusBar.Create(this))
|
|
206 |
{
|
|
207 |
TRACE0("未能创建状态栏\n");
|
|
208 |
return -1; // 未能创建
|
|
209 |
}
|
|
210 |
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
|
418cb3
|
211 |
m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH);
|
Q |
212 |
//m_wndStatusBar.OnCtlColor();
|
|
213 |
///*
|
|
214 |
if (!m_wndMyPaneLog.Create(_T("日志窗口"), this, CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
|
|
215 |
| WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
|
|
216 |
{
|
|
217 |
TRACE0("未能创建“MyPaneLog窗口\n");
|
|
218 |
return FALSE;
|
|
219 |
}
|
|
220 |
m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY);
|
df0321
|
221 |
//*/
|
Q |
222 |
// //
|
|
223 |
///*
|
|
224 |
|
|
225 |
if (!m_wndMyPaneInputShow.Create(_T("输入窗口"), this, CRect(2, 2, 20, 20), TRUE, 1236, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
|
|
226 |
| WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
|
|
227 |
{
|
|
228 |
TRACE0("未能创建“MyPaneInputShow窗口\n");
|
|
229 |
return FALSE;
|
|
230 |
}
|
|
231 |
m_wndMyPaneInputShow.EnableDocking(CBRS_ALIGN_BOTTOM);
|
0ed438
|
232 |
|
418cb3
|
233 |
//*/
|
Q |
234 |
// m_dlgMyLog.Create(m_dlgMyLog.IDD, this);
|
|
235 |
// m_dlgMyLog.ModifyStyle(0, WS_POPUPWINDOW);
|
|
236 |
// m_dlgMyLog.ShowWindow(SW_SHOW);
|
|
237 |
|
|
238 |
// TODO: 如果不需要可停靠工具栏,则删除这三行
|
0ed438
|
239 |
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
Q |
240 |
EnableDocking(CBRS_ALIGN_ANY);
|
|
241 |
DockPane(&m_wndToolBar);
|
418cb3
|
242 |
// DockControlBar(&m_wndToolBar);
|
Q |
243 |
|
|
244 |
// EnableDocking(CBRS_ALIGN_ANY);
|
61deef
|
245 |
m_wndNavView.SetMinSize(CSize(300, 300));
|
Q |
246 |
DockPane(&m_wndNavView);
|
0ed438
|
247 |
|
61deef
|
248 |
CDockablePane* pTabbedBar = nullptr;
|
Q |
249 |
// m_wndMyPaneLog.AttachToTabWnd(&m_wndNavView, DM_SHOW, TRUE,&pTabbedBar);
|
0ed438
|
250 |
|
61deef
|
251 |
// m_wndNavView.AttachToTabWnd(&m_wndMyPaneLog, DM_SHOW, TRUE, &pTabbedBar);
|
Q |
252 |
m_wndMyPaneLog.SetMinSize(CSize(300, 300));
|
|
253 |
m_wndMyPaneLog.DockToWindow(&m_wndNavView, CBRS_BOTTOM);
|
|
254 |
// DockPane(&m_wndMyPaneLog);
|
418cb3
|
255 |
// CDockablePane* pTabbedBar = nullptr;
|
Q |
256 |
// m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
|
0ed438
|
257 |
|
Q |
258 |
|
418cb3
|
259 |
///*
|
Q |
260 |
// m_wndDlgBar_InputShow.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
|
|
261 |
// m_wndTBar_Num_Key.EnableDocking(CBRS_ALIGN_ANY);
|
|
262 |
// m_wndTBar_Edit_Key.EnableDocking(CBRS_ALIGN_ANY);
|
|
263 |
// m_wndToolBar_Func_Key.EnableDocking(CBRS_ALIGN_ANY);
|
|
264 |
// m_wndDlgBar_Func_Key.EnableDocking(CBRS_ALIGN_TOP| CBRS_ALIGN_BOTTOM);
|
0ed438
|
265 |
|
418cb3
|
266 |
// EnableDocking(CBRS_ALIGN_ANY);
|
0ed438
|
267 |
|
418cb3
|
268 |
// DockPane(&m_wndToolBar);
|
0ed438
|
269 |
|
418cb3
|
270 |
// DockControlBar(&m_wndDlgBar_InputShow);
|
Q |
271 |
// DockControlBar(&m_wndTBar_Num_Key);
|
|
272 |
// DockControlBar(&m_wndTBar_Edit_Key);
|
|
273 |
// DockPane(&m_wndToolBar_Func_Key);
|
|
274 |
// DockPane(&m_wndDlgBar_Func_Key);
|
|
275 |
// DockControlBar(&m_wndDlgBar_Func_Key);
|
df0321
|
276 |
DockPane(&m_wndMyPaneInputShow);
|
61deef
|
277 |
m_wndNavView.SetMinSize(CSize(0, 0));
|
Q |
278 |
m_wndMyPaneLog.SetMinSize(CSize(0, 0));
|
|
279 |
// DockPane(pTabbedBar);
|
df0321
|
280 |
// m_wndMyPaneInputShow.m_pMyFormInputShow->SetBtnDisplayESC(1);
|
0ed438
|
281 |
|
418cb3
|
282 |
//*/
|
0ed438
|
283 |
return 0;
|
Q |
284 |
}
|
418cb3
|
285 |
|
0ed438
|
286 |
|
Q |
287 |
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
288 |
{
|
|
289 |
if( !CMDIFrameWndEx::PreCreateWindow(cs) )
|
|
290 |
return FALSE;
|
|
291 |
// TODO: 在此处通过修改
|
|
292 |
// CREATESTRUCT cs 来修改窗口类或样式
|
|
293 |
|
|
294 |
return TRUE;
|
|
295 |
}
|
|
296 |
|
|
297 |
// CMainFrame 诊断
|
|
298 |
|
|
299 |
#ifdef _DEBUG
|
|
300 |
void CMainFrame::AssertValid() const
|
|
301 |
{
|
|
302 |
CMDIFrameWndEx::AssertValid();
|
|
303 |
}
|
|
304 |
|
|
305 |
void CMainFrame::Dump(CDumpContext& dc) const
|
|
306 |
{
|
|
307 |
CMDIFrameWndEx::Dump(dc);
|
|
308 |
}
|
|
309 |
#endif //_DEBUG
|
|
310 |
|
|
311 |
|
|
312 |
// CMainFrame 消息处理程序
|
|
313 |
|
|
314 |
|
|
315 |
|
418cb3
|
316 |
void CMainFrame::OnUploadFromPlc()
|
0ed438
|
317 |
{
|
418cb3
|
318 |
// TODO: 在此添加命令处理程序代码
|
Q |
319 |
SysLog(_T("Upload from PLC, (From mainframe)"));
|
|
320 |
CWinAppEx* pApp = &theApp;
|
|
321 |
|
|
322 |
POSITION curTemplatePos = theApp.m_pDocManager->GetFirstDocTemplatePosition();
|
|
323 |
if (curTemplatePos != NULL)
|
0ed438
|
324 |
{
|
418cb3
|
325 |
CDocTemplate* curTemplate = theApp.m_pDocManager->GetNextDocTemplate(curTemplatePos);
|
Q |
326 |
CMTerm1Doc* pDoc = (CMTerm1Doc* ) curTemplate->OpenDocumentFile(NULL);
|
|
327 |
if (pDoc) pDoc->OnUploadFromPlc();
|
0ed438
|
328 |
}
|
Q |
329 |
|
|
330 |
}
|
|
331 |
|
418cb3
|
332 |
void CMainFrame::OnMenuShowLog()
|
0ed438
|
333 |
{
|
418cb3
|
334 |
// TODO: 在此添加命令处理程序代码
|
Q |
335 |
m_wndMyPaneLog.ShowWindow(SW_SHOW);
|
|
336 |
// m_wndNavView.ShowWindow(SW_SHOW);
|
|
337 |
}
|
0ed438
|
338 |
|
Q |
339 |
|
418cb3
|
340 |
void CMainFrame::OnViewFunckeyBar()
|
Q |
341 |
{
|
|
342 |
// TODO: 在此添加命令处理程序代码
|
|
343 |
CString s1;
|
|
344 |
s1.Format(_T("显示功能键栏"));
|
|
345 |
SysLog(s1);
|
|
346 |
// m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE);
|
|
347 |
// m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW);
|
|
348 |
// ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE);
|
|
349 |
|
|
350 |
}
|
|
351 |
|
|
352 |
|
|
353 |
void CMainFrame::OnUpdateViewFunckeyBar(CCmdUI *pCmdUI)
|
|
354 |
{
|
|
355 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
356 |
|
|
357 |
}
|
|
358 |
|
|
359 |
|
|
360 |
void CMainFrame::OnViewInputBar()
|
|
361 |
{
|
|
362 |
// TODO: 在此添加命令处理程序代码
|
|
363 |
}
|
|
364 |
|
|
365 |
|
|
366 |
void CMainFrame::OnUpdateViewInputBar(CCmdUI *pCmdUI)
|
|
367 |
{
|
|
368 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
369 |
}
|
|
370 |
|
|
371 |
|
|
372 |
void CMainFrame::OnViewNumkeyBar()
|
|
373 |
{
|
|
374 |
// TODO: 在此添加命令处理程序代码
|
|
375 |
CString s1;
|
|
376 |
s1.Format(_T("显示数字键栏"));
|
|
377 |
SysLog(s1);
|
|
378 |
// m_wndTBar_Num_Key.ShowWindow(SW_HIDE);
|
|
379 |
// m_wndTBar_Num_Key.ShowWindow(SW_SHOW);
|
|
380 |
|
|
381 |
}
|
|
382 |
|
|
383 |
|
|
384 |
void CMainFrame::OnUpdateViewNumkeyBar(CCmdUI *pCmdUI)
|
|
385 |
{
|
|
386 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
387 |
}
|
|
388 |
|
|
389 |
|
|
390 |
void CMainFrame::OnViewInputsegBar()
|
|
391 |
{
|
|
392 |
// TODO: 在此添加命令处理程序代码
|
|
393 |
}
|
|
394 |
|
|
395 |
|
|
396 |
void CMainFrame::OnUpdateViewInputsegBar(CCmdUI *pCmdUI)
|
|
397 |
{
|
|
398 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
399 |
}
|
|
400 |
|
|
401 |
|
|
402 |
void CMainFrame::OnViewCommentsBar()
|
|
403 |
{
|
|
404 |
// TODO: 在此添加命令处理程序代码
|
|
405 |
}
|
|
406 |
|
|
407 |
|
|
408 |
void CMainFrame::OnUpdateViewCommentsBar(CCmdUI *pCmdUI)
|
|
409 |
{
|
|
410 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
411 |
}
|
|
412 |
/*
|
|
413 |
CView * FindView(CDocument * pDoc, CRuntimeClass * pClass)
|
|
414 |
{
|
|
415 |
CView* pView = NULL;
|
|
416 |
POSITION pos = pDoc->GetFirstViewPosition();
|
|
417 |
while (pos != NULL)
|
0ed438
|
418 |
{
|
418cb3
|
419 |
pView = pDoc->GetNextView(pos);
|
Q |
420 |
if (pView->IsKindOf(pClass))
|
|
421 |
break;
|
|
422 |
}
|
|
423 |
if (!pView->IsKindOf(pClass))
|
|
424 |
{
|
|
425 |
//AfxMessageBox("Connt Locate the View.");
|
|
426 |
return NULL;
|
|
427 |
}
|
|
428 |
return pView;
|
|
429 |
}
|
|
430 |
*/
|
0ed438
|
431 |
|
418cb3
|
432 |
int CMainFrame::GetInputInfo(int inputInfo)
|
Q |
433 |
{
|
|
434 |
// TODO: 在此处添加实现代码.
|
|
435 |
CString m_InputInfo;
|
0ed438
|
436 |
|
418cb3
|
437 |
CString s1;
|
Q |
438 |
s1.Format(_T("From MainFrame , input %s"), m_InputInfo);
|
|
439 |
SysLog(s1);
|
0ed438
|
440 |
|
df0321
|
441 |
// m_wndDlgBar_InputShow.SetDisplay(inputInfo);
|
Q |
442 |
|
|
443 |
return 0;
|
|
444 |
}
|
|
445 |
|
|
446 |
int CMainFrame::SetDisplayInfo(int Info)
|
|
447 |
{
|
|
448 |
// TODO: 在此处添加实现代码.
|
|
449 |
CString m_InputInfo;
|
|
450 |
|
|
451 |
CString s1;
|
|
452 |
s1.Format(_T("From MainFrame , SetDisplayInfo %x"), Info);
|
|
453 |
SysLog(s1);
|
|
454 |
|
|
455 |
// m_wndDlgBar_InputShow.SetDisplay(inputInfo);
|
|
456 |
m_wndMyPaneInputShow.m_pMyFormInputShow->SetDisplay(Info);
|
|
457 |
return 0;
|
|
458 |
}
|
|
459 |
|
|
460 |
int CMainFrame::SetCellInfo(int info)
|
|
461 |
{
|
|
462 |
// TODO: 在此处添加实现代码.
|
|
463 |
CString m_InputInfo;
|
|
464 |
|
|
465 |
CString s1;
|
|
466 |
s1.Format(_T("From MainFrame , SetCellInfo %x"), info);
|
|
467 |
SysLog(s1);
|
|
468 |
|
418cb3
|
469 |
// m_wndDlgBar_InputShow.SetDisplay(inputInfo);
|
0ed438
|
470 |
|
418cb3
|
471 |
return 0;
|
Q |
472 |
}
|
0ed438
|
473 |
|
df0321
|
474 |
int CMainFrame::GetInputCell(tagInputCell inputCell)
|
418cb3
|
475 |
{
|
0ed438
|
476 |
|
df0321
|
477 |
// localInputCell = inputCell;
|
418cb3
|
478 |
return 0;
|
0ed438
|
479 |
}
|
Q |
480 |
|
418cb3
|
481 |
void CMainFrame::OnMenuShowDev()
|
0ed438
|
482 |
{
|
418cb3
|
483 |
// TODO: 在此添加命令处理程序代码
|
Q |
484 |
|
0ed438
|
485 |
}
|
df0321
|
486 |
|
Q |
487 |
void CMainFrame::OnMenuShownav()
|
|
488 |
{
|
|
489 |
// TODO: 在此添加命令处理程序代码
|
|
490 |
m_wndNavView.ShowWindow(SW_SHOW);
|
|
491 |
}
|
61deef
|
492 |
|
Q |
493 |
|
|
494 |
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
|
|
495 |
{
|
|
496 |
// TODO: 在此添加专用代码和/或调用基类
|
|
497 |
UINT nCode = pMsg->wParam;
|
|
498 |
if (pMsg->message == WM_KEYDOWN)
|
|
499 |
{
|
|
500 |
if ((nCode == _T('A') || nCode == _T('C') || nCode == _T('X') || nCode == _T('V')|| nCode == _T('Z') || nCode == _T('Y'))
|
|
501 |
&& (::GetKeyState(VK_CONTROL) & 0x8000))
|
|
502 |
{
|
|
503 |
::TranslateMessage(pMsg);
|
|
504 |
::DispatchMessage(pMsg);
|
|
505 |
return TRUE;
|
|
506 |
}
|
|
507 |
}
|
|
508 |
|
|
509 |
return CMDIFrameWndEx::PreTranslateMessage(pMsg);
|
|
510 |
}
|
|
511 |
|
|
512 |
|
|
513 |
void CMainFrame::OnCommtest()
|
|
514 |
{
|
|
515 |
// TODO: 在此添加命令处理程序代码
|
|
516 |
// this->LockWindowUpdate();
|
|
517 |
if (m_pCommDevView == nullptr) {
|
|
518 |
/*
|
|
519 |
CRect rectWndClient;
|
|
520 |
GetClientRect(&rectWndClient);
|
|
521 |
rectWndClient.left = 200;
|
|
522 |
rectWndClient.right = 500;
|
|
523 |
rectWndClient.top = 200;
|
|
524 |
rectWndClient.bottom = 500;
|
|
525 |
CFrameWnd* pFrameWnd = new CFrameWnd();
|
|
526 |
pFrameWnd->Create(_T("333"), _T("444"), WS_VISIBLE, rectWndClient, this);
|
|
527 |
|
|
528 |
CRuntimeClass* pViewRuntimeClass = RUNTIME_CLASS(CMTerm1CommDevView);
|
|
529 |
m_pCommDevView = (CMTerm1CommDevView*)pViewRuntimeClass->CreateObject();
|
|
530 |
m_pCommDevView->Create(_T("1111"), _T("2222"), WS_VISIBLE | WS_CHILD | WS_MAXIMIZE, rectWndClient, pFrameWnd, 123, NULL);
|
|
531 |
m_pCommDevView->OnInitialUpdate();
|
|
532 |
// */
|
|
533 |
|
|
534 |
|
|
535 |
CMDIChildWnd * pChildWnd = this->CreateNewChild(RUNTIME_CLASS(CMyChildFrame), IDR_MTerm1TYPE);
|
|
536 |
|
|
537 |
/*
|
|
538 |
CCreateContext cx;
|
|
539 |
cx.m_pCurrentFrame = this;
|
|
540 |
cx.m_pNewViewClass = RUNTIME_CLASS(CMTerm1CommDevView);
|
|
541 |
cx.m_pCurrentDoc = NULL;
|
|
542 |
cx.m_pLastView = NULL;
|
|
543 |
cx.m_pNewDocTemplate = NULL;
|
|
544 |
|
|
545 |
|
|
546 |
m_pCommDevView = DYNAMIC_DOWNCAST(CMTerm1CommDevView, pChildWnd->CreateView(&cx, 23456));
|
|
547 |
if (!m_pCommDevView) {
|
|
548 |
|
|
549 |
}
|
|
550 |
else {
|
|
551 |
RecalcLayout();
|
|
552 |
m_pCommDevView->ShowWindow(SW_SHOW);
|
|
553 |
m_pCommDevView->UpdateWindow();
|
|
554 |
}
|
|
555 |
*/
|
|
556 |
// pChildWnd->LoadFrame(IDD_MTerm1CommDevView2, WS_VISIBLE | WS_CHILD, this,&cx);
|
|
557 |
// pChildWnd->CreateView(&cx, 23456);
|
|
558 |
|
|
559 |
}
|
|
560 |
|
|
561 |
// this->UnlockWindowUpdate();
|
|
562 |
}
|
|
563 |
|
|
564 |
void CMainFrame::OnDeviceConfig()
|
|
565 |
{
|
|
566 |
// TODO: 在此添加命令处理程序代码
|
|
567 |
// this->LockWindowUpdate();
|
|
568 |
if (m_pConfigToolView == nullptr) {
|
|
569 |
|
|
570 |
CMDIChildWnd* pChildWnd = this->CreateNewChild(RUNTIME_CLASS(CMyChildFrameConfig), IDR_MTerm1TYPE);
|
|
571 |
}
|
|
572 |
|
|
573 |
// this->UnlockWindowUpdate();
|
|
574 |
}
|