Yao Chunli
2022-06-21 e00d5a1575d26f8fec1be6fa8a844203cd66a24c
提交 | 用户 | age
0ed438 1 
Q 2 // MainFrm.cpp: CMainFrame 类的实现
3 //
4
5 #include "pch.h"
6 #include "framework.h"
7 #include "MTerm2.h"
8 #include "MainFrm.h"
9 #include "ChildFrm.h"
10
11 #include "MTerm2Doc.h"
12 #include "MTerm2View.h"
13 #include "MTerm2CtrlView.h"
14 #include "MTerm2TestView.h"
15 #include "MTerm2ProgTxt.h"
e00d5a 16 #include <windows.h>
0ed438 17
Q 18 #ifdef _DEBUG
19 #define new DEBUG_NEW
20 #endif
21
22 // CMainFrame
23
e00d5a 24
b978bf 25 IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
0ed438 26
b978bf 27 BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
0ed438 28     ON_WM_CREATE()
Q 29     ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc)
30     ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar)
31     ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar)
32     ON_COMMAND(ID_VIEW_INPUT_BAR, &CMainFrame::OnViewInputBar)
33     ON_UPDATE_COMMAND_UI(ID_VIEW_INPUT_BAR, &CMainFrame::OnUpdateViewInputBar)
34     ON_COMMAND(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnViewNumkeyBar)
35     ON_UPDATE_COMMAND_UI(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnUpdateViewNumkeyBar)
36     ON_COMMAND(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnViewInputsegBar)
37     ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar)
38     ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar)
39     ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar)
e00d5a 40     ON_COMMAND(ID_BUTTON_0, &CMainFrame::OnBtn0)
YC 41     ON_COMMAND(ID_BUTTON_1, &CMainFrame::OnBtn1)
42     ON_COMMAND(ID_BUTTON_2, &CMainFrame::OnBtn2)
43     ON_COMMAND(ID_BUTTON_3, &CMainFrame::OnBtn3)
44     ON_COMMAND(ID_BUTTON_4, &CMainFrame::OnBtn4)
45     ON_COMMAND(ID_BUTTON_5, &CMainFrame::OnBtn5)
46     ON_COMMAND(ID_BUTTON_6, &CMainFrame::OnBtn6)
47     ON_COMMAND(ID_BUTTON_7, &CMainFrame::OnBtn7)
48     ON_COMMAND(ID_BUTTON_8, &CMainFrame::OnBtn8)
49     ON_COMMAND(ID_BUTTON_9, &CMainFrame::OnBtn9)
50     ON_COMMAND(ID_BUTTON_A, &CMainFrame::OnBtnA)
51     ON_COMMAND(ID_BUTTON_B, &CMainFrame::OnBtnB)
52     ON_COMMAND(ID_BUTTON_C, &CMainFrame::OnBtnC)
53     ON_COMMAND(ID_BUTTON_D, &CMainFrame::OnBtnD)
54     ON_COMMAND(ID_BUTTON_E, &CMainFrame::OnBtnE)
55     ON_COMMAND(ID_BUTTON_F, &CMainFrame::OnBtnF)
56     ON_COMMAND(ID_BUTTON_MINUS, &CMainFrame::OnBtnMinus)
57     ON_COMMAND(ID_BUTTON_DOT, &CMainFrame::OnBtnDot)
58     ON_COMMAND(ID_BUTTON_RET, &CMainFrame::OnBtnRet)
59     ON_COMMAND(ID_BUTTON_INSERT, &CMainFrame::OnBtnInsert)
60     ON_COMMAND(ID_BUTTON_DELETE, &CMainFrame::OnBtnDelete)
61     ON_COMMAND(ID_BUTTON_ESC, &CMainFrame::OnBtnEsc)
0ed438 62 //    ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds)
Q 63 //    ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld)
64 //    ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl)
65
66 ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog)
e00d5a 67 ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev)
0ed438 68 END_MESSAGE_MAP()
Q 69
70 static UINT indicators[] =
71 {
72     ID_SEPARATOR,           // 状态行指示器
73     ID_INDICATOR_SEL_TYPE,
74     ID_INDICATOR_CAPS,
75     ID_INDICATOR_NUM,
76     ID_INDICATOR_SCRL,
77 };
78
79 // CMainFrame 构造/析构
80
81 CMainFrame::CMainFrame() noexcept
82 {
83     // TODO: 在此添加成员初始化代码
84 }
85
86 CMainFrame::~CMainFrame()
87 {
88 }
89
b978bf 90 BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
Q 91 {
92     // TODO: 在此添加专用代码和/或调用基类
93     if (m_wndDlgBar_Func_Key.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
94
95         return     TRUE;
96
97     return CMDIFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
98 }
99
0ed438 100 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
Q 101 {
b978bf 102     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
0ed438 103         return -1;
Q 104 //    m_dlgMyLog.Create(m_dlgMyLog.IDD, GetParent());
105 //    m_dlgMyLog.ShowWindow(SW_SHOW);
106
65f713 107 //    BOOL bNameValid;
Q 108
109     // 创建类视图
110     CString strNavView;
111 //    bNameValid = strNavView.LoadString(IDS_CLASS_VIEW);
112 //    ASSERT(bNameValid);
b978bf 113 /*
65f713 114     strNavView = _T("导航视图");
Q 115     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))
116     {
117         TRACE0("未能创建“导航视图”窗口\n");
118         return FALSE; // 未能创建
119     }
b978bf 120     m_wndNavView.EnableDocking(CBRS_ALIGN_ANY);
Q 121     //DockPane(&m_wndNavView);
122     //DockControlBar(&m_wndNavView);
123 */
0ed438 124     if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
Q 125         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
126     {
127         TRACE0("未能创建工具栏\n");
128         return -1;      // 未能创建
129     }
130
b978bf 131     /*   输入栏
Q 132     if (!m_wndTBar_InputShow.CreateEx(this, TBSTYLE_FLAT,
0ed438 133         WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
Q 134         CRect(1, 1, 1, 1), IDW_TOOL_BAR2) ||
b978bf 135         !m_wndTBar_InputShow.LoadToolBar(IDR_TOOLBAR_INPUT_SHOW))
0ed438 136     {
Q 137         TRACE0("未能创建数字工具栏\n");
138         return -1;      // 未能创建
139     }
140     CRect rect1;
b978bf 141     int index = m_wndTBar_InputShow.CommandToIndex(ID_BUTTON_INPUT_SHOW);
0ed438 142     UINT nID,nStyle;
Q 143     int iImage;
b978bf 144     m_wndTBar_InputShow.GetButtonInfo(0, nID, nStyle, iImage);
Q 145     m_wndTBar_InputShow.SetButtonInfo(index, ID_BUTTON_INPUT_SHOW, TBBS_SEPARATOR, 100);
146     m_wndTBar_InputShow.GetItemRect(index, &rect1);
0ed438 147     rect1.left = 1;
Q 148     rect1.top = 2;
149     rect1.right = rect1.left + 100;
150     rect1.bottom = rect1.top + 20;
b978bf 151     //*/
0ed438 152 /*
Q 153     if (!m_InputShowEdit.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rect1, \
b978bf 154         &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW))
0ed438 155     {
Q 156         TRACE(_T("Failed to create CEdit\n"));
157         return FALSE;
158     }
b978bf 159
0ed438 160     if (!m_InputShowStatic.Create(_T("Test1"),WS_CHILD | WS_VISIBLE |WS_EX_CLIENTEDGE, rect1, \
b978bf 161         &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW))
0ed438 162     {
Q 163         TRACE(_T("Failed to create CStaticEx\n"));
164         return FALSE;
165     }
166     m_InputShowStatic.SetBkColor(RGB(255, 255, 255));
167     m_InputShowStatic.SetTextColor(RGB(255, 128, 128));
168     m_InputShowStatic.SetTextSize(20);
b978bf 169 //*/
0ed438 170     //m_InputShowEdit.SetReadOnly(true);
Q 171 ///*
b978bf 172     if (!m_wndTBar_Num_Key.CreateEx(this, TBSTYLE_FLAT, 
0ed438 173         WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
Q 174         CRect(1,1,1,1),IDW_TOOL_BAR2) ||
b978bf 175         !m_wndTBar_Num_Key.LoadToolBar(IDR_TOOLBAR_NUM_KEY))
0ed438 176     {
b978bf 177         TRACE0("未能创建数字键工具栏\n");
0ed438 178         return -1;      // 未能创建
Q 179     }
180 //*/
181
182 ///*
b978bf 183     if (!m_wndTBar_Edit_Key.CreateEx(this, TBSTYLE_FLAT,
0ed438 184         WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
b978bf 185         CRect(1, 1, 1, 1), IDR_TOOLBAR_EDIT_KEY) ||
Q 186         !m_wndTBar_Edit_Key.LoadToolBar(IDR_TOOLBAR_EDIT_KEY))
0ed438 187     {
b978bf 188         TRACE0("未能创建编辑键工具栏\n");
0ed438 189         return -1;      // 未能创建
Q 190     }
191     //*/
b978bf 192 /*
Q 193     if (!m_wndToolBar_Func_Key.CreateEx(this, TBSTYLE_FLAT,
194         WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
195         CRect(1, 1, 1, 1), IDW_TOOL_BAR_FUNC_KEY) ||
196         !m_wndToolBar_Func_Key.LoadToolBar(IDR_TOOLBAR_FUNC_KEY2))
197     {
198         TRACE0("未能创建功能键工具栏\n");
199         return -1;      // 未能创建
200     }
201     //m_wndToolBar_Func_Key.SetTwoRowsWithSibling();
202     //*/
203     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,
204         IDD_DIALOGBAR_INPUT_SHOW))
205     {
206         TRACE0("未能创建功能键2工具栏\n");
207         return -1;      // 未能创建
208     }
209
210     ///*
211     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,
212         IDD_DIALOGBAR_FUNC_KEYS))
213     {
214         TRACE0("未能创建功能键2工具栏\n");
215         return -1;      // 未能创建
216     }
217 //    ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, TRUE);
218 //    m_wndDlgBar_Func_Key.MoveWindow(100, 100, 200, 200);
219     //*/
0ed438 220
Q 221     if (!m_wndStatusBar.Create(this))
222     {
223         TRACE0("未能创建状态栏\n");
224         return -1;      // 未能创建
225     }
226     m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
227     m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH);
e00d5a 228     //m_wndStatusBar.OnCtlColor();
b978bf 229 /*
Q 230     if (!m_wndMyPaneLog.Create(_T("日志窗口"), this->GetParent(), CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
0ed438 231         | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
Q 232     {
233         TRACE0("未能创建“MyPaneLog窗口\n");
234         return FALSE;
235     }
b978bf 236 //    m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY);
0ed438 237
Q 238 //*/
b978bf 239     m_dlgMyLog.Create(m_dlgMyLog.IDD, this);
Q 240 //    m_dlgMyLog.ModifyStyle(0, WS_POPUPWINDOW);
241     m_dlgMyLog.ShowWindow(SW_SHOW);
242
0ed438 243     // TODO: 如果不需要可停靠工具栏,则删除这三行
Q 244     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
245     EnableDocking(CBRS_ALIGN_ANY);
b978bf 246     //DockPane(&m_wndToolBar);
Q 247     DockControlBar(&m_wndToolBar);
0ed438 248
Q 249 //    EnableDocking(CBRS_ALIGN_ANY);
250
b978bf 251
Q 252
65f713 253 //    CDockablePane* pTabbedBar = nullptr;
Q 254 //    m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
255
0ed438 256
Q 257 ///*
b978bf 258     m_wndDlgBar_InputShow.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
Q 259     m_wndTBar_Num_Key.EnableDocking(CBRS_ALIGN_ANY);
260     m_wndTBar_Edit_Key.EnableDocking(CBRS_ALIGN_ANY);
261 //    m_wndToolBar_Func_Key.EnableDocking(CBRS_ALIGN_ANY);
262     m_wndDlgBar_Func_Key.EnableDocking(CBRS_ALIGN_TOP| CBRS_ALIGN_BOTTOM);
0ed438 263
Q 264     EnableDocking(CBRS_ALIGN_ANY);
265
266 //    DockPane(&m_wndToolBar);
267
b978bf 268     DockControlBar(&m_wndDlgBar_InputShow);
Q 269     DockControlBar(&m_wndTBar_Num_Key);
270     DockControlBar(&m_wndTBar_Edit_Key);
271 //    DockPane(&m_wndToolBar_Func_Key);
272 //    DockPane(&m_wndDlgBar_Func_Key);
273     DockControlBar(&m_wndDlgBar_Func_Key);
274 //    DockPane(&m_wndMyPaneLog);
275
276
0ed438 277 //*/
Q 278     return 0;
279 }
e00d5a 280
0ed438 281
Q 282 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
283 {
b978bf 284     if( !CMDIFrameWnd::PreCreateWindow(cs) )
0ed438 285         return FALSE;
Q 286     // TODO: 在此处通过修改
287     //  CREATESTRUCT cs 来修改窗口类或样式
288
289     return TRUE;
290 }
291
292 // CMainFrame 诊断
293
294 #ifdef _DEBUG
295 void CMainFrame::AssertValid() const
296 {
b978bf 297     CMDIFrameWnd::AssertValid();
0ed438 298 }
Q 299
300 void CMainFrame::Dump(CDumpContext& dc) const
301 {
b978bf 302     CMDIFrameWnd::Dump(dc);
0ed438 303 }
Q 304 #endif //_DEBUG
305
306
307 // CMainFrame 消息处理程序
308
309
310
311 void CMainFrame::OnUploadFromPlc()
312 {
313     // TODO: 在此添加命令处理程序代码
b978bf 314     SysLog(_T("Upload from PLC, (From mainframe)"));
0ed438 315     CWinAppEx* pApp = &theApp;
b978bf 316     
Q 317     POSITION curTemplatePos = theApp.m_pDocManager->GetFirstDocTemplatePosition();
0ed438 318     if (curTemplatePos != NULL)
Q 319     {
b978bf 320         CDocTemplate* curTemplate = theApp.m_pDocManager->GetNextDocTemplate(curTemplatePos);
Q 321         CMTerm2Doc* pDoc = (CMTerm2Doc* ) curTemplate->OpenDocumentFile(NULL);
322         if (pDoc)     pDoc->OnUploadFromPlc();
0ed438 323     }
Q 324
325 }
326
327 void CMainFrame::OnMenuShowLog()
328 {
329     // TODO: 在此添加命令处理程序代码
330     m_wndMyPaneLog.ShowWindow(SW_SHOW);
b978bf 331     m_wndNavView.ShowWindow(SW_SHOW);
0ed438 332 }
Q 333
334
335 void CMainFrame::OnViewFunckeyBar()
336 {
337     // TODO: 在此添加命令处理程序代码
b978bf 338     CString s1;
Q 339     s1.Format(_T("显示功能键栏"));
340     SysLog(s1);
341     m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE);
342     m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW);
343     ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE);
e00d5a 344     
0ed438 345 }
Q 346
347
348 void CMainFrame::OnUpdateViewFunckeyBar(CCmdUI *pCmdUI)
349 {
350     // TODO: 在此添加命令更新用户界面处理程序代码
b978bf 351
0ed438 352 }
Q 353
354
355 void CMainFrame::OnViewInputBar()
356 {
357     // TODO: 在此添加命令处理程序代码
358 }
359
360
361 void CMainFrame::OnUpdateViewInputBar(CCmdUI *pCmdUI)
362 {
363     // TODO: 在此添加命令更新用户界面处理程序代码
364 }
365
366
367 void CMainFrame::OnViewNumkeyBar()
368 {
369     // TODO: 在此添加命令处理程序代码
b978bf 370     CString s1;
Q 371     s1.Format(_T("显示数字键栏"));
372     SysLog(s1);
373     m_wndTBar_Num_Key.ShowWindow(SW_HIDE);
374     m_wndTBar_Num_Key.ShowWindow(SW_SHOW);
375
0ed438 376 }
Q 377
378
379 void CMainFrame::OnUpdateViewNumkeyBar(CCmdUI *pCmdUI)
380 {
381     // TODO: 在此添加命令更新用户界面处理程序代码
382 }
383
384
385 void CMainFrame::OnViewInputsegBar()
386 {
387     // TODO: 在此添加命令处理程序代码
388 }
389
390
391 void CMainFrame::OnUpdateViewInputsegBar(CCmdUI *pCmdUI)
392 {
393     // TODO: 在此添加命令更新用户界面处理程序代码
394 }
395
396
397 void CMainFrame::OnViewCommentsBar()
398 {
399     // TODO: 在此添加命令处理程序代码
400 }
401
402
403 void CMainFrame::OnUpdateViewCommentsBar(CCmdUI *pCmdUI)
404 {
405     // TODO: 在此添加命令更新用户界面处理程序代码
406 }
407 /*
408 CView * FindView(CDocument * pDoc, CRuntimeClass * pClass)
409 {
410     CView* pView = NULL;
411     POSITION pos = pDoc->GetFirstViewPosition();
412     while (pos != NULL)
413     {
414         pView = pDoc->GetNextView(pos);
415         if (pView->IsKindOf(pClass))
416             break;
417     }
418     if (!pView->IsKindOf(pClass))
419     {
420         //AfxMessageBox("Connt Locate the View.");
421         return NULL;
422     }
423     return pView;
424 }
425 */
426
e00d5a 427 int CMainFrame::GetInputInfo(int inputInfo)
YC 428 {
429     // TODO: 在此处添加实现代码.
430     CString        m_InputInfo;
431
432     CString s1;
433     s1.Format(_T("From MainFrame , input %s"), m_InputInfo);
434     SysLog(s1);
435
436     m_wndDlgBar_InputShow.SetDisplay(inputInfo);
437
438     return 0;
439 }
440
441 void CMainFrame::OnBtn0()
442 {
443     // TODO: 在此添加命令处理程序代码
444     m_wndDlgBar_InputShow.SetDisplay(0x00030000);
445 }
446 void CMainFrame::OnBtn1()
447 {
448     // TODO: 在此添加命令处理程序代码
449     m_wndDlgBar_InputShow.SetDisplay(0x00030001);
450 }
451 void CMainFrame::OnBtn2()
452 {
453     // TODO: 在此添加命令处理程序代码
454     m_wndDlgBar_InputShow.SetDisplay(0x00030002);
455 }
456 void CMainFrame::OnBtn3()
457 {
458     // TODO: 在此添加命令处理程序代码
459     m_wndDlgBar_InputShow.SetDisplay(0x00030003);
460 }
461 void CMainFrame::OnBtn4()
462 {
463     // TODO: 在此添加命令处理程序代码
464     m_wndDlgBar_InputShow.SetDisplay(0x00030004);
465 }
466 void CMainFrame::OnBtn5()
467 {
468     // TODO: 在此添加命令处理程序代码
469     m_wndDlgBar_InputShow.SetDisplay(0x00030005);
470 }
471 void CMainFrame::OnBtn6()
472 {
473     // TODO: 在此添加命令处理程序代码
474     m_wndDlgBar_InputShow.SetDisplay(0x00030006);
475 }
476 void CMainFrame::OnBtn7()
477 {
478     // TODO: 在此添加命令处理程序代码
479     m_wndDlgBar_InputShow.SetDisplay(0x00030007);
480 }
481 void CMainFrame::OnBtn8()
482 {
483     // TODO: 在此添加命令处理程序代码
484     m_wndDlgBar_InputShow.SetDisplay(0x00030008);
485 }
486 void CMainFrame::OnBtn9()
487 {
488     // TODO: 在此添加命令处理程序代码
489     m_wndDlgBar_InputShow.SetDisplay(0x00030009);
490 }
491 void CMainFrame::OnBtnA()
492 {
493     // TODO: 在此添加命令处理程序代码
494     m_wndDlgBar_InputShow.SetDisplay(0x0003000A);
495 }
496 void CMainFrame::OnBtnB()
497 {
498     // TODO: 在此添加命令处理程序代码
499     m_wndDlgBar_InputShow.SetDisplay(0x0003000B);
500 }
501 void CMainFrame::OnBtnC()
502 {
503     // TODO: 在此添加命令处理程序代码
504     m_wndDlgBar_InputShow.SetDisplay(0x0003000C);
505 }
506
507 void CMainFrame::OnBtnD()
508 {
509     // TODO: 在此添加命令处理程序代码
510     m_wndDlgBar_InputShow.SetDisplay(0x0003000D);
511 }
512 void CMainFrame::OnBtnE()
513 {
514     // TODO: 在此添加命令处理程序代码
515     m_wndDlgBar_InputShow.SetDisplay(0x0003000E);
516 }
517 void CMainFrame::OnBtnF()
518 {
519     // TODO: 在此添加命令处理程序代码
520
521     m_wndDlgBar_InputShow.SetDisplay(0x0003000F);
522
523
524
525 }
526 void CMainFrame::OnBtnMinus()
527 {
528     // TODO: 在此添加命令处理程序代码
529     //m_wndDlgBar_InputShow.SetDisplay(_T("-"));
530 }
531 void CMainFrame::OnBtnDot()
532 {
533     // TODO: 在此添加命令处理程序代码
534     //m_wndDlgBar_InputShow.SetDisplay(_T("."));
535 }
536
537
538
539
540 int CMainFrame::GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell)
541 {
542     
543     localInputCell = inputCell;
544     return 0;
545 }
546
547
548 void CMainFrame::OnBtnRet()
549 {
550     // TODO: 在此添加命令处理程序代码
551     CString strName;
552      CMTerm2View::stCell cell1;
553
554     CMDIChildWnd  *pChild = (CMDIChildWnd   *)GetActiveFrame();
555     CView   *p1 = (CView*)pChild->GetActiveView();
556
557     CMTerm2View * p2 = (CMTerm2View *)p1;
558     m_wndDlgBar_InputShow.SetDisplay(0x00140000);
559
560     switch (localInputCell.OP)
561     {
562     case CMTerm2View::typeNO:
563     case CMTerm2View::typeNC:
564     case CMTerm2View::typeOUT:
565     case CMTerm2View::typeSET:
566     case CMTerm2View::typeRESET:
567     case CMTerm2View::typeTM:
568         switch (localInputCell.param)
569         {
570         case KLCoilTypeX:
571             strName = "X";
572             break;
573         case KLCoilTypeY:
574             strName = "Y";
575             break;
576         case KLCoilTypeR:
577             strName = "R";
578             break;
579         case KLCoilTypeLR:
580             strName = "L";
581             break;
582         case KLCoilTypeT:
583             strName = "T";
584             break;
585         case KLCoilTypeC:
586             strName = "C";
587             break;
588         case OP_TMX:
589             strName = "TMX   ";
590         case OP_TMY:
591             strName = "TMY   ";
592         case OP_TMR:
593             strName = "TMR   ";
594         case OP_TML:
595             strName = "TML   ";
596         default:
597             break;
598         }
599     default:
600         break;        
601     }
602
603
604
605     cell1.sCoilName = strName + localInputCell.num;
606     cell1.nType = localInputCell.OP;
607     //cell1.sCoilName = "R555";
608     cell1.nProgStep = 0;
609     cell1.bEditing = 1;
610     cell1.sParam = "D88";
611     cell1.bLeftLineUp = 0;
612     cell1.nDataType = CMTerm2View::typeCoil;
613
614     p2->GetIncToView(cell1);   
615
616     
617     m_wndDlgBar_Func_Key.SetBtnDisplayESC();
618 }
619 void CMainFrame::OnBtnInsert()
620 {
621     // TODO: 在此添加命令处理程序代码
622     m_wndDlgBar_InputShow.SetDisplay(0x00240000);
623     m_wndDlgBar_Func_Key.SetBtnDisplayESC();
624 }
625 void CMainFrame::OnBtnDelete()
626 {
627     // TODO: 在此添加命令处理程序代码
628     m_wndDlgBar_InputShow.SetDisplay(0x00340000);
629     m_wndDlgBar_Func_Key.SetBtnDisplayESC();
630 }
631 void CMainFrame::OnBtnEsc()
632 {
633     // TODO: 在此添加命令处理程序代码
634     //m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
635     m_wndDlgBar_Func_Key.SetBtnDisplayESC();
636 }
637
638 void CMainFrame::OnMenuShowDev()
639 {
640     // TODO: 在此添加命令处理程序代码
641
642 }