2022-06-21 | Yao Chunli | |
2022-06-21 | Yao Chunli | |
2022-05-27 | QuakeGod |
MTerm2/0prog3.kpg
@@ -93,5 +93,11 @@ DT35 绿灯2剩余秒数 DT36 绿灯2 秒余数 DT22 绿灯1剩余时间 R7 R7 R3 R3 R70 R70 R71 R71 R72 R723 R73 R73 [MONCOILLIST] [MONDATALIST] MTerm2/CMyFuncKeyToolBar.cpp
New file @@ -0,0 +1,45 @@ #include "pch.h" #include "CMyFuncKeyToolBar.h" BEGIN_MESSAGE_MAP(CMyFuncKeyToolBar, CMFCToolBar) ON_WM_CREATE() ON_WM_SIZE() END_MESSAGE_MAP() structButton myButtons[] = { {33001,_T("11") }, {33002,_T("12") }, {33003,_T("13") }, {33004,_T("14") }, {33005,_T("15") }, {33006,_T("16") }, {33007,_T("17") }, {33008,_T("18") }, {33009,_T("19") }, {33010,_T("110") }, {33011,_T("111") }, {33012,_T("112") }, }; static int myButtonCount = sizeof(myButtons) / sizeof(structButton); int CMyFuncKeyToolBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMFCToolBar::OnCreate(lpCreateStruct) == -1) return -1; CRect rect1(0, 0, 100, 24); // TODO: 在此添加您专用的创建代码 m_buttons[1].Create(myButtons[1].sCaption,WS_CHILD | WS_TABSTOP | WS_VISIBLE |BS_PUSHBUTTON ,rect1, this, myButtons[1].nID); CRect rect0(0, 0, 500, 48); this->MoveWindow(rect0); return 0; } void CMyFuncKeyToolBar::OnSize(UINT nType, int cx, int cy) { //CMFCToolBar::OnSize(nType, cx, cy); // CRect rect0(0, 0, 500, 48); // this->MoveWindow(rect0); // TODO: 在此处添加消息处理程序代码 } MTerm2/CMyFuncKeyToolBar.h
New file @@ -0,0 +1,22 @@ #pragma once #include <afxtoolbar.h> typedef struct tagStructButton { int nID; CString sCaption; }structButton; class CMyFuncKeyToolBar : public CMFCToolBar { public: DECLARE_MESSAGE_MAP() afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); CButton m_buttons[100]; afx_msg void OnSize(UINT nType, int cx, int cy); }; MTerm2/ChildFrm.cpp
@@ -14,9 +14,9 @@ // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx) IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) ON_WM_CREATE() END_MESSAGE_MAP() @@ -46,7 +46,7 @@ BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式 if( !CMDIChildWndEx::PreCreateWindow(cs) ) if( !CMDIChildWnd::PreCreateWindow(cs) ) return FALSE; //修改窗口的类型为最大化样式 // cs.style = cs.style | WS_MAXIMIZE | WS_VISIBLE; @@ -58,12 +58,12 @@ #ifdef _DEBUG void CChildFrame::AssertValid() const { CMDIChildWndEx::AssertValid(); CMDIChildWnd::AssertValid(); } void CChildFrame::Dump(CDumpContext& dc) const { CMDIChildWndEx::Dump(dc); CMDIChildWnd::Dump(dc); } #endif //_DEBUG @@ -72,7 +72,7 @@ int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWndEx::OnCreate(lpCreateStruct) == -1) if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: 在此添加您专用的创建代码 @@ -144,7 +144,7 @@ // m_wndToolBar_InfoShow.EnableDocking(CBRS_ALIGN_ANY); // this->RecalcLayout(); // DockPane(&m_wndToolBar_InputShow); // DockPane(&m_wndTBar_InputShow); return 0; } MTerm2/ChildFrm.h
@@ -4,7 +4,7 @@ #pragma once #include "../MyLib/StaticEx.h" class CChildFrame : public CMDIChildWndEx class CChildFrame : public CMDIChildWnd { DECLARE_DYNCREATE(CChildFrame) public: @@ -13,7 +13,7 @@ // 特性 protected: CSplitterWnd m_wndSplitter; CMFCStatusBar m_wndStatusBar; CStatusBar m_wndStatusBar; CToolBar m_wndToolBar_InfoShow; CStaticEx m_StaticShowMachine; CStaticEx m_StaticShowProgPos; @@ -23,7 +23,7 @@ CStaticEx m_StaticShowAddress; public: CMFCStatusBar *GetStatusBar() CStatusBar *GetStatusBar() { return &m_wndStatusBar; } MTerm2/DialogFactCfg.cpp
@@ -33,6 +33,19 @@ ON_BN_CLICKED(IDC_BUTTON_DISCONN, &CDialogFactCfg::OnBnClickedButtonDisconn) ON_BN_CLICKED(IDC_BUTTON_READDATA, &CDialogFactCfg::OnBnClickedButtonReaddata) ON_BN_CLICKED(IDC_BUTTON_WRITEDATA, &CDialogFactCfg::OnBnClickedButtonWritedata) ON_BN_CLICKED(IDC_BUTTON1, &CDialogFactCfg::OnBnClickedBtn1) ON_BN_CLICKED(IDC_BUTTON3, &CDialogFactCfg::OnBnClickedBtn3) ON_BN_CLICKED(IDC_BUTTON4, &CDialogFactCfg::OnBnClickedBtn4) ON_BN_CLICKED(IDC_BUTTON5, &CDialogFactCfg::OnBnClickedBtn5) ON_BN_CLICKED(IDC_BUTTON_CLEAR, &CDialogFactCfg::OnBnClickedBtnClear) ON_BN_CLICKED(IDC_BUTTON_ADD, &CDialogFactCfg::OnBnClickedBtnAdd) ON_BN_CLICKED(IDC_BUTTON_BACKSPACE, &CDialogFactCfg::OnBnClickedBtnBackSpace) ON_BN_CLICKED(IDC_BUTTON_0, &CDialogFactCfg::OnBnClickedButton0) ON_BN_CLICKED(IDC_BUTTON1_DOT, &CDialogFactCfg::OnBnClickedButton1Dot) ON_BN_CLICKED(IDC_BUTTON_EQ, &CDialogFactCfg::OnBnClickedButtonEq) END_MESSAGE_MAP() // CDialogFactCfg 消息处理程序 @@ -600,3 +613,98 @@ } CString saveInputStr=_T(""), saveInput1Str= _T(""); CString sDisplayStr; CString sStoreStr; bool bEditEndFlg = false; int CDialogFactCfg::CharKeyClick(CString sKey) { // TODO: 在此处添加实现代码. if (bEditEndFlg) { sDisplayStr.Empty(); bEditEndFlg = false; } sDisplayStr.Append(sKey); int len1 = sDisplayStr.GetLength(); if (len1 > 1 && sDisplayStr[0] == _T('0')) sDisplayStr = sDisplayStr.Right(sDisplayStr.GetLength() - 1); SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr); return 0; } void CDialogFactCfg::OnBnClickedBtn1() { CharKeyClick(_T("1")); } void CDialogFactCfg::OnBnClickedBtn3() { CharKeyClick(_T("3")); } void CDialogFactCfg::OnBnClickedBtn4() { CharKeyClick(_T("4")); } void CDialogFactCfg::OnBnClickedBtn5() { CharKeyClick(_T("5")); } void CDialogFactCfg::OnBnClickedBtnClear() { sDisplayStr.Empty(); bEditEndFlg = false; SetDlgItemText(IDC_EDIT_VIEW, _T("0")); } void CDialogFactCfg::OnBnClickedBtnAdd() { bEditEndFlg = true; sStoreStr = sDisplayStr; //saveInput1Str = saveInputStr; //saveInputStr = ""; } void CDialogFactCfg::OnBnClickedBtnBackSpace() { int len1 = sDisplayStr.GetLength(); if (len1 > 1) { sDisplayStr = sDisplayStr.Left(sDisplayStr.GetLength() - 1); } else if (len1 == 1) { sDisplayStr = "0"; } // bEditEndFlg = false; SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr); } void CDialogFactCfg::OnBnClickedButton0() { // TODO: 在此添加控件通知处理程序代码 CharKeyClick(_T("0")); } void CDialogFactCfg::OnBnClickedButton1Dot() { // TODO: 在此添加控件通知处理程序代码 CharKeyClick(_T(".")); } void CDialogFactCfg::OnBnClickedButtonEq() { // TODO: 在此添加控件通知处理程序代码 bEditEndFlg = true; float a = _tstof(sStoreStr); float b = _tstof(sDisplayStr); float c = a + b; sDisplayStr.Format(_T("%g"),c); SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr); } MTerm2/DialogFactCfg.h
@@ -78,6 +78,16 @@ afx_msg void OnBnClickedButtonDisconn(); afx_msg void OnBnClickedButtonWritedata(); afx_msg void OnBnClickedButtonReaddata(); afx_msg void OnBnClickedBtn1(); afx_msg void OnBnClickedBtn3(); afx_msg void OnBnClickedBtn4(); afx_msg void OnBnClickedBtn5(); afx_msg void OnBnClickedBtnClear(); afx_msg void OnBnClickedBtnAdd(); afx_msg void OnBnClickedBtnBackSpace(); int WriteData(); CMTerm2Doc * GetDocument(); @@ -91,4 +101,8 @@ int SetDataByName(void * pDataBlock, CString sName, UINT uValue); int SetDataByName(void * pDataBlock, CString sName, CString sValue); int CharKeyClick(CString sKey); afx_msg void OnBnClickedButton0(); afx_msg void OnBnClickedButton1Dot(); afx_msg void OnBnClickedButtonEq(); }; MTerm2/MTerm2.rcBinary files differ
MTerm2/MTerm2.vcxproj
@@ -191,6 +191,7 @@ </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="AnsiParser.h" /> <ClInclude Include="CMyFuncKeyToolBar.h" /> <ClInclude Include="DataParser1.h" /> <ClInclude Include="DialogCoilMon.h" /> <ClInclude Include="DialogCommSet1.h" /> @@ -211,6 +212,8 @@ <ClInclude Include="DialogStatusShow.h" /> <ClInclude Include="DialogSysRegSet.h" /> <ClInclude Include="ChildFrm.h" /> <ClInclude Include="MyDlgBarFuncKey.h" /> <ClInclude Include="MyDlgBarInputShow.h" /> <ClInclude Include="PropCommCfg.h" /> <ClInclude Include="PropInputCfg.h" /> <ClInclude Include="PropMemCfg.h" /> @@ -245,6 +248,7 @@ <ItemGroup> <ClCompile Include="..\MyLib\StaticEx.cpp" /> <ClCompile Include="AnsiParser.cpp" /> <ClCompile Include="CMyFuncKeyToolBar.cpp" /> <ClCompile Include="DataParser1.cpp" /> <ClCompile Include="DialogCoilMon.cpp" /> <ClCompile Include="DialogCommSet1.cpp" /> @@ -264,6 +268,8 @@ <ClCompile Include="DialogStatusShow.cpp" /> <ClCompile Include="DialogSysRegSet.cpp" /> <ClCompile Include="ChildFrm.cpp" /> <ClCompile Include="MyDlgBarFuncKey.cpp" /> <ClCompile Include="MyDlgBarInputShow.cpp" /> <ClCompile Include="PropCommCfg.cpp" /> <ClCompile Include="PropInputCfg.cpp" /> <ClCompile Include="PropMemCfg.cpp" /> @@ -308,6 +314,7 @@ <Image Include="res\bmp00001.bmp" /> <Image Include="res\bmp00002.bmp" /> <Image Include="res\bmp00003.bmp" /> <Image Include="res\bmp00004.bmp" /> <Image Include="res\classview.bmp" /> <Image Include="res\classview_hc.bmp" /> <Image Include="res\class_view.ico" /> @@ -323,6 +330,8 @@ <Image Include="res\Toolbar.bmp" /> <Image Include="res\toolbar1.bmp" /> <Image Include="res\toolbar2.bmp" /> <Image Include="res\toolbar_.bmp" /> <Image Include="res\toolbar_func_key.bmp" /> </ItemGroup> <ItemGroup> <Text Include="design1.txt" /> MTerm2/MTerm2.vcxproj.filters
@@ -168,6 +168,15 @@ <ClInclude Include="DialogFactCfg.h"> <Filter>头文件</Filter> </ClInclude> <ClInclude Include="CMyFuncKeyToolBar.h"> <Filter>头文件</Filter> </ClInclude> <ClInclude Include="MyDlgBarFuncKey.h"> <Filter>头文件</Filter> </ClInclude> <ClInclude Include="MyDlgBarInputShow.h"> <Filter>头文件</Filter> </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="MainFrm.cpp"> @@ -311,6 +320,15 @@ <ClCompile Include="DialogFactCfg.cpp"> <Filter>源文件</Filter> </ClCompile> <ClCompile Include="CMyFuncKeyToolBar.cpp"> <Filter>源文件</Filter> </ClCompile> <ClCompile Include="MyDlgBarFuncKey.cpp"> <Filter>源文件</Filter> </ClCompile> <ClCompile Include="MyDlgBarInputShow.cpp"> <Filter>源文件</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="MTerm2.rc"> @@ -381,6 +399,15 @@ <Image Include="res\bitmap1.bmp"> <Filter>资源文件</Filter> </Image> <Image Include="res\toolbar_.bmp"> <Filter>资源文件</Filter> </Image> <Image Include="res\toolbar_func_key.bmp"> <Filter>资源文件</Filter> </Image> <Image Include="res\bmp00004.bmp"> <Filter>资源文件</Filter> </Image> </ItemGroup> <ItemGroup> <Text Include="design1.txt" /> MTerm2/MTerm2CtrlView.h
@@ -14,7 +14,7 @@ public: // CMTerm2Doc* GetDocument() const; CMFCStatusBar * m_pStatusBar; CStatusBar * m_pStatusBar; #ifdef AFX_DESIGN_TIME enum { IDD = IDD_MTerm2CtrlView }; #endif MTerm2/MTerm2View.cpp
@@ -1192,8 +1192,8 @@ s1.Format(_T("LD db Clk %d %d %02X Scroll %d %d Total %d %d Row %d Col %d"), point.x, point.y, nFlags, scroll1.x, scroll1.y, tx, ty, nRow, nCol); m_pStatusBar->SetPaneText(6, s1); m_pStatusBar->SetPaneBackgroundColor(6, RGB(255, 255, 0)); m_pStatusBar->SetPaneTextColor(6, RGB(0, 0, 255)); // m_pStatusBar->SetPaneBackgroundColor(6, RGB(255, 255, 0)); // m_pStatusBar->SetPaneTextColor(6, RGB(0, 0, 255)); // m_pStatusBar->EnablePaneProgressBar(6); // m_pStatusBar->SetPaneProgress(6, 5); SysLog(s1); @@ -1445,11 +1445,39 @@ Cells[m_FocusRow][j].bLeftLineDn = 1; } } m_bModified = 1; needReDraw = 1; this->RedrawWindow(); } int FindTypeIndex(CString str[], CString strType, int num) { for (int i = 0;i < num;i++) { if (strType == str[i]) { return i; } } return -1; } void CMTerm2View::GetIncToView(stCell cell1) //**************************************************************************************************// { Cells[m_FocusRow][m_FocusCol] = cell1; m_bModified = 1; needReDraw = 1; m_FocusCol += 1; if (m_FocusCol >= 16) { m_FocusCol = 0;m_FocusRow += 1; } this->RedrawWindow(); } void CMTerm2View::OnUpdateInsertBlankLine(CCmdUI *pCmdUI) { // TODO: 在此添加命令更新用户界面处理程序代码 @@ -1535,17 +1563,17 @@ if (!pDoc->m_bOnline) { s1 = _T("离线"); m_pStatusBar->SetPaneText(idxOnline, s1); m_pStatusBar->SetPaneBackgroundColor(idxOnline); // m_pStatusBar->SetPaneBackgroundColor(idxOnline); } else if (pDoc->m_bOnline) { if (pDoc->m_bSimulate) { s1 = _T("在线(仿真)"); m_pStatusBar->SetPaneText(2, s1); m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor); // m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor); }else{ s1 = _T("在线"); m_pStatusBar->SetPaneText(2, s1); m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor); // m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor); } } } @@ -1553,20 +1581,20 @@ if (!pDoc->m_bOnline) { s1 = _T(""); m_pStatusBar->SetPaneText(idxRunning, s1); m_pStatusBar->SetPaneBackgroundColor(idxRunning); m_pStatusBar->SetPaneWidth(idxRunning, 0); // m_pStatusBar->SetPaneBackgroundColor(idxRunning); // m_pStatusBar->SetPaneWidth(idxRunning, 0); m_pStatusBar->SetPaneStyle(idxRunning, SBPS_DISABLED); }else if (!pDoc->m_bPlcRunning) { s1 = _T("PROG"); m_pStatusBar->SetPaneText(idxRunning, s1); m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength()*8); m_pStatusBar->SetPaneBackgroundColor(idxRunning, ProgColor); // m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength()*8); // m_pStatusBar->SetPaneBackgroundColor(idxRunning, ProgColor); }else { s1 = _T("RUN"); m_pStatusBar->SetPaneText(idxRunning, s1); m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength() * 8); m_pStatusBar->SetPaneBackgroundColor(idxRunning, RunningColor); // m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength() * 8); // m_pStatusBar->SetPaneBackgroundColor(idxRunning, RunningColor); } } if (nIndex == idxMonitor || nIndex == -1) { // 监控 // @@ -1574,11 +1602,11 @@ if (!m_bMonitoring) { s1 = _T("[监控停止]"); m_pStatusBar->SetPaneText(idxMonitor, s1); m_pStatusBar->SetPaneBackgroundColor(idxMonitor); // m_pStatusBar->SetPaneBackgroundColor(idxMonitor); }else{ s1 = _T("[正在监控]"); m_pStatusBar->SetPaneText(idxMonitor, s1); m_pStatusBar->SetPaneBackgroundColor(idxMonitor, MonitorColor); // m_pStatusBar->SetPaneBackgroundColor(idxMonitor, MonitorColor); } } if (nIndex == idxAddress || nIndex == -1) { // 地址,本站 @@ -1586,11 +1614,11 @@ if (!pDoc->m_bOnline) { s1 = _T("本站"); m_pStatusBar->SetPaneText(idxAddress, s1); m_pStatusBar->SetPaneBackgroundColor(idxMonitor); // m_pStatusBar->SetPaneBackgroundColor(idxMonitor); }else { s1 = _T("本站"); m_pStatusBar->SetPaneText(idxAddress, s1); m_pStatusBar->SetPaneBackgroundColor(idxMonitor, AddressColor); // m_pStatusBar->SetPaneBackgroundColor(idxMonitor, AddressColor); } } @@ -1659,12 +1687,12 @@ if (pDoc->m_bPlcRunning) { s1 = _T("运行"); m_pStatusBar->SetPaneText(3, s1); m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0)); // m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0)); } else { s1 = _T("停止"); m_pStatusBar->SetPaneText(3, s1); m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0)); // m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0)); } s1.Format(_T("PCmdUI %d %d"), pCmdUI->m_nID, pCmdUI->m_nIndex); DbgLog(s1); @@ -2722,3 +2750,4 @@ } return 0; } MTerm2/MTerm2View.h
@@ -16,7 +16,7 @@ // 特性 public: CMFCStatusBar * m_pStatusBar; CStatusBar * m_pStatusBar; CMTerm2Doc* GetDocument() const; //从文档获取程序 @@ -281,6 +281,8 @@ afx_msg void OnInputIoComment(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); int ScanLDSCells(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection & progsec, CString & sProgSec, int &nSteps); void GetIncToView(stCell cell1); }; #ifndef _DEBUG // MultiTerminal2View.cpp 中的调试版本 MTerm2/MainFrm.cpp
@@ -13,6 +13,7 @@ #include "MTerm2CtrlView.h" #include "MTerm2TestView.h" #include "MTerm2ProgTxt.h" #include <windows.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -20,11 +21,11 @@ // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx) IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) ON_WM_CREATE() ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc) ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar) ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar) @@ -36,12 +37,34 @@ ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar) ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar) ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar) ON_COMMAND(ID_BUTTON_0, &CMainFrame::OnBtn0) ON_COMMAND(ID_BUTTON_1, &CMainFrame::OnBtn1) ON_COMMAND(ID_BUTTON_2, &CMainFrame::OnBtn2) ON_COMMAND(ID_BUTTON_3, &CMainFrame::OnBtn3) ON_COMMAND(ID_BUTTON_4, &CMainFrame::OnBtn4) ON_COMMAND(ID_BUTTON_5, &CMainFrame::OnBtn5) ON_COMMAND(ID_BUTTON_6, &CMainFrame::OnBtn6) ON_COMMAND(ID_BUTTON_7, &CMainFrame::OnBtn7) ON_COMMAND(ID_BUTTON_8, &CMainFrame::OnBtn8) ON_COMMAND(ID_BUTTON_9, &CMainFrame::OnBtn9) ON_COMMAND(ID_BUTTON_A, &CMainFrame::OnBtnA) ON_COMMAND(ID_BUTTON_B, &CMainFrame::OnBtnB) ON_COMMAND(ID_BUTTON_C, &CMainFrame::OnBtnC) ON_COMMAND(ID_BUTTON_D, &CMainFrame::OnBtnD) ON_COMMAND(ID_BUTTON_E, &CMainFrame::OnBtnE) ON_COMMAND(ID_BUTTON_F, &CMainFrame::OnBtnF) ON_COMMAND(ID_BUTTON_MINUS, &CMainFrame::OnBtnMinus) ON_COMMAND(ID_BUTTON_DOT, &CMainFrame::OnBtnDot) ON_COMMAND(ID_BUTTON_RET, &CMainFrame::OnBtnRet) ON_COMMAND(ID_BUTTON_INSERT, &CMainFrame::OnBtnInsert) ON_COMMAND(ID_BUTTON_DELETE, &CMainFrame::OnBtnDelete) ON_COMMAND(ID_BUTTON_ESC, &CMainFrame::OnBtnEsc) // ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds) // ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld) // ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl) ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog) ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev) END_MESSAGE_MAP() static UINT indicators[] = @@ -64,9 +87,19 @@ { } BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // TODO: 在此添加专用代码和/或调用基类 if (m_wndDlgBar_Func_Key.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) return TRUE; return CMDIFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // m_dlgMyLog.Create(m_dlgMyLog.IDD, GetParent()); // m_dlgMyLog.ShowWindow(SW_SHOW); @@ -77,13 +110,17 @@ CString strNavView; // bNameValid = strNavView.LoadString(IDS_CLASS_VIEW); // ASSERT(bNameValid); /* strNavView = _T("导航视图"); 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)) { TRACE0("未能创建“导航视图”窗口\n"); return FALSE; // 未能创建 } m_wndNavView.EnableDocking(CBRS_ALIGN_ANY); //DockPane(&m_wndNavView); //DockControlBar(&m_wndNavView); */ if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { @@ -91,37 +128,37 @@ return -1; // 未能创建 } ///* 输入栏 if (!m_wndToolBar_InputShow.CreateEx(this, TBSTYLE_FLAT, /* 输入栏 if (!m_wndTBar_InputShow.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1, 1, 1, 1), IDW_TOOL_BAR2) || !m_wndToolBar_InputShow.LoadToolBar(IDR_TOOLBAR_INPUT_SHOW)) !m_wndTBar_InputShow.LoadToolBar(IDR_TOOLBAR_INPUT_SHOW)) { TRACE0("未能创建数字工具栏\n"); return -1; // 未能创建 } //*/ CRect rect1; int index = m_wndToolBar_InputShow.CommandToIndex(ID_BUTTON_INPUT_SHOW); int index = m_wndTBar_InputShow.CommandToIndex(ID_BUTTON_INPUT_SHOW); UINT nID,nStyle; int iImage; m_wndToolBar_InputShow.GetButtonInfo(0, nID, nStyle, iImage); m_wndToolBar_InputShow.SetButtonInfo(index, ID_BUTTON_INPUT_SHOW, TBBS_SEPARATOR, 100); m_wndToolBar_InputShow.GetItemRect(index, &rect1); m_wndTBar_InputShow.GetButtonInfo(0, nID, nStyle, iImage); m_wndTBar_InputShow.SetButtonInfo(index, ID_BUTTON_INPUT_SHOW, TBBS_SEPARATOR, 100); m_wndTBar_InputShow.GetItemRect(index, &rect1); rect1.left = 1; rect1.top = 2; rect1.right = rect1.left + 100; rect1.bottom = rect1.top + 20; //*/ /* if (!m_InputShowEdit.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rect1, \ &m_wndToolBar_InputShow, ID_BUTTON_INPUT_SHOW)) &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW)) { TRACE(_T("Failed to create CEdit\n")); return FALSE; } //*/ if (!m_InputShowStatic.Create(_T("Test1"),WS_CHILD | WS_VISIBLE |WS_EX_CLIENTEDGE, rect1, \ &m_wndToolBar_InputShow, ID_BUTTON_INPUT_SHOW)) &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW)) { TRACE(_T("Failed to create CStaticEx\n")); return FALSE; @@ -129,30 +166,57 @@ m_InputShowStatic.SetBkColor(RGB(255, 255, 255)); m_InputShowStatic.SetTextColor(RGB(255, 128, 128)); m_InputShowStatic.SetTextSize(20); //*/ //m_InputShowEdit.SetReadOnly(true); ///* if (!m_wndToolBar_Num.CreateEx(this, TBSTYLE_FLAT, if (!m_wndTBar_Num_Key.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1),IDW_TOOL_BAR2) || !m_wndToolBar_Num.LoadToolBar(IDR_TOOLBAR_NUM)) !m_wndTBar_Num_Key.LoadToolBar(IDR_TOOLBAR_NUM_KEY)) { TRACE0("未能创建数字工具栏\n"); TRACE0("未能创建数字键工具栏\n"); return -1; // 未能创建 } //*/ ///* if (!m_wndToolBar_Edit.CreateEx(this, TBSTYLE_FLAT, if (!m_wndTBar_Edit_Key.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1, 1, 1, 1), IDW_TOOL_BAR_EDIT) || !m_wndToolBar_Edit.LoadToolBar(IDR_TOOLBAR_EDIT)) CRect(1, 1, 1, 1), IDR_TOOLBAR_EDIT_KEY) || !m_wndTBar_Edit_Key.LoadToolBar(IDR_TOOLBAR_EDIT_KEY)) { TRACE0("未能创建数字工具栏\n"); TRACE0("未能创建编辑键工具栏\n"); return -1; // 未能创建 } //*/ /* if (!m_wndToolBar_Func_Key.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1, 1, 1, 1), IDW_TOOL_BAR_FUNC_KEY) || !m_wndToolBar_Func_Key.LoadToolBar(IDR_TOOLBAR_FUNC_KEY2)) { TRACE0("未能创建功能键工具栏\n"); return -1; // 未能创建 } //m_wndToolBar_Func_Key.SetTwoRowsWithSibling(); //*/ 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, IDD_DIALOGBAR_INPUT_SHOW)) { TRACE0("未能创建功能键2工具栏\n"); return -1; // 未能创建 } ///* 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, IDD_DIALOGBAR_FUNC_KEYS)) { TRACE0("未能创建功能键2工具栏\n"); return -1; // 未能创建 } // ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, TRUE); // m_wndDlgBar_Func_Key.MoveWindow(100, 100, 200, 200); //*/ if (!m_wndStatusBar.Create(this)) { @@ -161,52 +225,63 @@ } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH); // /* if (!m_wndMyPaneLog.Create(_T("日志窗口"), this, CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS //m_wndStatusBar.OnCtlColor(); /* if (!m_wndMyPaneLog.Create(_T("日志窗口"), this->GetParent(), CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) { TRACE0("未能创建“MyPaneLog窗口\n"); return FALSE; } // m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY); //*/ m_dlgMyLog.Create(m_dlgMyLog.IDD, this); // m_dlgMyLog.ModifyStyle(0, WS_POPUPWINDOW); m_dlgMyLog.ShowWindow(SW_SHOW); // TODO: 如果不需要可停靠工具栏,则删除这三行 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndToolBar); //DockPane(&m_wndToolBar); DockControlBar(&m_wndToolBar); m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY); // EnableDocking(CBRS_ALIGN_ANY); m_wndNavView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndNavView); // CDockablePane* pTabbedBar = nullptr; // m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); ///* m_wndToolBar_InputShow.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar_Num.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar_Edit.EnableDocking(CBRS_ALIGN_ANY); m_wndDlgBar_InputShow.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM); m_wndTBar_Num_Key.EnableDocking(CBRS_ALIGN_ANY); m_wndTBar_Edit_Key.EnableDocking(CBRS_ALIGN_ANY); // m_wndToolBar_Func_Key.EnableDocking(CBRS_ALIGN_ANY); m_wndDlgBar_Func_Key.EnableDocking(CBRS_ALIGN_TOP| CBRS_ALIGN_BOTTOM); EnableDocking(CBRS_ALIGN_ANY); // DockPane(&m_wndToolBar); DockPane(&m_wndToolBar_InputShow); DockPane(&m_wndToolBar_Num); DockPane(&m_wndToolBar_Edit); DockPane(&m_wndMyPaneLog); DockControlBar(&m_wndDlgBar_InputShow); DockControlBar(&m_wndTBar_Num_Key); DockControlBar(&m_wndTBar_Edit_Key); // DockPane(&m_wndToolBar_Func_Key); // DockPane(&m_wndDlgBar_Func_Key); DockControlBar(&m_wndDlgBar_Func_Key); // DockPane(&m_wndMyPaneLog); //*/ return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWndEx::PreCreateWindow(cs) ) if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: 在此处通过修改 // CREATESTRUCT cs 来修改窗口类或样式 @@ -219,12 +294,12 @@ #ifdef _DEBUG void CMainFrame::AssertValid() const { CMDIFrameWndEx::AssertValid(); CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CMDIFrameWndEx::Dump(dc); CMDIFrameWnd::Dump(dc); } #endif //_DEBUG @@ -236,18 +311,16 @@ void CMainFrame::OnUploadFromPlc() { // TODO: 在此添加命令处理程序代码 SysLog(_T("Upload from PLC, (From mainframe)")); CWinAppEx* pApp = &theApp; POSITION curTemplatePos = pApp->GetFirstDocTemplatePosition(); POSITION curTemplatePos = theApp.m_pDocManager->GetFirstDocTemplatePosition(); if (curTemplatePos != NULL) { CDocTemplate* curTemplate = pApp->GetNextDocTemplate(curTemplatePos); curTemplate->OpenDocumentFile(NULL); //CView* thisView = GetActiveView(); CMTerm2Doc* pDoc = (CMTerm2Doc*)GetActiveDocument(); // pDoc->OnNewDocument(); pDoc->OnUploadFromPlc(); CDocTemplate* curTemplate = theApp.m_pDocManager->GetNextDocTemplate(curTemplatePos); CMTerm2Doc* pDoc = (CMTerm2Doc* ) curTemplate->OpenDocumentFile(NULL); if (pDoc) pDoc->OnUploadFromPlc(); } //SysLog(_T("From mainframe")); } @@ -255,18 +328,27 @@ { // TODO: 在此添加命令处理程序代码 m_wndMyPaneLog.ShowWindow(SW_SHOW); m_wndNavView.ShowWindow(SW_SHOW); } void CMainFrame::OnViewFunckeyBar() { // TODO: 在此添加命令处理程序代码 CString s1; s1.Format(_T("显示功能键栏")); SysLog(s1); m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE); m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW); ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE); } void CMainFrame::OnUpdateViewFunckeyBar(CCmdUI *pCmdUI) { // TODO: 在此添加命令更新用户界面处理程序代码 } @@ -285,6 +367,12 @@ void CMainFrame::OnViewNumkeyBar() { // TODO: 在此添加命令处理程序代码 CString s1; s1.Format(_T("显示数字键栏")); SysLog(s1); m_wndTBar_Num_Key.ShowWindow(SW_HIDE); m_wndTBar_Num_Key.ShowWindow(SW_SHOW); } @@ -336,3 +424,219 @@ } */ int CMainFrame::GetInputInfo(int inputInfo) { // TODO: 在此处添加实现代码. CString m_InputInfo; CString s1; s1.Format(_T("From MainFrame , input %s"), m_InputInfo); SysLog(s1); m_wndDlgBar_InputShow.SetDisplay(inputInfo); return 0; } void CMainFrame::OnBtn0() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030000); } void CMainFrame::OnBtn1() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030001); } void CMainFrame::OnBtn2() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030002); } void CMainFrame::OnBtn3() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030003); } void CMainFrame::OnBtn4() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030004); } void CMainFrame::OnBtn5() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030005); } void CMainFrame::OnBtn6() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030006); } void CMainFrame::OnBtn7() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030007); } void CMainFrame::OnBtn8() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030008); } void CMainFrame::OnBtn9() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00030009); } void CMainFrame::OnBtnA() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000A); } void CMainFrame::OnBtnB() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000B); } void CMainFrame::OnBtnC() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000C); } void CMainFrame::OnBtnD() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000D); } void CMainFrame::OnBtnE() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000E); } void CMainFrame::OnBtnF() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x0003000F); } void CMainFrame::OnBtnMinus() { // TODO: 在此添加命令处理程序代码 //m_wndDlgBar_InputShow.SetDisplay(_T("-")); } void CMainFrame::OnBtnDot() { // TODO: 在此添加命令处理程序代码 //m_wndDlgBar_InputShow.SetDisplay(_T(".")); } int CMainFrame::GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell) { localInputCell = inputCell; return 0; } void CMainFrame::OnBtnRet() { // TODO: 在此添加命令处理程序代码 CString strName; CMTerm2View::stCell cell1; CMDIChildWnd *pChild = (CMDIChildWnd *)GetActiveFrame(); CView *p1 = (CView*)pChild->GetActiveView(); CMTerm2View * p2 = (CMTerm2View *)p1; m_wndDlgBar_InputShow.SetDisplay(0x00140000); switch (localInputCell.OP) { case CMTerm2View::typeNO: case CMTerm2View::typeNC: case CMTerm2View::typeOUT: case CMTerm2View::typeSET: case CMTerm2View::typeRESET: case CMTerm2View::typeTM: switch (localInputCell.param) { case KLCoilTypeX: strName = "X"; break; case KLCoilTypeY: strName = "Y"; break; case KLCoilTypeR: strName = "R"; break; case KLCoilTypeLR: strName = "L"; break; case KLCoilTypeT: strName = "T"; break; case KLCoilTypeC: strName = "C"; break; case OP_TMX: strName = "TMX "; case OP_TMY: strName = "TMY "; case OP_TMR: strName = "TMR "; case OP_TML: strName = "TML "; default: break; } default: break; } cell1.sCoilName = strName + localInputCell.num; cell1.nType = localInputCell.OP; //cell1.sCoilName = "R555"; cell1.nProgStep = 0; cell1.bEditing = 1; cell1.sParam = "D88"; cell1.bLeftLineUp = 0; cell1.nDataType = CMTerm2View::typeCoil; p2->GetIncToView(cell1); m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } void CMainFrame::OnBtnInsert() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00240000); m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } void CMainFrame::OnBtnDelete() { // TODO: 在此添加命令处理程序代码 m_wndDlgBar_InputShow.SetDisplay(0x00340000); m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } void CMainFrame::OnBtnEsc() { // TODO: 在此添加命令处理程序代码 //m_wndDlgBar_InputShow.SetDisplay(_T("Esc")); m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } void CMainFrame::OnMenuShowDev() { // TODO: 在此添加命令处理程序代码 } MTerm2/MainFrm.h
@@ -9,7 +9,12 @@ //class CMyPaneLog; #include "MyDialogLog.h" #include "../MyLib/StaticEx.h" class CMainFrame : public CMDIFrameWndEx #include "CMyFuncKeyToolBar.h" #include "MyDlgBarFuncKey.h" #include "MyDialogLog.h" #include "MyDlgBarInputShow.h" class CMainFrame : public CMDIFrameWnd { DECLARE_DYNAMIC(CMainFrame) public: @@ -24,7 +29,7 @@ // 重写 public: virtual BOOL PreCreateWindow(CREATESTRUCT& cs); CStatusBar m_wndStatusBar; // 实现 public: virtual ~CMainFrame(); @@ -34,22 +39,26 @@ #endif protected: // 控件条嵌入成员 CMFCToolBar m_wndToolBar; CToolBar m_wndToolBar; CMFCToolBar m_wndToolBar_FuncKey; CMFCToolBar m_wndToolBar_Edit; CMFCToolBar m_wndToolBar_Num; CMFCToolBar m_wndToolBar_InputShow; CMFCToolBar m_wndToolBar_Comments; // CMyFuncKeyToolBar m_wndToolBar_Func_Key; CMyDlgBarFuncKey m_wndDlgBar_Func_Key; CToolBar m_wndTBar_Edit_Key; CToolBar m_wndTBar_Num_Key; // CToolBar m_wndTBar_InputShow; CMyDlgBarInputShow m_wndDlgBar_InputShow; CToolBar m_wndToolBar_Comments; CNavView m_wndNavView; CEdit m_InputShowEdit; CStaticEx m_InputShowStatic; CMFCStatusBar m_wndStatusBar; CMyPaneLog m_wndMyPaneLog; // CMyDialogLog m_dlgMyLog; CMyDialogLog m_dlgMyLog; CMyDlgBarInputShow::tagInputCell localInputCell; // 生成的消息映射函数 protected: @@ -71,8 +80,35 @@ // afx_msg void OnMenuViewLds(); // afx_msg void OnMenuViewBld(); // afx_msg void OnMenuViewBnl(); int GetInputInfo(int inputInfo); int GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell); afx_msg void OnMenuShowLog(); virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); afx_msg void OnBtn0(); afx_msg void OnBtn1(); afx_msg void OnBtn2(); afx_msg void OnBtn3(); afx_msg void OnBtn4(); afx_msg void OnBtn5(); afx_msg void OnBtn6(); afx_msg void OnBtn7(); afx_msg void OnBtn8(); afx_msg void OnBtn9(); afx_msg void OnBtnA(); afx_msg void OnBtnB(); afx_msg void OnBtnC(); afx_msg void OnBtnD(); afx_msg void OnBtnE(); afx_msg void OnBtnF(); afx_msg void OnBtnMinus(); afx_msg void OnBtnDot(); afx_msg void OnBtnRet(); afx_msg void OnBtnInsert(); afx_msg void OnBtnDelete(); afx_msg void OnBtnEsc(); afx_msg void OnMenuShowDev(); }; MTerm2/MyDialogLog.cpp
@@ -115,7 +115,7 @@ CRect rect1; GetDlgItem(IDC_CHECK_PAUSEUPDATE)->GetWindowRect(rect1); ScreenToClient(&rect1); GetDlgItem(IDC_CHECK_PAUSEUPDATE)->SetWindowPos(NULL,0,cy-rect1.Height(),rect1.Width(),rect1.Height(),NULL); GetDlgItem(IDC_CHECK_PAUSEUPDATE)->SetWindowPos(NULL,4,cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL); } pwnd=GetDlgItem(IDC_CHECK_NOSCROLL); if (pwnd!=NULL) @@ -123,7 +123,7 @@ CRect rect1; GetDlgItem(IDC_CHECK_NOSCROLL)->GetWindowRect(rect1); ScreenToClient(&rect1); GetDlgItem(IDC_CHECK_NOSCROLL)->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height(),rect1.Width(),rect1.Height(),NULL); GetDlgItem(IDC_CHECK_NOSCROLL)->SetWindowPos(NULL,cx-rect1.Width()-4,cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL); } } MTerm2/MyDlgBarFuncKey.cpp
New file @@ -0,0 +1,870 @@ // MyDlgBarFuncKey.cpp: 实现文件 // #include "pch.h" #include "MTerm2.h" #include "MyDlgBarFuncKey.h" #include "afxdialogex.h" #include "MainFrm.h" // CMyDlgBarFuncKey 对话框 CMyDlgBarFuncKey::structButton myButtons[6][3][11] = { {{33101,_T("-| |-"), 33102,_T("└┤├┘") ,33103,_T("|"), 33104,_T("-[OUT]") ,33105,_T("TM/CT") ,33106,_T("Fun") ,33107,_T("——") ,33108,_T("NOT/") ,33109,_T("INDEX") ,33110,_T("(MC)") ,33111,_T("(MCE)") }, {33201,_T("-<SET>-"), 33202,_T("-<RESET>") ,33203,_T("(DF(/))"), 33204,_T("(END)") ,33205,_T("比较") ,33206,_T("PFun") ,33207,_T("↑↓") ,33208,_T("[位]") ,33209,_T("[字]") ,33210,_T("指令1") ,33211,_T("指令2") }, {33301,_T("PG转换"), 33302,_T("在线") ,33303,_T("离线"), 33304,_T("关闭") ,33305,_T("查找") ,33306,_T("次Win") ,33307,_T("监控Go") ,33308,_T("状态") ,33309,_T("Run/Prog") ,33310,_T("PLC读取") ,33311,_T("PLC写入") } }, {{33401,_T("X"), 33402,_T("Y") ,33403,_T("R"), 33404,_T("L") ,33405,_T("P") ,33406,_T("比较") ,33407,_T("") ,33408,_T("NOT/") ,33409,_T("INDEX") ,33410,_T("No.清除") ,33411,_T("") }, {33501,_T("T"), 33502,_T("C") ,33503,_T("E"), 33504,_T("") ,33505,_T("") ,33506,_T("") ,33507,_T("↑↓") ,33508,_T("") ,33509,_T("") ,33510,_T("") ,33511,_T("") }, {33601,_T(""), 33602,_T("") ,33603,_T(""), 33604,_T("") ,33605,_T("") ,33606,_T("") ,33607,_T("") ,33608,_T("") ,33609,_T("") ,33610,_T("") ,33611,_T("") }}, {{33701,_T("D"), 33702,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,33706,_T("=") ,33707,_T(">") ,33708,_T("<") ,33709,_T("") ,33710,_T("") ,33711,_T("") }, {33801,_T(""), 33802,_T("") ,33803,_T(""), 33804,_T("") ,33805,_T("") ,33806,_T("") ,33807,_T("") ,33808,_T("") ,33809,_T("") ,33810,_T("") ,33811,_T("") }, {33901,_T(""), 33902,_T("") ,33903,_T(""), 33904,_T("") ,33905,_T("") ,33906,_T("") ,33907,_T("") ,33908,_T("") ,33909,_T("") ,33910,_T("") ,33911,_T("") }}, {{34101,_T("WX"), 34102,_T("WY") ,34103,_T("WR"), 34104,_T("WL") ,34105,_T("DT") ,34106,_T("LD") ,34107,_T("FL") ,34108,_T("") ,34109,_T("INDEX") ,34110,_T("No.清除") ,34111,_T("") }, {34201,_T("SV"), 34202,_T("EV") ,34203,_T("K"), 34204,_T("H") ,34205,_T("M") ,34206,_T("f") ,34207,_T("") ,34208,_T("") ,34209,_T("") ,34210,_T("") ,34211,_T("") }, {34301,_T("PG转换"), 34302,_T("") ,34303,_T(""), 34304,_T("") ,34305,_T("") ,34306,_T("") ,34307,_T("") ,34308,_T("") ,34309,_T("") ,34310,_T("") ,34311,_T("") }}, {{34401,_T("IX(I0)"), 34402,_T("IY(I1)") ,34403,_T("I2"), 34404,_T("I3") ,34405,_T("I4") ,34406,_T("I5") ,34407,_T("I6") ,34408,_T("I7") ,34409,_T("I8") ,34410,_T("") ,34411,_T("") }, {34501,_T("I9"), 34502,_T("IA") ,34503,_T("IB"), 34504,_T("IC") ,34505,_T("ID") ,34506,_T("") ,34507,_T("↑↓") ,34508,_T("") ,34509,_T("") ,34510,_T("") ,34511,_T("") }, {34601,_T(""), 34602,_T("") ,34603,_T(""), 34604,_T("") ,34605,_T("") ,34606,_T("") ,34607,_T("") ,34608,_T("") ,34609,_T("") ,34610,_T("") ,34611,_T("") }}, {{34701,_T("TMX"), 34702,_T("TMY") ,34703,_T("TMR"), 34704,_T("TML") ,34705,_T("") ,34706,_T("-[CT]-") ,34707,_T("") ,34708,_T("") ,34709,_T("INDEX") ,34710,_T("") ,34711,_T("") }, {34801,_T(""), 34802,_T("") ,34803,_T(""), 34804,_T("") ,34805,_T("") ,34806,_T("") ,34807,_T("") ,34808,_T("") ,34809,_T("") ,34810,_T("") ,34811,_T("") }, {34901,_T(""), 34902,_T("") ,34903,_T(""), 34904,_T("") ,34905,_T("") ,34906,_T("") ,34907,_T("") ,34908,_T("") ,34909,_T("") ,3490,_T("") ,34911,_T("") }}, }; static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(CMyDlgBarFuncKey::structButton); IMPLEMENT_DYNAMIC(CMyDlgBarFuncKey, CDialogBar) CMyDlgBarFuncKey::CMyDlgBarFuncKey(CWnd* pParent /*=nullptr*/) { } CMyDlgBarFuncKey::~CMyDlgBarFuncKey() { } void CMyDlgBarFuncKey::DoDataExchange(CDataExchange* pDX) { } BEGIN_MESSAGE_MAP(CMyDlgBarFuncKey, CDialogBar) ON_MESSAGE(WM_INITDIALOG, CMyDlgBarFuncKey::OnInitDialog) ON_BN_CLICKED(IDC_BUTTON1, &CMyDlgBarFuncKey::OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON_AND, &CMyDlgBarFuncKey::OnBnClickedBtnAnd) ON_BN_CLICKED(IDC_BUTTON_OR, &CMyDlgBarFuncKey::OnBnClickedBtnOr) ON_BN_CLICKED(IDC_BUTTON_VLINE, &CMyDlgBarFuncKey::OnBnClickedBtnVline) ON_BN_CLICKED(IDC_BUTTON_OUT, &CMyDlgBarFuncKey::OnBnClickedBtnOut) ON_BN_CLICKED(IDC_BUTTON_TMCT, &CMyDlgBarFuncKey::OnBnClickedBtnTmCt) ON_BN_CLICKED(IDC_BUTTON_FUN, &CMyDlgBarFuncKey::OnBnClickedBtnFun) ON_BN_CLICKED(IDC_BUTTON_HLINE, &CMyDlgBarFuncKey::OnBnClickedBtnHLine) ON_BN_CLICKED(IDC_BUTTON_NOT, &CMyDlgBarFuncKey::OnBnClickedBtnNot) ON_BN_CLICKED(IDC_BUTTON_INDEX, &CMyDlgBarFuncKey::OnBnClickedBtnIndex) ON_BN_CLICKED(IDC_BUTTON_MC, &CMyDlgBarFuncKey::OnBnClickedBtnMc) ON_BN_CLICKED(IDC_BUTTON_MCE, &CMyDlgBarFuncKey::OnBnClickedBtnMce) ON_BN_CLICKED(IDC_BUTTON_SET, &CMyDlgBarFuncKey::OnBnClickedBtnSet) ON_BN_CLICKED(IDC_BUTTON_RESET, &CMyDlgBarFuncKey::OnBnClickedBtnReset) ON_BN_CLICKED(IDC_BUTTON_DF, &CMyDlgBarFuncKey::OnBnClickedBtnDf) ON_BN_CLICKED(IDC_BUTTON_END, &CMyDlgBarFuncKey::OnBnClickedBtnEnd) ON_BN_CLICKED(IDC_BUTTON_COMPARE, &CMyDlgBarFuncKey::OnBnClickedBtnCompare) ON_BN_CLICKED(IDC_BUTTON_PFUN, &CMyDlgBarFuncKey::OnBnClickedBtnPFun) ON_BN_CLICKED(IDC_BUTTON_UPDOWN, &CMyDlgBarFuncKey::OnBnClickedBtnUpDown) ON_BN_CLICKED(IDC_BUTTON_BIT, &CMyDlgBarFuncKey::OnBnClickedBtnBit) ON_BN_CLICKED(IDC_BUTTON_WORD, &CMyDlgBarFuncKey::OnBnClickedBtnWord) ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION1, &CMyDlgBarFuncKey::OnBnClickedBtnInc1) ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION2, &CMyDlgBarFuncKey::OnBnClickedBtnInc2) ON_BN_CLICKED(IDC_BUTTON_PGCONVERT, &CMyDlgBarFuncKey::OnBnClickedBtnPgConvert) ON_BN_CLICKED(IDC_BUTTON_ONLINE, &CMyDlgBarFuncKey::OnBnClickedBtnOnline) ON_BN_CLICKED(IDC_BUTTON_OFFLINE, &CMyDlgBarFuncKey::OnBnClickedBtnOffline) ON_BN_CLICKED(IDC_BUTTON_COLSE, &CMyDlgBarFuncKey::OnBnClickedBtnClose) ON_BN_CLICKED(IDC_BUTTON_FIND, &CMyDlgBarFuncKey::OnBnClickedBtnFind) ON_BN_CLICKED(IDC_BUTTON_NEXTWIN, &CMyDlgBarFuncKey::OnBnClickedBtnNextWin) ON_BN_CLICKED(IDC_BUTTON_MONITOR, &CMyDlgBarFuncKey::OnBnClickedBtnMonitor) ON_BN_CLICKED(IDC_BUTTON_STATUS, &CMyDlgBarFuncKey::OnBnClickedBtnStatus) ON_BN_CLICKED(IDC_BUTTON_RUNPROG, &CMyDlgBarFuncKey::OnBnClickedBtnRunProg) ON_BN_CLICKED(IDC_BUTTON_PLCREAD, &CMyDlgBarFuncKey::OnBnClickedBtnPlcRead) ON_BN_CLICKED(IDC_BUTTON_PLCWRITE, &CMyDlgBarFuncKey::OnBnClickedBtnPlcWrite) ON_BN_CLICKED(IDC_BUTTON_X, &CMyDlgBarFuncKey::OnBnClickedBtnX) ON_BN_CLICKED(IDC_BUTTON_Y, &CMyDlgBarFuncKey::OnBnClickedBtnY) ON_BN_CLICKED(IDC_BUTTON_R, &CMyDlgBarFuncKey::OnBnClickedBtnR) ON_BN_CLICKED(IDC_BUTTON_L, &CMyDlgBarFuncKey::OnBnClickedBtnL) ON_BN_CLICKED(IDC_BUTTON_P, &CMyDlgBarFuncKey::OnBnClickedBtnP) ON_BN_CLICKED(IDC_BUTTON_COMPARE1, &CMyDlgBarFuncKey::OnBnClickedBtnCompare1) ON_BN_CLICKED(IDC_BUTTON_NOT1, &CMyDlgBarFuncKey::OnBnClickedBtnNot) ON_BN_CLICKED(IDC_BUTTON_T, &CMyDlgBarFuncKey::OnBnClickedBtnT) ON_BN_CLICKED(IDC_BUTTON_C, &CMyDlgBarFuncKey::OnBnClickedBtnC) ON_BN_CLICKED(IDC_BUTTON_E, &CMyDlgBarFuncKey::OnBnClickedBtnE) ON_BN_CLICKED(IDC_BUTTON_UPDOWN1, &CMyDlgBarFuncKey::OnBnClickedBtnUpDown) ON_BN_CLICKED(IDC_BUTTON_TMX, &CMyDlgBarFuncKey::OnBnClickedBtnTmx) ON_BN_CLICKED(IDC_BUTTON_TMY, &CMyDlgBarFuncKey::OnBnClickedBtnTmy) ON_BN_CLICKED(IDC_BUTTON_TMR, &CMyDlgBarFuncKey::OnBnClickedBtnTmr) ON_BN_CLICKED(IDC_BUTTON_TML, &CMyDlgBarFuncKey::OnBnClickedBtnTml) ON_BN_CLICKED(IDC_BUTTON_CT, &CMyDlgBarFuncKey::OnBnClickedBtnCt) ON_BN_CLICKED(IDC_BUTTON_D, &CMyDlgBarFuncKey::OnBnClickedBtnD) ON_BN_CLICKED(IDC_BUTTON_F, &CMyDlgBarFuncKey::OnBnClickedBtnF) ON_BN_CLICKED(IDC_BUTTON_NEQ, &CMyDlgBarFuncKey::OnBnClickedBtnNEQ) ON_BN_CLICKED(IDC_BUTTON_GT, &CMyDlgBarFuncKey::OnBnClickedBtnGT) ON_BN_CLICKED(IDC_BUTTON_LT, &CMyDlgBarFuncKey::OnBnClickedBtnLT) END_MESSAGE_MAP() // CMyDlgBarFuncKey 消息处理程序 LRESULT CMyDlgBarFuncKey::OnInitDialog(WPARAM wParam, LPARAM lParam) { // TODO: 在此处添加实现代码. //CDialogBar::OnInitDialog(); // TODO: Add extra initialization here CString(s1); s1.Format(_T(" MyDlgBarFuncKey OnInitDialog ")); SysLog(s1); LRESULT bRet = HandleInitDialog(wParam, lParam); if (!UpdateData(FALSE)) { TRACE("InitDialogBar Failed!"); } CRect rect0; GetClientRect(&rect0); int nWidth = rect0.Width(); int nHeight = rect0.Height(); int nLeftMargin = 48; int nSpace = nWidth - nLeftMargin; int x1, y1, x2, y2; CRect rect1(0, 0, 100, 10); // font1.CreatePointFont(95, _T("楷体")); for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[0][i][j].Create(myButtons[0][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[0][i][j].nID); // init; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[1][i][j].Create(myButtons[1][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[1][i][j].nID); // bit; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[2][i][j].Create(myButtons[2][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[2][i][j].nID); // compare; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[3][i][j].Create(myButtons[3][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[3][i][j].nID); // word; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[4][i][j].Create(myButtons[4][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[4][i][j].nID); // index; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[5][i][j].Create(myButtons[5][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[5][i][j].nID); // TMCT; } } return bRet; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE return false; } BOOL CMyDlgBarFuncKey::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID) { // TODO: 在此添加专用代码和/或调用基类 BOOL bRes = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); // OnInitDialog(0,0); return bRes; // // return CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); } void CMyDlgBarFuncKey::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler) { // TODO: 在此添加专用代码和/或调用基类 CDialogBar::OnUpdateCmdUI(pTarget, FALSE); } void CMyDlgBarFuncKey::OnBnClickedButton1() { // TODO: 在此添加控件通知处理程序代码 CString s1; s1.Format(_T("Button1 Clicked")); SysLog(s1); } void CMyDlgBarFuncKey::SetBtnDisplayESC() { switch (current_btn_window) { case 1: for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } break; case 2: for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[2][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } break; case 3: for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[3][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } break; case 4: for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[4][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } break; case 5: for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } break; default: break; } } void CMyDlgBarFuncKey::OnBnClickedBtnAnd() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010001); //CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("X")); for (int i = 0;i < 3;i++){ for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnOr() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010002); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnVline() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("|")); } void CMyDlgBarFuncKey::OnBnClickedBtnOut() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010003); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnTmCt() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0001000b); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 5; } void CMyDlgBarFuncKey::OnBnClickedBtnFun() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Fun ")); } void CMyDlgBarFuncKey::OnBnClickedBtnHLine() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("——")); } void CMyDlgBarFuncKey::OnBnClickedBtnNot() /****************************************************************************/ { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010013); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnIndex() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Index ")); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[4][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 4; } void CMyDlgBarFuncKey::OnBnClickedBtnMc() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010004); } void CMyDlgBarFuncKey::OnBnClickedBtnMce() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010005); } void CMyDlgBarFuncKey::OnBnClickedBtnSet() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010006); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnReset() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010007); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnDf() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010008); //p1->GetInputInfo(_T("(DF)")); } void CMyDlgBarFuncKey::OnBnClickedBtnEnd() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0001000A); } void CMyDlgBarFuncKey::OnBnClickedBtnCompare() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Compare")); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[2][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 2; } void CMyDlgBarFuncKey::OnBnClickedBtnPFun() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("PFun")); } void CMyDlgBarFuncKey::OnBnClickedBtnUpDown() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010010); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnBit() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Bit")); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 1; } void CMyDlgBarFuncKey::OnBnClickedBtnWord() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Word")); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[3][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 3; } void CMyDlgBarFuncKey::OnBnClickedBtnInc1() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Inc1")); } void CMyDlgBarFuncKey::OnBnClickedBtnInc2() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Inc2")); } void CMyDlgBarFuncKey::OnBnClickedBtnPgConvert() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("PgConvert")); } void CMyDlgBarFuncKey::OnBnClickedBtnOnline() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Online")); } void CMyDlgBarFuncKey::OnBnClickedBtnOffline() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Offline")); } void CMyDlgBarFuncKey::OnBnClickedBtnClose() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Close")); } void CMyDlgBarFuncKey::OnBnClickedBtnFind() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Find")); } void CMyDlgBarFuncKey::OnBnClickedBtnNextWin() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("NextWin")); } void CMyDlgBarFuncKey::OnBnClickedBtnMonitor() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Monitor")); } void CMyDlgBarFuncKey::OnBnClickedBtnStatus() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("Status")); } void CMyDlgBarFuncKey::OnBnClickedBtnRunProg() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("RunProg")); } void CMyDlgBarFuncKey::OnBnClickedBtnPlcRead() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("PlcRead")); } void CMyDlgBarFuncKey::OnBnClickedBtnPlcWrite() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); //p1->GetInputInfo(_T("PlcWrite")); } void CMyDlgBarFuncKey::OnBnClickedBtnX() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020001); } void CMyDlgBarFuncKey::OnBnClickedBtnY() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020002); } void CMyDlgBarFuncKey::OnBnClickedBtnR() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020003); } void CMyDlgBarFuncKey::OnBnClickedBtnL() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020004); } void CMyDlgBarFuncKey::OnBnClickedBtnP() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020005); } void CMyDlgBarFuncKey::OnBnClickedBtnCompare1() { for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[1][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[2][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 2; } void CMyDlgBarFuncKey::OnBnClickedBtnT() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020006); } void CMyDlgBarFuncKey::OnBnClickedBtnC() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020007); } void CMyDlgBarFuncKey::OnBnClickedBtnE() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020008); } void CMyDlgBarFuncKey::OnBnClickedBtnTmx() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00020009); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 0; } void CMyDlgBarFuncKey::OnBnClickedBtnTmy() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000A); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 0; } void CMyDlgBarFuncKey::OnBnClickedBtnTmr() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000B); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 0; } void CMyDlgBarFuncKey::OnBnClickedBtnTml() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000C); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 0; } void CMyDlgBarFuncKey::OnBnClickedBtnCt() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000D); for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[5][i][j].ShowWindow(SW_HIDE); } } for (int i = 0;i < 3;i++) { for (int j = 0;j < 11;j++) { m_buttons[0][i][j].ShowWindow(SW_SHOW); } } current_btn_window = 0; } void CMyDlgBarFuncKey::OnBnClickedBtnD() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010015); } void CMyDlgBarFuncKey::OnBnClickedBtnF() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x00010016); } void CMyDlgBarFuncKey::OnBnClickedBtnNEQ() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000D); } void CMyDlgBarFuncKey::OnBnClickedBtnGT() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000E); } void CMyDlgBarFuncKey::OnBnClickedBtnLT() { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputInfo(0x0002000F); } MTerm2/MyDlgBarFuncKey.h
New file @@ -0,0 +1,167 @@ #pragma once // CMyDlgBarFuncKey 对话框 #define IDC_BUTTON_AND 33101 #define IDC_BUTTON_OR 33102 #define IDC_BUTTON_VLINE 33103 #define IDC_BUTTON_OUT 33104 #define IDC_BUTTON_TMCT 33105 #define IDC_BUTTON_FUN 33106 #define IDC_BUTTON_HLINE 33107 #define IDC_BUTTON_NOT 33108 #define IDC_BUTTON_INDEX 33109 #define IDC_BUTTON_MC 33110 #define IDC_BUTTON_MCE 33111 #define IDC_BUTTON_SET 33201 #define IDC_BUTTON_RESET 33202 #define IDC_BUTTON_DF 33203 #define IDC_BUTTON_END 33204 #define IDC_BUTTON_COMPARE 33205 #define IDC_BUTTON_PFUN 33206 #define IDC_BUTTON_UPDOWN 33207 #define IDC_BUTTON_BIT 33208 #define IDC_BUTTON_WORD 33209 #define IDC_BUTTON_INSTRUCTION1 33210 #define IDC_BUTTON_INSTRUCTION2 33211 #define IDC_BUTTON_PGCONVERT 33301 #define IDC_BUTTON_ONLINE 33302 #define IDC_BUTTON_OFFLINE 33303 #define IDC_BUTTON_COLSE 33304 #define IDC_BUTTON_FIND 33305 #define IDC_BUTTON_NEXTWIN 33306 #define IDC_BUTTON_MONITOR 33307 #define IDC_BUTTON_STATUS 33308 #define IDC_BUTTON_RUNPROG 33309 #define IDC_BUTTON_PLCREAD 33310 #define IDC_BUTTON_PLCWRITE 33311 #define IDC_BUTTON_X 33401 #define IDC_BUTTON_Y 33402 #define IDC_BUTTON_R 33403 #define IDC_BUTTON_L 33404 #define IDC_BUTTON_P 33405 #define IDC_BUTTON_COMPARE1 33406 #define IDC_BUTTON_NOT1 33408 #define IDC_BUTTON_T 33501 #define IDC_BUTTON_C 33502 #define IDC_BUTTON_E 33503 #define IDC_BUTTON_UPDOWN1 33507 #define IDC_BUTTON_D 33701 #define IDC_BUTTON_F 33702 #define IDC_BUTTON_NEQ 33706 #define IDC_BUTTON_GT 33707 #define IDC_BUTTON_LT 33708 #define IDC_BUTTON_TMX 34701 #define IDC_BUTTON_TMY 34702 #define IDC_BUTTON_TMR 34703 #define IDC_BUTTON_TML 34704 #define IDC_BUTTON_CT 34706 class CMyDlgBarFuncKey : public CDialogBar { DECLARE_DYNAMIC(CMyDlgBarFuncKey) typedef struct tagStructButton { int nID; CString sCaption; }structButton; public: CMyDlgBarFuncKey(CWnd* pParent = nullptr); // 标准构造函数 virtual ~CMyDlgBarFuncKey(); // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DIALOGBAR_FUNC_KEYS }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: CButton m_buttons[6][3][11]; //CButton m_buttons_init[3][11]; //CButton m_buttons_bit[3][11]; //CButton m_buttons_compare[3][11]; //CButton m_buttons_word[3][11]; //CButton m_buttons_index[3][11]; //CButton m_buttons_TMCT[3][11]; int m_Lines = 3; CFont font1; int current_btn_window = 0; LRESULT OnInitDialog(WPARAM wParam, LPARAM lParam); virtual BOOL Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID); virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler); void SetBtnDisplayESC(); afx_msg void OnBnClickedButton1(); afx_msg void OnBnClickedBtnAnd(); afx_msg void OnBnClickedBtnOr(); afx_msg void OnBnClickedBtnVline(); afx_msg void OnBnClickedBtnOut(); afx_msg void OnBnClickedBtnTmCt(); afx_msg void OnBnClickedBtnFun(); afx_msg void OnBnClickedBtnHLine(); afx_msg void OnBnClickedBtnNot(); afx_msg void OnBnClickedBtnIndex(); afx_msg void OnBnClickedBtnMc(); afx_msg void OnBnClickedBtnMce(); afx_msg void OnBnClickedBtnSet(); afx_msg void OnBnClickedBtnReset(); afx_msg void OnBnClickedBtnDf(); afx_msg void OnBnClickedBtnEnd(); afx_msg void OnBnClickedBtnCompare(); afx_msg void OnBnClickedBtnPFun(); afx_msg void OnBnClickedBtnUpDown(); afx_msg void OnBnClickedBtnBit(); afx_msg void OnBnClickedBtnWord(); afx_msg void OnBnClickedBtnInc1(); afx_msg void OnBnClickedBtnInc2(); afx_msg void OnBnClickedBtnPgConvert(); afx_msg void OnBnClickedBtnOnline(); afx_msg void OnBnClickedBtnOffline(); afx_msg void OnBnClickedBtnClose(); afx_msg void OnBnClickedBtnFind(); afx_msg void OnBnClickedBtnNextWin(); afx_msg void OnBnClickedBtnMonitor(); afx_msg void OnBnClickedBtnStatus(); afx_msg void OnBnClickedBtnRunProg(); afx_msg void OnBnClickedBtnPlcRead(); afx_msg void OnBnClickedBtnPlcWrite(); afx_msg void OnBnClickedBtnX(); afx_msg void OnBnClickedBtnY(); afx_msg void OnBnClickedBtnR(); afx_msg void OnBnClickedBtnL(); afx_msg void OnBnClickedBtnP(); afx_msg void OnBnClickedBtnCompare1(); afx_msg void OnBnClickedBtnT(); afx_msg void OnBnClickedBtnC(); afx_msg void OnBnClickedBtnE(); afx_msg void OnBnClickedBtnTmx(); afx_msg void OnBnClickedBtnTmy(); afx_msg void OnBnClickedBtnTmr(); afx_msg void OnBnClickedBtnTml(); afx_msg void OnBnClickedBtnCt(); afx_msg void OnBnClickedBtnD(); afx_msg void OnBnClickedBtnF(); afx_msg void OnBnClickedBtnNEQ(); afx_msg void OnBnClickedBtnGT(); afx_msg void OnBnClickedBtnLT(); }; MTerm2/MyDlgBarInputShow.cpp
New file @@ -0,0 +1,3235 @@ // MyDlgBarInputShow.cpp: 实现文件 // #include "pch.h" #include "MTerm2.h" #include "MyDlgBarInputShow.h" #include "afxdialogex.h" #include "KDefine.h" #include "MTerm2View.h" #include "MainFrm.h" // CMyDlgBarInputShow 对话框 IMPLEMENT_DYNAMIC(CMyDlgBarInputShow, CDialogBar) CMyDlgBarInputShow::CMyDlgBarInputShow(CWnd* pParent /*=nullptr*/) { } CMyDlgBarInputShow::~CMyDlgBarInputShow() { } void CMyDlgBarInputShow::DoDataExchange(CDataExchange* pDX) { CDialogBar::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input); } BEGIN_MESSAGE_MAP(CMyDlgBarInputShow, CDialogBar) END_MESSAGE_MAP() // CMyDlgBarInputShow 消息处理程序 //SetDlgItemText(IDC_EDIT_INPUT, myButtons[0][0].sCaption); int flag = 0; int CMyDlgBarInputShow::SetDisplay(int inputInfo) { /*stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = KLCoilTypeY; stInputCell.num = _T("1234");*/ static int clickCounter = 0; static int clickCounterDF = 0; static int clickCounterNot = 0; static int clickCounterCMP = 0; static int clickCounterD = 0; static int clickCounterF = 0; static char curTaskState = 'A'; static int lastLParam = 0; static int lastCMP = 0; static CString str, strStoreB, strStoreC, strNum; static CString strOp, strParam; CString s1, strNumTemp; int para = 0; int HParam, LParam; s1.Format(_T("is this window %d"), IsWindow(m_hWnd)); SysLog(s1); // ChangeState(inputInfo>>16, lastTaskState, curTaskState); if (inputInfo == 0x00010008) { clickCounterDF++; if (clickCounterDF == 1) //DF redefine key value { inputInfo = 0x00010008; } else if (clickCounterDF == 2) { inputInfo = 0x00010009; clickCounterDF = 0; } } if (inputInfo == 0x00010010) { clickCounter++; if (clickCounter == 1) //updown redefine key value { inputInfo = 0x00010010; } else if (clickCounter == 2) { inputInfo = 0x00010011; } else if (clickCounter == 3) { inputInfo = 0x00010012; clickCounter = 0; } } if (inputInfo == 0x00010013) { clickCounterNot++; if (clickCounterNot == 1) //NOT redefine key value { inputInfo = 0x00010013; } else if (clickCounterNot == 2) { inputInfo = 0x00010014; clickCounterNot = 0; } } if (inputInfo == 0x00010015) { clickCounterD++; if (clickCounterD == 1) //D redefine key value { inputInfo = 0x00010015; } else if (clickCounterD == 2) { inputInfo = 0x00010017; clickCounterD = 0; } } if (inputInfo == 0x00010016) { clickCounterF++; if (clickCounterF== 1) //D redefine key value { inputInfo = 0x00010016; } else if (clickCounterF == 2) { inputInfo = 0x00010018; clickCounterF = 0; } } HParam = inputInfo >> 16; LParam = inputInfo & 0xffff; switch (curTaskState) { case 'A': if (HParam == 0x1) //operator 1 { stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; stInputCell.bcmpGt = false; stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.bLeftLineUp = false; stInputCell.brightLineUp = false; if ((LParam>=0x1)&& (LParam <= 0x0f)) { if ((LParam == 0x8) || (LParam == 0x9)) //IF DF not clear df { clickCounter = 0; clickCounterNot = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } else { if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } } } if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //from not to updown { clickCounter = 1; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //from up to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //from down to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x13) && ((LParam == 0x10)|| (LParam == 0x11)|| (LParam == 0x12))) //not { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18))) //D ,"", F,"" { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x15)&&((LParam == 0x16)||(LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } switch (LParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param= 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; /*case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/ case 0x06: stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; lastLParam = LParam;curTaskState = 'B'; break; case 0x07: stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; lastLParam = LParam;curTaskState = 'B'; break; case 0x08: stInputCell.OP = CMTerm2View::typeDF;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: stInputCell.bpp = true; stInputCell.bpn = false; lastLParam = LParam; break; case 0x11: stInputCell.bpp = false; stInputCell.bpn = true; lastLParam = LParam; break; case 0x12: stInputCell.bpp = false; stInputCell.bpn = false; lastLParam = LParam; break; case 0x13: switch (lastLParam) { case 0x03: case 0x06: case 0x07: case 0x15: case 0x17: case 0x16: case 0x18: case 0x20: case 0x21: case 0x22: stInputCell.OP = CMTerm2View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNC;break; case 0x02: stInputCell.OP = CMTerm2View::typeNC; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; stInputCell.bnot = true; break; case 0x14: stInputCell.bnot = false; break; case 0x15: stInputCell.bDouble = true; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x17: stInputCell.bDouble = false; stInputCell.bDouble1 = true; stInputCell.bFloat = false; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x16: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = true; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x18: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = true; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; default: break; } } str = strOp; break; case 'B': str = strOp; if (HParam == 0x1) //operator 1 { stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; stInputCell.bcmpGt = false; stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.bLeftLineUp = false; stInputCell.brightLineUp = false; if ((LParam >= 0x0) && (LParam <= 0x0f)) { if ((LParam == 0x08) || (LParam ==0x09)) { clickCounter = 0; clickCounterNot = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } else { if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } } } if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //from not to updown { clickCounter = 1; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //from not to updown { clickCounter = 1; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //from up to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //from down to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } switch (LParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; /*case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/ case 0x06: stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x07: stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x08: stInputCell.OP = CMTerm2View::typeDF;;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x9: stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: stInputCell.bpp = true; stInputCell.bpn = false; lastLParam = LParam; break; case 0x11: stInputCell.bpp = false; stInputCell.bpn = true; lastLParam = LParam; break; case 0x12: stInputCell.bpp = false; stInputCell.bpn = false; lastLParam = LParam; break; case 0x13: switch (lastLParam) { case 0x03: case 0x06: case 0x07: case 0x15: case 0x17: case 0x16: case 0x18: case 0x20: case 0x21: case 0x22: stInputCell.OP = CMTerm2View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNC;break; case 0x02: stInputCell.OP = CMTerm2View::typeNC; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; stInputCell.bnot = true; break; case 0x14: stInputCell.bnot = false; break; case 0x15: stInputCell.bDouble = true; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x17: stInputCell.bDouble = false; stInputCell.bDouble1 = true; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x16: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = true; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x18: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = true; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break; case 2: stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break; case 3: stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break; case 4: stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: stInputCell.param = KLCoilTypeT; curTaskState = 'C';break; case 7: stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; case 9: stInputCell.param = OP_TMX;curTaskState = 'C'; break; case 0x0a: stInputCell.param = OP_TMY;curTaskState = 'C'; break; case 0x0b: stInputCell.param = OP_TMR;curTaskState = 'C'; break; case 0x0c: stInputCell.param = OP_TML;curTaskState = 'C'; break; case 0x0d: if ((lastLParam==0x03)|| (lastLParam == 0x06)|| (lastLParam == 0x07)|| (lastLParam == 0x08)|| (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; stInputCell.bcmpEq = true; if(lastCMP!= LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } if (clickCounterCMP>2) { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; stInputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; // define op para; for translate to -/- stInputCell.bcmpLt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } lastCMP = LParam; //record key num = > < curTaskState = 'B'; break; default: break; } } break; case 'C': // str = strOp + _T(" ") + strParam; if (HParam == 0x01) //operator 1 { stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; stInputCell.bcmpGt = false; stInputCell.bDouble = false; stInputCell.bFloat1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.bLeftLineUp = false; stInputCell.brightLineUp = false; if ((LParam >= 0x01) && (LParam <= 0x0f)) { if ((LParam == 0x08) || (LParam ==0x09)) { clickCounter = 0; clickCounterNot = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } else { if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } } } if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //from not to updown { clickCounter = 1; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //from up to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //from down to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //not { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } switch (LParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; /*case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/ case 0x06: stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x07: stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x08: stInputCell.OP = CMTerm2View::typeDF;;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: stInputCell.bpp = true; stInputCell.bpn = false; break; case 0x11: stInputCell.bpp = false; stInputCell.bpn = true; break; case 0x12: stInputCell.bpp = false; stInputCell.bpn = false; break; case 0x13: switch (lastLParam) { case 0x03: case 0x06: case 0x07: case 0x15: case 0x17: case 0x16: case 0x18: case 0x20: case 0x21: case 0x22: stInputCell.OP = CMTerm2View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNC;break; case 0x02: stInputCell.OP = CMTerm2View::typeNC; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; stInputCell.bnot = true; break; case 0x14: stInputCell.bnot = false; break; case 0x15: stInputCell.bDouble = true; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x17: stInputCell.bDouble = false; stInputCell.bDouble1 = true; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x16: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = true; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x18: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = true; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break; case 2: stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break; case 3: stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break; case 4: stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: stInputCell.param = KLCoilTypeT; curTaskState = 'C';break; case 7: stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; case 9: stInputCell.param = OP_TMX;curTaskState = 'C'; break; case 0x0a: stInputCell.param = OP_TMY;curTaskState = 'C'; break; case 0x0b: stInputCell.param = OP_TMR;curTaskState = 'C'; break; case 0x0c: stInputCell.param = OP_TML;curTaskState = 'C'; break; case 0x0d: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; stInputCell.bcmpEq = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; stInputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP = 1; clickCounterCMP++; } else { stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; stInputCell.bcmpLt = true; if (lastCMP!= LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } lastCMP = LParam; curTaskState = 'B'; break; default: break; } } else if (HParam == 0x3) { switch (LParam) { case 0: strNumTemp = _T("0");curTaskState = 'D'; break; case 1: strNumTemp = _T("1");curTaskState = 'D'; break; case 2: strNumTemp = _T("2");curTaskState = 'D'; break; case 3: strNumTemp = _T("3"); curTaskState = 'D';break; case 4: strNumTemp = _T("4");curTaskState = 'D'; break; case 5: strNumTemp = _T("5");curTaskState = 'D'; break; case 6: strNumTemp = _T("6"); curTaskState = 'D';break; case 7: strNumTemp = _T("7");curTaskState = 'D'; break; case 8: strNumTemp = _T("8");curTaskState = 'D'; break; case 9: strNumTemp = _T("9");curTaskState = 'D'; break; case 0x0A: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; //state not change else { strNumTemp = _T("A");curTaskState = 'D'; } break; case 0x0B: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("B");curTaskState = 'D'; } break; case 0x0C: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("C"); curTaskState = 'D'; } break; case 0x0D: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("D");curTaskState = 'D'; } break; case 0x0E: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("E");curTaskState = 'D'; } break; case 0x0F: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("F");curTaskState = 'D'; } break; default: break; } if (stInputCell.num.GetLength() < 4) { stInputCell.num.Append(strNumTemp); } else { stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1); stInputCell.num.Append(strNumTemp); } } break; case 'D': if (HParam == 0x1) //operator 1 { stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; stInputCell.bcmpGt = false; stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.bLeftLineUp = false; stInputCell.brightLineUp = false; if ((LParam >= 0x01) && (LParam <= 0x0f)) { stInputCell.num.Empty(); if ((LParam == 0x08) || (LParam == 0x09)) { clickCounter = 0; clickCounterNot = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } else { if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } } } if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //from not to updown { clickCounter = 1; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //from up to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //from down to not { clickCounter = 0; clickCounterNot = 1; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12))) //not { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14))) //updown { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 0; } if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 0; clickCounterF = 1; } if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17))) { clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterCMP = 0; clickCounterD = 1; clickCounterF = 0; } switch (LParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; /*case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/ case 0x06: stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x07: stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break; case 0x08: stInputCell.OP = CMTerm2View::typeDF;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: stInputCell.bpp = true; stInputCell.bpn = false; break; case 0x11: stInputCell.bpp = false; stInputCell.bpn = true; break; case 0x12: stInputCell.bpp = false; stInputCell.bpn = false; break; case 0x13: switch (lastLParam) { case 3: case 6: case 7: case 0x15: case 0x17: case 0x16: case 0x18: case 0x20: case 0x21: case 0x22: stInputCell.OP = CMTerm2View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: stInputCell.OP = CMTerm2View::typeNC;break; case 0x02: stInputCell.OP = CMTerm2View::typeNC; stInputCell.bLeftLineUp = true; stInputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; stInputCell.bnot = true; break; case 0x14: stInputCell.bnot = false; break; case 0x15: stInputCell.bDouble = true; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x17: stInputCell.bDouble = false; stInputCell.bDouble1 = true; stInputCell.bFloat = false; stInputCell.bFloat1 = false; stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B'; break; case 0x16: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = true; stInputCell.bFloat1 = false; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; case 0x18: stInputCell.bDouble = false; stInputCell.bDouble1 = false; stInputCell.bFloat = false; stInputCell.bFloat1 = true; lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B'; break; default: break; } if(curTaskState != 'D') { stInputCell.num.Empty(); } } else if (HParam == 0x2) { switch (LParam) { case 1: stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break; case 2: stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break; case 3: stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break; case 4: stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: stInputCell.param = KLCoilTypeT; curTaskState = 'C';break; case 7: stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; case 9: stInputCell.param = OP_TMX;curTaskState = 'C'; break; case 0x0a: stInputCell.param = OP_TMY;curTaskState = 'C'; break; case 0x0b: stInputCell.param = OP_TMR;curTaskState = 'C'; break; case 0x0c: stInputCell.param = OP_TML;curTaskState = 'C'; break; case 0x0d: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; stInputCell.bcmpEq = true; if (lastCMP!= LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpGt = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; stInputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { stInputCell.OP = CMTerm2View::typeNO; stInputCell.bnot = false; stInputCell.bpp = false; stInputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; stInputCell.bcmpLt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; stInputCell.bcmpEq = false; stInputCell.bcmpGt = false; } lastCMP = LParam; curTaskState = 'B'; break; default: break; } if (curTaskState != 'D') { stInputCell.num.Empty(); } } else if (HParam == 0x3) { switch (LParam) { case 0: strNumTemp = _T("0");curTaskState = 'D'; break; case 1: strNumTemp = _T("1");curTaskState = 'D'; break; case 2: strNumTemp = _T("2");curTaskState = 'D'; break; case 3: strNumTemp = _T("3"); curTaskState = 'D';break; case 4: strNumTemp = _T("4");curTaskState = 'D'; break; case 5: strNumTemp = _T("5");curTaskState = 'D'; break; case 6: strNumTemp = _T("6"); curTaskState = 'D';break; case 7: strNumTemp = _T("7");curTaskState = 'D'; break; case 8: strNumTemp = _T("8");curTaskState = 'D'; break; case 9: strNumTemp = _T("9");curTaskState = 'D'; break; case 0x0A: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; //state not change else { strNumTemp = _T("A");curTaskState = 'D'; } break; case 0x0B: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("B");curTaskState = 'D'; } break; case 0x0C: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("C"); curTaskState = 'D'; } break; case 0x0D: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("D");curTaskState = 'D'; } break; case 0x0E: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("E");curTaskState = 'D'; } break; case 0x0F: if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("F");curTaskState = 'D'; } break; default: break; } if (stInputCell.num.GetLength() < 4) { stInputCell.num.Append(strNumTemp); } else { stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1); stInputCell.num.Append(strNumTemp); for (int i = 0;i < stInputCell.num.GetLength() ;i++) { if (stInputCell.num[i] == _T('0')) { ; } else { flag = 1;break; } } if (flag==0) { stInputCell.num.Empty(); stInputCell.num.Append(_T("0")); } } int num = stInputCell.num.GetLength(); for (int i = 0; i < num; i++) { int len1 = stInputCell.num.GetLength(); if (len1 > 1 && stInputCell.num[0] == _T('0')) stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1); } } break; } //end switch if (HParam==0x14) { bool editEndFlag = false; //******************************************************************************************************** switch (stInputCell.OP) { case CMTerm2View::typeNO: case CMTerm2View::typeNC: case CMTerm2View::typeOUT: case CMTerm2View::typeSET: case CMTerm2View::typeRESET: case CMTerm2View::typeTM: if (curTaskState == 'D') { editEndFlag = true; } case CMTerm2View::typeDF: case CMTerm2View::typeDF_: if (curTaskState == 'A') { editEndFlag = true; } default: break; } if ((stInputCell.bcmpEq)||(stInputCell.bcmpGt)|| (stInputCell.bcmpLt)) { editEndFlag = true; } if (editEndFlag) { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); p1->GetInputCell(stInputCell); } else { CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd(); CString str = _T("无法确定指令输入"); //p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0)); p1->m_wndStatusBar.SetPaneText(0, str); } } display(stInputCell); return 0; } void CMyDlgBarInputShow::stInit() { stInputCell= { CMTerm2View::typeNO, false, false, false, false, false, false, false, false, false, false, false, false, 0x10, _T("") }; } int CMyDlgBarInputShow::display(tagInputCell stDisplayCell) { static CString strOp, strParam,strNum; static CString str; switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp)&&(stInputCell.brightLineUp)) { strOp = _T("└┤├┘"); } else { strOp = _T("-| |-"); } break; case CMTerm2View::typeNC: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤/├┘"); } else { strOp = _T("-|/|-"); } break; case CMTerm2View::typeOUT: strOp = _T("-[ ]"); break; case CMTerm2View::typeSET: strOp = _T("-<S>"); break; case CMTerm2View::typeRESET: strOp = _T("-<R>"); break; case CMTerm2View::typeDF: strOp = _T("(DF)"); break; case CMTerm2View::typeDF_: strOp = _T("(DF/)"); break; case CMTerm2View::typeNOT: strOp = _T("-/-"); break; case CMTerm2View::typeTM: strOp = _T("-[TM]"); break; case CMTerm2View::typeCMP: break; default: break; } if (stDisplayCell.bnot) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤/├┘"); } else { strOp = _T("-|/|-"); } break; case CMTerm2View::typeOUT: strOp = _T("-/-"); break; case CMTerm2View::typeSET: strOp = _T("-/-"); break; case CMTerm2View::typeRESET: strOp = _T("-/-"); break; case CMTerm2View::typeDF: strOp = _T("(DF/)"); break; case CMTerm2View::typeDF_: strOp = _T("(DF)"); break; case CMTerm2View::typeNOT: strOp = _T("-/-"); break; case CMTerm2View::typeTM: strOp = _T("-/-"); break; default: break; } } if (stDisplayCell.bpp) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤↑├┘"); } else { strOp = _T("-|↑|-"); } break; case CMTerm2View::typeOUT: strOp = _T("-[↑]"); break; default: break; } } if (stDisplayCell.bpn) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤↓├┘"); } else { strOp = _T("-|↓|-"); } break; case CMTerm2View::typeOUT: strOp = _T("-[↓]"); break; default: break; } } if (stDisplayCell.bDouble) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤├┘D"); } else { strOp = _T("-| |-D"); } break; case CMTerm2View::typeOUT: strOp = _T("-| |-D"); break; case CMTerm2View::typeSET: strOp = _T("-| |-D"); break; case CMTerm2View::typeRESET: strOp = _T("-| |-D"); break; case CMTerm2View::typeDF: strOp = _T("-| |-D"); break; case CMTerm2View::typeDF_: strOp = _T("-| |-D"); break; case CMTerm2View::typeNOT: strOp = _T("-| |-D"); break; case CMTerm2View::typeTM: strOp = _T("-| |-D"); break; default: break; } } if (stDisplayCell.bDouble1) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤├┘"); } else { strOp = _T("-| |-"); } break; case CMTerm2View::typeOUT: strOp = _T("-| |-"); break; case CMTerm2View::typeSET: strOp = _T("-| |-"); break; case CMTerm2View::typeRESET: strOp = _T("-| |-"); break; case CMTerm2View::typeDF: strOp = _T("-| |-"); break; case CMTerm2View::typeDF_: strOp = _T("-| |-"); break; case CMTerm2View::typeNOT: strOp = _T("-| |-"); break; case CMTerm2View::typeTM: strOp = _T("-| |-"); break; default: break; } } if (stDisplayCell.bFloat) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤├┘F"); } else { strOp = _T("-| |-F"); } break; case CMTerm2View::typeOUT: strOp = _T("-| |-F"); break; case CMTerm2View::typeSET: strOp = _T("-| |-F"); break; case CMTerm2View::typeRESET: strOp = _T("-| |-F"); break; case CMTerm2View::typeDF: strOp = _T("-| |-F"); break; case CMTerm2View::typeDF_: strOp = _T("-| |-F"); break; case CMTerm2View::typeNOT: strOp = _T("-| |-F"); break; case CMTerm2View::typeTM: strOp = _T("-| |-F"); break; default: break; } } if (stDisplayCell.bFloat1) { switch (stDisplayCell.OP) { case CMTerm2View::typeNO: if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp)) { strOp = _T("└┤├┘"); } else { strOp = _T("-| |-"); } case CMTerm2View::typeOUT: strOp = _T("-| |-"); break; case CMTerm2View::typeSET: strOp = _T("-| |-"); break; case CMTerm2View::typeRESET: strOp = _T("-| |-"); break; case CMTerm2View::typeDF: strOp = _T("-| |-"); break; case CMTerm2View::typeDF_: strOp = _T("-| |-"); break; case CMTerm2View::typeNOT: strOp = _T("-| |-"); break; case CMTerm2View::typeTM: strOp = _T("-| |-"); break; default: break; } } switch (stDisplayCell.param) { case KLCoilTypeX: strParam = _T("X"); break; case KLCoilTypeY: strParam = _T("Y"); break; case KLCoilTypeR: strParam = _T("R"); break; case KLCoilTypeLR: strParam = _T("L"); break; case KLCoilTypeT: strParam = _T("T"); break; case KLCoilTypeC: strParam = _T("C"); break; case OP_TMX: if (strOp == _T("-[TM]")) strOp = ""; strParam = _T("-[TMX]"); break; case OP_TMY: if (strOp == _T("-[TM]")) strOp = ""; strParam = _T("-[TMY]"); break; case OP_TMR: if (strOp == _T("-[TM]")) strOp = ""; strParam = _T("-[TMR]"); break; case OP_TML: if (strOp == _T("-[TM]")) strOp = ""; strParam = _T("-[TML]"); break; default: strParam = " "; break; } if ((stInputCell.bcmpEq)&&(!stInputCell.bcmpLt)&&(!stInputCell.bcmpGt)) { strParam = "="; } if ((!stInputCell.bcmpEq) && (stInputCell.bcmpLt) && (!stInputCell.bcmpGt)) { strParam = "<"; } if ((!stInputCell.bcmpEq) && (!stInputCell.bcmpLt) && (stInputCell.bcmpGt)) { strParam = ">"; } if ((stInputCell.bcmpEq) && (stInputCell.bcmpLt)) { strParam = "<="; } if ((stInputCell.bcmpEq) && (stInputCell.bcmpGt)) { strParam = ">="; } if ((stInputCell.bcmpLt) && (stInputCell.bcmpGt)) { strParam = "<>"; } strNum = stDisplayCell.num; str = strOp + _T(" ") + strParam + " " + strNum; SetDlgItemText(IDC_EDIT_INPUT, str); return 0; } int CMyDlgBarInputShow::SetDisplay1(int inputInfo) { // TODO: 在此处添加实现代码. /* static int clickCounter = 0; static int clickCounterDF = 0; static int clickCounterNot = 0; static char curTaskState = 'A'; static int lastLParam = 0; static CString str, strStoreB, strStoreC, strNum; static CString strOp, strParam; CString s1,strNumTemp; int para=0; int HParam, LParam; s1.Format(_T("is this window %d"), IsWindow(m_hWnd)); SysLog(s1); // ChangeState(inputInfo>>16, lastTaskState, curTaskState); if (inputInfo == 0x00010008) { clickCounterDF++; if (clickCounterDF == 1) //DF redefine key value { inputInfo = 0x00010008; } else if (clickCounterDF == 2) { inputInfo = 0x00010009; clickCounterDF = 0; } } if (inputInfo==0x00010010) { clickCounter++; if (clickCounter == 1) //updown redefine key value { inputInfo = 0x00010010; } else if (clickCounter == 2) { inputInfo = 0x00010011; } else if (clickCounter == 3) { inputInfo = 0x00010012; clickCounter = 0; } } if (inputInfo == 0x00010013) { clickCounterNot++; if (clickCounterNot == 1) //NOT redefine key value { inputInfo = 0x00010013; } else if (clickCounterNot == 2) { inputInfo = 0x00010014; clickCounterNot = 0; } } HParam = inputInfo >> 16; LParam = inputInfo & 0xffff; switch (curTaskState) { case 'A': if (HParam == 0x1) //operator 1 { switch (LParam) { case 1: strOp = _T("-| |-"); strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 6: strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 7: strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 8: strOp = _T("(DF)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0c: strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0d: strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0e: strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0f: strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x10: switch (lastLParam) { case 1: strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break; default: break; } break; case 0x11: switch (lastLParam) { case 1: strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x12: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x13: switch (lastLParam) { case 1: strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break; case 8: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; case 0x14: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break; case 8: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; default: break; } } str = strOp; break; case 'B': str = strOp; if (HParam == 0x1) //operator 1 { switch (LParam) { case 1: strOp = _T("-| |-"); strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 6: strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 7: strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 8: strOp = _T("(DF)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0c: strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0d: strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0e: strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0f: strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x10: switch (lastLParam) { case 1: strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break; default: break; } break; case 0x11: switch (lastLParam) { case 1: strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x12: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x13: switch (lastLParam) { case 1: strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break; case 8: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; case 0x14: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break; case 8: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: strParam =_T(" X");curTaskState = 'C'; break; case 2: strParam = _T(" Y");curTaskState = 'C'; break; case 3: strParam = _T(" R");curTaskState = 'C'; break; case 4: strParam = _T(" L"); curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: strParam = _T(" T"); curTaskState = 'C';break; case 7: strParam = _T(" C");curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; default: break; } } str = strOp + _T(" ") + strParam; break; case 'C': // str = strOp + _T(" ") + strParam; if (HParam == 0x1) //operator 1 { switch (LParam) { case 1: strOp = _T("-| |-"); strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 6: strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 7: strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 8: strOp = _T("(DF)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0c: strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0d: strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0e: strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0f: strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x10: switch (lastLParam) { case 1: strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break; default: break; } break; case 0x11: switch (lastLParam) { case 1: strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x12: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x13: switch (lastLParam) { case 1: strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break; case 8: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; case 0x14: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break; case 8: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: strParam = _T(" X");curTaskState = 'C'; break; case 2: strParam = _T(" Y");curTaskState = 'C'; break; case 3: strParam = _T(" R");curTaskState = 'C'; break; case 4: strParam = _T(" L"); curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: strParam = _T(" T"); curTaskState = 'C';break; case 7: strParam = _T(" C");curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; default: break; } } else if (HParam == 0x3) { switch (LParam) { case 0: strNumTemp = _T("0");curTaskState = 'D'; break; case 1: strNumTemp = _T("1");curTaskState = 'D'; break; case 2: strNumTemp = _T("2");curTaskState = 'D'; break; case 3: strNumTemp = _T("3"); curTaskState = 'D';break; case 4: strNumTemp = _T("4");curTaskState = 'D'; break; case 5: strNumTemp = _T("5");curTaskState = 'D'; break; case 6: strNumTemp = _T("6"); curTaskState = 'D';break; case 7: strNumTemp = _T("7");curTaskState = 'D'; break; case 8: strNumTemp = _T("8");curTaskState = 'D'; break; case 9: strNumTemp = _T("9");curTaskState = 'D'; break; case 0x0A: strNumTemp = _T("A");curTaskState = 'D'; break; case 0x0B: strNumTemp = _T("B");curTaskState = 'D'; break; case 0x0C: strNumTemp = _T("C"); curTaskState = 'D';break; case 0x0D: strNumTemp = _T("D");curTaskState = 'D'; break; case 0x0E: strNumTemp = _T("E");curTaskState = 'D'; break; case 0x0F: strNumTemp = _T("F");curTaskState = 'D'; break; default: break; } if (strNum.GetLength() < 4) { strNum.Append(strNumTemp); } else { strNum = strNum.Right(strNum.GetLength() - 1); strNum.Append(strNumTemp); } } str = strOp + _T(" ") + strParam+ " " + strNum; break; case 'D': if (HParam == 0x1) //operator 1 { switch (LParam) { case 1: strOp = _T("-| |-"); strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = ""; if (lastLParam != LParam) { clickCounter = 0; clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'B'; break; case 4: strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 5: strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 6: strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 7: strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break; case 8: strOp = _T("(DF)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = ""; if (lastLParam != LParam) { clickCounterNot = 0; } lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break; case 0x0b: strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0c: strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0d: strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0e: strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x0f: strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break; case 0x10: switch (lastLParam) { case 1: strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break; default: break; } break; case 0x11: switch (lastLParam) { case 1: strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x12: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break; case 3: strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break; default: break; } break; case 0x13: switch (lastLParam) { case 1: strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break; case 8: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; case 0x14: switch (lastLParam) { case 1: strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break; case 2: strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break; case 8: strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break; case 9: strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break; case 3: case 4: case 5: case 6: case 7: case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: strOp = _T("- / -");strParam = "";curTaskState = 'A';break; default: break; } break; default: break; } strNum.Empty(); } else if (HParam == 0x2) { switch (LParam) { case 1: strParam = _T(" X");curTaskState = 'C'; break; case 2: strParam = _T(" Y");curTaskState = 'C'; break; case 3: strParam = _T(" R");curTaskState = 'C'; break; case 4: strParam = _T(" L"); curTaskState = 'C';break; case 5: strParam = _T(" P");curTaskState = 'C'; break; case 6: strParam = _T(" T"); curTaskState = 'C';break; case 7: strParam = _T(" C");curTaskState = 'C'; break; case 8: strParam = _T(" E");curTaskState = 'C'; break; default: break; } strNum.Empty(); } else if (HParam == 0x3) { switch (LParam) { case 0: strNumTemp = _T("0");curTaskState = 'D'; break; case 1: strNumTemp = _T("1");curTaskState = 'D'; break; case 2: strNumTemp = _T("2");curTaskState = 'D'; break; case 3: strNumTemp = _T("3"); curTaskState = 'D';break; case 4: strNumTemp = _T("4");curTaskState = 'D'; break; case 5: strNumTemp = _T("5");curTaskState = 'D'; break; case 6: strNumTemp = _T("6"); curTaskState = 'D';break; case 7: strNumTemp = _T("7");curTaskState = 'D'; break; case 8: strNumTemp = _T("8");curTaskState = 'D'; break; case 9: strNumTemp = _T("9");curTaskState = 'D'; break; case 0x0A: strNumTemp = _T("A");curTaskState = 'D'; break; case 0x0B: strNumTemp = _T("B");curTaskState = 'D'; break; case 0x0C: strNumTemp = _T("C"); curTaskState = 'D';break; case 0x0D: strNumTemp = _T("D");curTaskState = 'D'; break; case 0x0E: strNumTemp = _T("E");curTaskState = 'D'; break; case 0x0F: strNumTemp = _T("F");curTaskState = 'D'; break; default: break; } if (strNum.GetLength() < 4) { strNum.Append(strNumTemp); } else { strNum = strNum.Right(strNum.GetLength() - 1); strNum.Append(strNumTemp); } } else if (HParam == 0x14) { strParam = ""; strNum = ""; curTaskState = 'A'; strNum.Empty(); } str = strOp + _T(" ") + strParam + " " + strNum; break; } SetDlgItemText(IDC_EDIT_INPUT,str); // m_edit_input.SetWindowText(str); */ return 0; } MTerm2/MyDlgBarInputShow.h
New file @@ -0,0 +1,51 @@ #pragma once #include "MTerm2View.h" // CMyDlgBarInputShow 对话框 class CMyDlgBarInputShow : public CDialogBar { DECLARE_DYNAMIC(CMyDlgBarInputShow) public: CMyDlgBarInputShow(CWnd* pParent = nullptr); // 标准构造函数 virtual ~CMyDlgBarInputShow(); // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DIALOGBAR_INPUT_SHOW }; #endif public: struct tagInputCell { char OP= CMTerm2View::typeNO; bool bnot=false; bool bpp= false; bool bpn = false; bool bcmpEq = false; bool bcmpLt = false; bool bcmpGt = false; bool bDouble = false; bool bDouble1 = false; //for -||-D and -||- turn bool bFloat = false; bool bFloat1 = false; bool bLeftLineUp = false; bool brightLineUp = false; int param=0; CString num=_T(""); }; tagInputCell stInputCell; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 public: DECLARE_MESSAGE_MAP() public: int SetDisplay(int inputInfo); int SetDisplay1(int inputInfo); int display(tagInputCell stDisplayCell); void stInit(); CEdit m_edit_input; }; MTerm2/pch.h
@@ -26,5 +26,7 @@ #include <afxcontrolbars.h> #include <afxcontrolbars.h> #include <afxcontrolbars.h> #include <afxwin.h> #include <afxwin.h> #endif //PCH_H MTerm2/res/bmp00004.bmp
MTerm2/res/toolbar1.bmpMTerm2/res/toolbar_.bmp
MTerm2/res/toolbar_func_key.bmp
MTerm2/resource.h
@@ -42,6 +42,7 @@ #define IDB_CLASS_VIEW 177 #define IDB_CLASS_VIEW_24 178 #define IDR_TOOLBAR_NUM 310 #define IDR_TOOLBAR_NUM_KEY 310 #define IDD_MTerm2TestView 311 #define IDD_MTerm2CtrlView 312 #define IDD_MTerm2DataView 313 @@ -50,11 +51,13 @@ #define IDD_DIALOG1 316 #define IDW_TOOL_BAR_EDIT 316 #define ID_VIEW_NAVVIEW 317 #define IDW_TOOL_BAR_FUNC_KEY 318 #define IDD_DIALOG_SET_COIL 320 #define IDD_DIALOG_SET_DATA 321 #define IDR_MENU1 324 #define IDD_DIALOG_IO_COMMENT 325 #define IDR_TOOLBAR_EDIT 327 #define IDR_TOOLBAR_EDIT_KEY 327 #define IDR_TOOLBAR_INPUT_SHOW 329 #define IDR_TOOLBAR_COMMENT 332 #define IDR_TOOLBAR_INFO_SHOW 334 @@ -68,6 +71,11 @@ #define IDD_PROP_COMM_CFG1 344 #define IDD_PROP_MODE_CFG1 344 #define IDD_DIALOG_FACT_CFG 345 #define IDD_DIALOGBAR_FUNC_KEYS 349 #define IDD_DIALOGBAR2 350 #define IDR_TOOLBAR_FUNC_KEY2 351 #define IDD_DIALOGBAR 351 #define IDD_DIALOGBAR_INPUT_SHOW 351 #define IDC_EDIT1 1000 #define IDC_BUTTON1 1001 #define IDC_BUTTON_LOAD 1001 @@ -217,12 +225,21 @@ #define IDC_EDIT8 1060 #define IDC_EDIT32 1060 #define IDC_COMBO2 1061 #define IDC_EDIT_INPUT 1061 #define IDC_COMBO3 1062 #define IDC_BUTTON5 1062 #define IDC_RADIO1 1063 #define IDC_BUTTON_CLEAR 1063 #define IDC_RADIO2 1064 #define IDC_BUTTON_ADD 1064 #define IDC_RADIO3 1065 #define IDC_EDIT_VIEW 1065 #define IDC_STATIC_PROP 1066 #define IDC_BUTTON_BACKSPACE 1066 #define IDC_SCROLLBAR1 1067 #define IDC_BUTTON_0 1067 #define IDC_BUTTON_EQ 1068 #define IDC_BUTTON1_DOT 1069 #define IDC_EDIT_DAY 1070 #define IDC_RADIO4 1070 #define IDC_EDIT_HOUR 1071 @@ -269,23 +286,40 @@ #define IDC_RICHEDIT2_LOG 1717 #define IDC_EDIT_LOG1 1719 #define ID_BUTTON32771 32771 #define ID_BUTTON_0 32771 #define ID_BUTTON32772 32772 #define ID_BUTTON_1 32772 #define ID_BUTTON32773 32773 #define ID_BUTTON_2 32773 #define ID_BUTTON32774 32774 #define ID_BUTTON_3 32774 #define ID_BUTTON32775 32775 #define ID_BUTTON_4 32775 #define ID_BUTTON32776 32776 #define ID_BUTTON_5 32776 #define ID_BUTTON32777 32777 #define ID_BUTTON_6 32777 #define ID_BUTTON32778 32778 #define ID_BUTTON_7 32778 #define ID_BUTTON32779 32779 #define ID_BUTTON_8 32779 #define ID_BUTTON32780 32780 #define ID_BUTTON32781 32781 #define ID_BUTTON_A 32781 #define ID_BUTTON32782 32782 #define ID_BUTTON_B 32782 #define ID_BUTTON32783 32783 #define ID_BUTTON_C 32783 #define ID_BUTTON32784 32784 #define ID_BUTTON_D 32784 #define ID_BUTTON32785 32785 #define ID_BUTTON_E 32785 #define ID_BUTTON32786 32786 #define ID_BUTTON_F 32786 #define ID_BUTTON32787 32787 #define ID_BUTTON_MINUS 32787 #define ID_BUTTON32788 32788 #define ID_BUTTON_DOT 32788 #define ID_RECT_SELECT 32791 #define ID_BUTTON32793 32793 #define ID_BUTTON32795 32795 @@ -473,9 +507,13 @@ #define ID_INPUT_IO_COMMENT 33049 #define ID_BUTTON33052 33052 #define ID_BUTTON33053 33053 #define ID_BUTTON_RET 33053 #define ID_BUTTON33054 33054 #define ID_BUTTON_INSERT 33054 #define ID_BUTTON33055 33055 #define ID_BUTTON_DELETE 33055 #define ID_BUTTON33056 33056 #define ID_BUTTON_ESC 33056 #define ID_BUTTON_INPUT_SHOW 33057 #define ID_BUTTON33058 33058 #define ID_BUTTON33059 33059 @@ -501,6 +539,12 @@ #define ID_DATETIME_SET 33081 #define ID_MENU_DATETIME_SET 33082 #define ID_MENU_EVENT_LOG 33083 #define ID_BUTTON_9 33084 #define ID_BUTTON33085 33085 #define ID_BUTTON33086 33086 #define ID_33088 33088 #define ID_MENU_SHOW_DEV 33089 #define IDS_STRING101 33101 #define ID_INDICATOR_SEL_TYPE 59135 #define ID_INDICATOR_MACHINE_TYPE 59142 #define ID_INDICATOR_PROGRAM_POS 59143 @@ -514,9 +558,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 349 #define _APS_NEXT_COMMAND_VALUE 33084 #define _APS_NEXT_CONTROL_VALUE 1061 #define _APS_NEXT_SYMED_VALUE 318 #define _APS_NEXT_RESOURCE_VALUE 356 #define _APS_NEXT_COMMAND_VALUE 33091 #define _APS_NEXT_CONTROL_VALUE 1070 #define _APS_NEXT_SYMED_VALUE 319 #endif #endif