From e00d5a1575d26f8fec1be6fa8a844203cd66a24c Mon Sep 17 00:00:00 2001 From: Yao Chunli <56721587@qq.com> Date: 星期二, 21 六月 2022 16:11:11 +0800 Subject: [PATCH] edit input key --- MTerm2/MainFrm.cpp | 247 +++ MTerm2/MyDlgBarInputShow.h | 32 MTerm2/MTerm2View.cpp | 29 MTerm2/MainFrm.h | 35 MTerm2/DialogFactCfg.h | 14 MTerm2/MTerm2View.h | 2 MTerm2/resource.h | 16 MTerm2/MyDlgBarInputShow.cpp | 3202 +++++++++++++++++++++++++++++++++++++++++ MTerm2/res/toolbar1.bmp | 0 MTerm2/MyDlgBarFuncKey.h | 132 + MTerm2/DialogFactCfg.cpp | 108 + MTerm2/MyDlgBarFuncKey.cpp | 792 ++++++++++ MTerm2/MTerm2.rc | 0 13 files changed, 4,581 insertions(+), 28 deletions(-) diff --git a/MTerm2/DialogFactCfg.cpp b/MTerm2/DialogFactCfg.cpp index ad10b8f..51f56ad 100644 --- a/MTerm2/DialogFactCfg.cpp +++ b/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: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + CharKeyClick(_T("0")); +} + + +void CDialogFactCfg::OnBnClickedButton1Dot() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + CharKeyClick(_T(".")); +} + + +void CDialogFactCfg::OnBnClickedButtonEq() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + bEditEndFlg = true; + + float a = _tstof(sStoreStr); + float b = _tstof(sDisplayStr); + + float c = a + b; + + sDisplayStr.Format(_T("%g"),c); + SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr); + +} diff --git a/MTerm2/DialogFactCfg.h b/MTerm2/DialogFactCfg.h index ec7107f..643daf2 100644 --- a/MTerm2/DialogFactCfg.h +++ b/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(); }; diff --git a/MTerm2/MTerm2.rc b/MTerm2/MTerm2.rc index 22911cf..104ed17 100644 --- a/MTerm2/MTerm2.rc +++ b/MTerm2/MTerm2.rc Binary files differ diff --git a/MTerm2/MTerm2View.cpp b/MTerm2/MTerm2View.cpp index 8e84d07..c7045df 100644 --- a/MTerm2/MTerm2View.cpp +++ b/MTerm2/MTerm2View.cpp @@ -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: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 @@ -2722,3 +2750,4 @@ } return 0; } + diff --git a/MTerm2/MTerm2View.h b/MTerm2/MTerm2View.h index 897654b..968ad3c 100644 --- a/MTerm2/MTerm2View.h +++ b/MTerm2/MTerm2View.h @@ -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 涓殑璋冭瘯鐗堟湰 diff --git a/MTerm2/MainFrm.cpp b/MTerm2/MainFrm.cpp index 80b08c2..9db7d0e 100644 --- a/MTerm2/MainFrm.cpp +++ b/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, 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[] = @@ -202,6 +225,7 @@ } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH); + //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)) @@ -253,6 +277,7 @@ //*/ return 0; } + BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { @@ -316,7 +341,7 @@ m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE); m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW); ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE); - + } @@ -399,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: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030000); +} +void CMainFrame::OnBtn1() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030001); +} +void CMainFrame::OnBtn2() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030002); +} +void CMainFrame::OnBtn3() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030003); +} +void CMainFrame::OnBtn4() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030004); +} +void CMainFrame::OnBtn5() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030005); +} +void CMainFrame::OnBtn6() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030006); +} +void CMainFrame::OnBtn7() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030007); +} +void CMainFrame::OnBtn8() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030008); +} +void CMainFrame::OnBtn9() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00030009); +} +void CMainFrame::OnBtnA() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x0003000A); +} +void CMainFrame::OnBtnB() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x0003000B); +} +void CMainFrame::OnBtnC() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x0003000C); +} + +void CMainFrame::OnBtnD() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x0003000D); +} +void CMainFrame::OnBtnE() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x0003000E); +} +void CMainFrame::OnBtnF() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + + m_wndDlgBar_InputShow.SetDisplay(0x0003000F); + + + +} +void CMainFrame::OnBtnMinus() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + //m_wndDlgBar_InputShow.SetDisplay(_T("-")); +} +void CMainFrame::OnBtnDot() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + //m_wndDlgBar_InputShow.SetDisplay(_T(".")); +} + + + + +int CMainFrame::GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell) +{ + + localInputCell = inputCell; + return 0; +} + + +void CMainFrame::OnBtnRet() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + 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: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00240000); + m_wndDlgBar_Func_Key.SetBtnDisplayESC(); +} +void CMainFrame::OnBtnDelete() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndDlgBar_InputShow.SetDisplay(0x00340000); + m_wndDlgBar_Func_Key.SetBtnDisplayESC(); +} +void CMainFrame::OnBtnEsc() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + //m_wndDlgBar_InputShow.SetDisplay(_T("Esc")); + m_wndDlgBar_Func_Key.SetBtnDisplayESC(); +} + +void CMainFrame::OnMenuShowDev() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + +} diff --git a/MTerm2/MainFrm.h b/MTerm2/MainFrm.h index 6d23b0a..6a50834 100644 --- a/MTerm2/MainFrm.h +++ b/MTerm2/MainFrm.h @@ -29,7 +29,7 @@ // 閲嶅啓 public: virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - + CStatusBar m_wndStatusBar; // 瀹炵幇 public: virtual ~CMainFrame(); @@ -42,7 +42,7 @@ CToolBar m_wndToolBar; // CMyFuncKeyToolBar m_wndToolBar_Func_Key; - CMyDlgBarFuncKey m_wndDlgBar_Func_Key; + CMyDlgBarFuncKey m_wndDlgBar_Func_Key; CToolBar m_wndTBar_Edit_Key; CToolBar m_wndTBar_Num_Key; // CToolBar m_wndTBar_InputShow; @@ -54,10 +54,11 @@ CEdit m_InputShowEdit; CStaticEx m_InputShowStatic; - CStatusBar m_wndStatusBar; + CMyPaneLog m_wndMyPaneLog; CMyDialogLog m_dlgMyLog; + CMyDlgBarInputShow::tagInputCell localInputCell; // 鐢熸垚鐨勬秷鎭槧灏勫嚱鏁� protected: @@ -79,9 +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(); + }; + diff --git a/MTerm2/MyDlgBarFuncKey.cpp b/MTerm2/MyDlgBarFuncKey.cpp index a50d9f7..07a5915 100644 --- a/MTerm2/MyDlgBarFuncKey.cpp +++ b/MTerm2/MyDlgBarFuncKey.cpp @@ -6,15 +6,43 @@ #include "MyDlgBarFuncKey.h" #include "afxdialogex.h" +#include "MainFrm.h" + // CMyDlgBarFuncKey 瀵硅瘽妗� -CMyDlgBarFuncKey::structButton myButtons[3][12] = + + CMyDlgBarFuncKey::structButton myButtons[6][3][11] = { - {33101,_T("11"), 33102,_T("12") ,33103,_T("13"), 33104,_T("14") ,33105,_T("15") ,33106,_T("16") ,33107,_T("17") ,33108,_T("18") ,33109,_T("19") ,33110,_T("110") ,33111,_T("111"), 33112,_T("112") }, - {33201,_T("21"), 33202,_T("22") ,33203,_T("23"), 33204,_T("24") ,33205,_T("25") ,33206,_T("26") ,33207,_T("27") ,33208,_T("28") ,33209,_T("29") ,33210,_T("210") ,33211,_T("211"), 33212,_T("212") }, - {33301,_T("31"), 33302,_T("32") ,33303,_T("33"), 33304,_T("34") ,33305,_T("35") ,33306,_T("36") ,33307,_T("37") ,33308,_T("38") ,33309,_T("39") ,33310,_T("310") ,33311,_T("311"), 33312,_T("312") }, + {{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("娆in") ,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) / sizeof(CMyDlgBarFuncKey::structButton); + +static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(CMyDlgBarFuncKey::structButton); + + + + IMPLEMENT_DYNAMIC(CMyDlgBarFuncKey, CDialogBar) @@ -32,14 +60,75 @@ } - 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) @@ -57,6 +146,7 @@ { TRACE("InitDialogBar Failed锛�"); } + CRect rect0; GetClientRect(&rect0); int nWidth = rect0.Width(); @@ -64,38 +154,98 @@ int nLeftMargin = 48; int nSpace = nWidth - nLeftMargin; int x1, y1, x2, y2; - CRect rect1(0, 0, 100, 24); + CRect rect1(0, 0, 100, 10); + // font1.CreatePointFont(95, _T("妤蜂綋")); for (int i = 0; i < m_Lines; i++) { - for (int j = 0; j < 12; j++) { - x1 = nLeftMargin + j * nSpace / 12; + for (int j = 0; j < 11; j++) { + x1 = nLeftMargin + j * nSpace / 11; y1 = i * nHeight / 3; - x2 = x1 + nSpace / 12; + x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); - m_buttons[i][j].Create(myButtons[i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[i][j].nID); + 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: 鍦ㄦ娣诲姞涓撶敤浠g爜鍜�/鎴栬皟鐢ㄥ熀绫� BOOL bRes = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); -// OnInitDialog(0,0); + // OnInitDialog(0,0); return bRes; -// -// return CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); + // + // return CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); } void CMyDlgBarFuncKey::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler) { // TODO: 鍦ㄦ娣诲姞涓撶敤浠g爜鍜�/鎴栬皟鐢ㄥ熀绫� - CDialogBar::OnUpdateCmdUI(pTarget, FALSE); + CDialogBar::OnUpdateCmdUI(pTarget, FALSE); } @@ -106,3 +256,615 @@ 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); + +} \ No newline at end of file diff --git a/MTerm2/MyDlgBarFuncKey.h b/MTerm2/MyDlgBarFuncKey.h index c450263..5526700 100644 --- a/MTerm2/MyDlgBarFuncKey.h +++ b/MTerm2/MyDlgBarFuncKey.h @@ -3,11 +3,71 @@ // 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; @@ -28,12 +88,80 @@ DECLARE_MESSAGE_MAP() public: - CButton m_buttons[3][12]; + 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; + 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(); }; diff --git a/MTerm2/MyDlgBarInputShow.cpp b/MTerm2/MyDlgBarInputShow.cpp index e706277..bca9c04 100644 --- a/MTerm2/MyDlgBarInputShow.cpp +++ b/MTerm2/MyDlgBarInputShow.cpp @@ -5,9 +5,14 @@ #include "MTerm2.h" #include "MyDlgBarInputShow.h" #include "afxdialogex.h" +#include "KDefine.h" +#include "MTerm2View.h" +#include "MainFrm.h" // CMyDlgBarInputShow 瀵硅瘽妗� + + IMPLEMENT_DYNAMIC(CMyDlgBarInputShow, CDialogBar) @@ -23,11 +28,3208 @@ 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; +} + diff --git a/MTerm2/MyDlgBarInputShow.h b/MTerm2/MyDlgBarInputShow.h index de7c40e..fa24649 100644 --- a/MTerm2/MyDlgBarInputShow.h +++ b/MTerm2/MyDlgBarInputShow.h @@ -1,5 +1,6 @@ 锘�#pragma once +#include "MTerm2View.h" // CMyDlgBarInputShow 瀵硅瘽妗� @@ -15,9 +16,36 @@ #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; + }; diff --git a/MTerm2/res/toolbar1.bmp b/MTerm2/res/toolbar1.bmp index dcf1a50..584727d 100644 --- a/MTerm2/res/toolbar1.bmp +++ b/MTerm2/res/toolbar1.bmp Binary files differ diff --git a/MTerm2/resource.h b/MTerm2/resource.h index d437f8d..b62b911 100644 --- a/MTerm2/resource.h +++ b/MTerm2/resource.h @@ -225,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 @@ -533,6 +542,9 @@ #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 @@ -547,8 +559,8 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 356 -#define _APS_NEXT_COMMAND_VALUE 33087 -#define _APS_NEXT_CONTROL_VALUE 1061 +#define _APS_NEXT_COMMAND_VALUE 33091 +#define _APS_NEXT_CONTROL_VALUE 1070 #define _APS_NEXT_SYMED_VALUE 319 #endif #endif -- Gitblit v1.9.1