// MyFormLog.cpp : ʵÏÖÎļþ // #include "pch.h" #include "MTerm1.h" #include "MyFormInputShow.h" #include "MainFrm.h" static int flag = 0; static int showPage = 0; // CMyFormLog structButton myButtons[6][3][11] = { {{IDC_BUTTON_AND,_T("-| |-"), IDC_BUTTON_OR,_T("©¸©È©À©¼") ,IDC_BUTTON_VLINE,_T("|"), IDC_BUTTON_OUT,_T("-[OUT]") ,IDC_BUTTON_TMCT,_T("TM/CT") ,IDC_BUTTON_FUN,_T("Fun") ,IDC_BUTTON_HLINE,_T("¡ª¡ª") ,IDC_BUTTON_NOT,_T("NOT/") ,IDC_BUTTON_INDEX,_T("INDEX") ,IDC_BUTTON_MC,_T("(MC)") ,IDC_BUTTON_MCE,_T("(MCE)") }, {IDC_BUTTON_SET,_T("--"), IDC_BUTTON_RESET,_T("-") ,IDC_BUTTON_DF,_T("(DF(/))"), IDC_BUTTON_END,_T("(END)") ,IDC_BUTTON_COMPARE,_T("±È½Ï") ,IDC_BUTTON_PFUN,_T("PFun") ,IDC_BUTTON_UPDOWN,_T("¡ü¡ý") ,IDC_BUTTON_BIT,_T("[λ]") ,IDC_BUTTON_WORD,_T("[×Ö]") ,IDC_BUTTON_INSTRUCTION1,_T("Ö¸Áî1") ,IDC_BUTTON_INSTRUCTION2,_T("Ö¸Áî2") }, {IDC_BUTTON_PGCONVERT,_T("PGת»»"), IDC_BUTTON_ONLINE,_T("ÔÚÏß") ,IDC_BUTTON_OFFLINE,_T("ÀëÏß"), IDC_BUTTON_COLSE,_T("¹Ø±Õ") ,IDC_BUTTON_FIND,_T("²éÕÒ") ,IDC_BUTTON_NEXTWIN,_T("´ÎWin") ,IDC_BUTTON_MONITOR,_T("¼à¿ØGo") ,IDC_BUTTON_STATUS,_T("״̬") ,IDC_BUTTON_RUNPROG,_T("Run/Prog") ,IDC_BUTTON_PLCREAD,_T("PLC¶ÁÈ¡") ,IDC_BUTTON_PLCWRITE,_T("PLCдÈë") } }, {{IDC_BUTTON_X,_T("X"), IDC_BUTTON_Y,_T("Y") ,IDC_BUTTON_R,_T("R"), IDC_BUTTON_L,_T("L") ,IDC_BUTTON_P,_T("P") ,IDC_BUTTON_COMPARE1,_T("±È½Ï") ,33407,_T("") ,IDC_BUTTON_NOT1,_T("NOT/") ,IDC_BUTTON_INDEX,_T("INDEX") ,IDC_BUTTON_NOCLEAR,_T("No.Çå³ý") ,33411,_T("") }, {IDC_BUTTON_T,_T("T"), 33502,_T("C") ,33503,_T("E"), 33504,_T("") ,33505,_T("") ,33506,_T("") ,IDC_BUTTON_UPDOWN1,_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("") }}, {{IDC_BUTTON_D,_T("D"), IDC_BUTTON_F,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,IDC_BUTTON_NEQ,_T("=") ,IDC_BUTTON_GT,_T(">") ,IDC_BUTTON_LT,_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("") }}, {{IDC_BUTTON_WX,_T("WX"), IDC_BUTTON_WY,_T("WY") ,IDC_BUTTON_WR,_T("WR"), IDC_BUTTON_WL,_T("WL") ,IDC_BUTTON_DT,_T("DT") ,IDC_BUTTON_LD,_T("LD") ,IDC_BUTTON_FL,_T("FL") ,34108,_T("") ,IDC_BUTTON_INDEX,_T("INDEX") ,IDC_BUTTON_NOCLEAR,_T("No.Çå³ý") ,34111,_T("") }, {IDC_BUTTON_SV,_T("SV"), IDC_BUTTON_EV,_T("EV") ,IDC_BUTTON_K,_T("K"), IDC_BUTTON_H,_T("H") ,IDC_BUTTON_M,_T("M") ,IDC_BUTTON_f,_T("f") ,34207,_T("") ,34208,_T("") ,34209,_T("") ,34210,_T("") ,34211,_T("") }, {IDC_BUTTON_PGCONVERT,_T("PGת»»"), 34302,_T("") ,34303,_T(""), 34304,_T("") ,34305,_T("") ,34306,_T("") ,34307,_T("") ,34308,_T("") ,34309,_T("") ,34310,_T("") ,34311,_T("") }}, {{IDC_BUTTON_IXI0,_T("IX(I0)"), IDC_BUTTON_IYI1,_T("IY(I1)") ,IDC_BUTTON_I2,_T("I2"), IDC_BUTTON_I3,_T("I3") ,IDC_BUTTON_I4,_T("I4") ,IDC_BUTTON_I5,_T("I5") ,IDC_BUTTON_I6,_T("I6") ,IDC_BUTTON_I7,_T("I7") ,IDC_BUTTON_I8,_T("I8") ,34410,_T("") ,34411,_T("") }, {IDC_BUTTON_I9,_T("I9"), IDC_BUTTON_IA,_T("IA") ,IDC_BUTTON_IB,_T("IB"), IDC_BUTTON_IC,_T("IC") ,IDC_BUTTON_ID,_T("ID") ,34506,_T("") ,IDC_BUTTON_UPDOWN,_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("") }}, {{IDC_BUTTON_TMX,_T("TMX"), IDC_BUTTON_TMY,_T("TMY") ,IDC_BUTTON_TMR,_T("TMR"), IDC_BUTTON_TML,_T("TML") ,34705,_T("") ,IDC_BUTTON_CT,_T("-[CT]-") ,34707,_T("") ,34708,_T("") ,IDC_BUTTON_INDEX,_T("INDEX") ,34710,_T("") ,34711,_T("") }, {34801,_T(""), 34802,_T("") ,34803,_T(""), 34804,_T("") ,34805,_T("") ,34806,_T("") ,34807,_T("") ,34808,_T("") ,34809,_T("") ,34810,_T("") ,34811,_T("") }, {34901,_T(""), 34902,_T("") ,34903,_T(""), 34904,_T("") ,34905,_T("") ,34906,_T("") ,34907,_T("") ,34908,_T("") ,34909,_T("") ,3490,_T("") ,34911,_T("") }}, }; static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(structButton); structButton myNumButtons[18] = { ID_BUTTON_0,_T("0"), ID_BUTTON_1,_T("1") ,ID_BUTTON_2,_T("2"), ID_BUTTON_3,_T("3") ,ID_BUTTON_4,_T("4") ,ID_BUTTON_5,_T("5") ,ID_BUTTON_6,_T("6") ,ID_BUTTON_7,_T("7") , ID_BUTTON_8,_T("8") ,ID_BUTTON_9,_T("9") ,ID_BUTTON_A,_T("A"),ID_BUTTON_B,_T("B"),ID_BUTTON_C,_T("C"),ID_BUTTON_D,_T("D"),ID_BUTTON_E,_T("E"),ID_BUTTON_F,_T("F"), ID_BUTTON_MINUS,_T("-"),ID_BUTTON_DOT,_T(".") }; static int myNumButtonCount = sizeof(myNumButtons) / sizeof(structButton); structButton myCmdButtons[4] = { ID_BUTTON_RET, _T("¨L"), ID_BUTTON_INSERT, _T("Ins"), ID_BUTTON_DELETE, _T("Del"), ID_BUTTON_ESC, _T("Esc") }; static int myCmdButtonCount = sizeof(myCmdButtons) / sizeof(structButton); IMPLEMENT_DYNCREATE(CMyFormInputShow, CFormView) CMyFormInputShow::CMyFormInputShow() : CFormView(CMyFormInputShow::IDD) { } CMyFormInputShow::~CMyFormInputShow() { } void CMyFormInputShow::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input); } BEGIN_MESSAGE_MAP(CMyFormInputShow, CFormView) ON_WM_CREATE() ON_WM_DESTROY() ON_WM_SIZE() ON_WM_MOUSEACTIVATE() ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON1, &CMyFormInputShow::OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON_AND, &CMyFormInputShow::OnBnClickedBtnAnd) ON_BN_CLICKED(IDC_BUTTON_OR, &CMyFormInputShow::OnBnClickedBtnOr) ON_BN_CLICKED(IDC_BUTTON_VLINE, &CMyFormInputShow::OnBnClickedBtnVline) ON_BN_CLICKED(IDC_BUTTON_OUT, &CMyFormInputShow::OnBnClickedBtnOut) ON_BN_CLICKED(IDC_BUTTON_TMCT, &CMyFormInputShow::OnBnClickedBtnTmCt) ON_BN_CLICKED(IDC_BUTTON_FUN, &CMyFormInputShow::OnBnClickedBtnFun) ON_BN_CLICKED(IDC_BUTTON_HLINE, &CMyFormInputShow::OnBnClickedBtnHLine) ON_BN_CLICKED(IDC_BUTTON_NOT, &CMyFormInputShow::OnBnClickedBtnNot) ON_BN_CLICKED(IDC_BUTTON_INDEX, &CMyFormInputShow::OnBnClickedBtnIndex) ON_BN_CLICKED(IDC_BUTTON_MC, &CMyFormInputShow::OnBnClickedBtnMc) ON_BN_CLICKED(IDC_BUTTON_MCE, &CMyFormInputShow::OnBnClickedBtnMce) ON_BN_CLICKED(IDC_BUTTON_SET, &CMyFormInputShow::OnBnClickedBtnSet) ON_BN_CLICKED(IDC_BUTTON_RESET, &CMyFormInputShow::OnBnClickedBtnReset) ON_BN_CLICKED(IDC_BUTTON_DF, &CMyFormInputShow::OnBnClickedBtnDf) ON_BN_CLICKED(IDC_BUTTON_END, &CMyFormInputShow::OnBnClickedBtnEnd) ON_BN_CLICKED(IDC_BUTTON_COMPARE, &CMyFormInputShow::OnBnClickedBtnCompare) ON_BN_CLICKED(IDC_BUTTON_PFUN, &CMyFormInputShow::OnBnClickedBtnPFun) ON_BN_CLICKED(IDC_BUTTON_UPDOWN, &CMyFormInputShow::OnBnClickedBtnUpDown) ON_BN_CLICKED(IDC_BUTTON_BIT, &CMyFormInputShow::OnBnClickedBtnBit) ON_BN_CLICKED(IDC_BUTTON_WORD, &CMyFormInputShow::OnBnClickedBtnWord) ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION1, &CMyFormInputShow::OnBnClickedBtnInc1) ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION2, &CMyFormInputShow::OnBnClickedBtnInc2) ON_BN_CLICKED(IDC_BUTTON_PGCONVERT, &CMyFormInputShow::OnBnClickedBtnPgConvert) ON_BN_CLICKED(IDC_BUTTON_ONLINE, &CMyFormInputShow::OnBnClickedBtnOnline) ON_BN_CLICKED(IDC_BUTTON_OFFLINE, &CMyFormInputShow::OnBnClickedBtnOffline) ON_BN_CLICKED(IDC_BUTTON_COLSE, &CMyFormInputShow::OnBnClickedBtnClose) ON_BN_CLICKED(IDC_BUTTON_FIND, &CMyFormInputShow::OnBnClickedBtnFind) ON_BN_CLICKED(IDC_BUTTON_NEXTWIN, &CMyFormInputShow::OnBnClickedBtnNextWin) ON_BN_CLICKED(IDC_BUTTON_MONITOR, &CMyFormInputShow::OnBnClickedBtnMonitor) ON_BN_CLICKED(IDC_BUTTON_STATUS, &CMyFormInputShow::OnBnClickedBtnStatus) ON_BN_CLICKED(IDC_BUTTON_RUNPROG, &CMyFormInputShow::OnBnClickedBtnRunProg) ON_BN_CLICKED(IDC_BUTTON_PLCREAD, &CMyFormInputShow::OnBnClickedBtnPlcRead) ON_BN_CLICKED(IDC_BUTTON_PLCWRITE, &CMyFormInputShow::OnBnClickedBtnPlcWrite) ON_BN_CLICKED(IDC_BUTTON_X, &CMyFormInputShow::OnBnClickedBtnX) ON_BN_CLICKED(IDC_BUTTON_Y, &CMyFormInputShow::OnBnClickedBtnY) ON_BN_CLICKED(IDC_BUTTON_R, &CMyFormInputShow::OnBnClickedBtnR) ON_BN_CLICKED(IDC_BUTTON_L, &CMyFormInputShow::OnBnClickedBtnL) ON_BN_CLICKED(IDC_BUTTON_P, &CMyFormInputShow::OnBnClickedBtnP) ON_BN_CLICKED(IDC_BUTTON_COMPARE1, &CMyFormInputShow::OnBnClickedBtnCompare1) ON_BN_CLICKED(IDC_BUTTON_NOT1, &CMyFormInputShow::OnBnClickedBtnNot) ON_BN_CLICKED(IDC_BUTTON_T, &CMyFormInputShow::OnBnClickedBtnT) ON_BN_CLICKED(IDC_BUTTON_C, &CMyFormInputShow::OnBnClickedBtnC) ON_BN_CLICKED(IDC_BUTTON_E, &CMyFormInputShow::OnBnClickedBtnE) ON_BN_CLICKED(IDC_BUTTON_UPDOWN1, &CMyFormInputShow::OnBnClickedBtnUpDown) ON_BN_CLICKED(IDC_BUTTON_TMX, &CMyFormInputShow::OnBnClickedBtnTmx) ON_BN_CLICKED(IDC_BUTTON_TMY, &CMyFormInputShow::OnBnClickedBtnTmy) ON_BN_CLICKED(IDC_BUTTON_TMR, &CMyFormInputShow::OnBnClickedBtnTmr) ON_BN_CLICKED(IDC_BUTTON_TML, &CMyFormInputShow::OnBnClickedBtnTml) ON_BN_CLICKED(IDC_BUTTON_CT, &CMyFormInputShow::OnBnClickedBtnCt) ON_BN_CLICKED(IDC_BUTTON_D, &CMyFormInputShow::OnBnClickedBtnD) ON_BN_CLICKED(IDC_BUTTON_F, &CMyFormInputShow::OnBnClickedBtnF) ON_BN_CLICKED(IDC_BUTTON_NEQ, &CMyFormInputShow::OnBnClickedBtnNEQ) ON_BN_CLICKED(IDC_BUTTON_GT, &CMyFormInputShow::OnBnClickedBtnGT) ON_BN_CLICKED(IDC_BUTTON_LT, &CMyFormInputShow::OnBnClickedBtnLT) ON_BN_CLICKED(ID_BUTTON_0, &CMyFormInputShow::OnBtn0) ON_BN_CLICKED(ID_BUTTON_1, &CMyFormInputShow::OnBtn1) ON_BN_CLICKED(ID_BUTTON_2, &CMyFormInputShow::OnBtn2) ON_BN_CLICKED(ID_BUTTON_3, &CMyFormInputShow::OnBtn3) ON_BN_CLICKED(ID_BUTTON_4, &CMyFormInputShow::OnBtn4) ON_BN_CLICKED(ID_BUTTON_5, &CMyFormInputShow::OnBtn5) ON_BN_CLICKED(ID_BUTTON_6, &CMyFormInputShow::OnBtn6) ON_BN_CLICKED(ID_BUTTON_7, &CMyFormInputShow::OnBtn7) ON_BN_CLICKED(ID_BUTTON_8, &CMyFormInputShow::OnBtn8) ON_BN_CLICKED(ID_BUTTON_9, &CMyFormInputShow::OnBtn9) ON_BN_CLICKED(ID_BUTTON_A, &CMyFormInputShow::OnBtnA) ON_BN_CLICKED(ID_BUTTON_B, &CMyFormInputShow::OnBtnB) ON_BN_CLICKED(ID_BUTTON_C, &CMyFormInputShow::OnBtnC) ON_BN_CLICKED(ID_BUTTON_D, &CMyFormInputShow::OnBtnD) ON_BN_CLICKED(ID_BUTTON_E, &CMyFormInputShow::OnBtnE) ON_BN_CLICKED(ID_BUTTON_F, &CMyFormInputShow::OnBtnF) ON_BN_CLICKED(ID_BUTTON_MINUS, &CMyFormInputShow::OnBtnMinus) ON_BN_CLICKED(ID_BUTTON_DOT, &CMyFormInputShow::OnBtnDot) ON_BN_CLICKED(ID_BUTTON_RET, &CMyFormInputShow::OnBtnRet) ON_BN_CLICKED(ID_BUTTON_INSERT, &CMyFormInputShow::OnBtnInsert) ON_BN_CLICKED(ID_BUTTON_DELETE, &CMyFormInputShow::OnBtnDelete) ON_BN_CLICKED(ID_BUTTON_ESC, &CMyFormInputShow::OnBtnEsc) ON_WM_CHAR() ON_COMMAND(ID_KEY_X, &CMyFormInputShow::OnKeyX) END_MESSAGE_MAP() // CMyFormLog Õï¶Ï #ifdef _DEBUG void CMyFormInputShow::AssertValid() const { CFormView::AssertValid(); } #ifndef _WIN32_WCE void CMyFormInputShow::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif #endif //_DEBUG // CMyFormLog ÏûÏ¢´¦Àí³ÌÐò BOOL CMyFormInputShow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { // TODO: ÔÚ´ËÌí¼ÓרÓôúÂëºÍ/»òµ÷ÓûùÀà return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFormView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: ÔÚ´ËÌí¼ÓÄúרÓõĴ´½¨´úÂë return 0; } void CMyFormInputShow::OnDestroy() { CFormView::OnDestroy(); // TODO: ÔÚ´Ë´¦Ìí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂë } void CMyFormInputShow::OnSize(UINT nType, int cx, int cy) { CFormView::OnSize(nType, cx, cy); // TODO: ÔÚ´Ë´¦Ìí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂë CWnd * pwnd; /* pwnd=GetDlgItem(IDC_EDIT_LOG); if (pwnd!=NULL) { // RECT rect1; pwnd->SetWindowPos(NULL,0,0,cx,cy-20,NULL); } //*/ /* pwnd = GetDlgItem(IDC_RICHEDIT2_LOG); if (pwnd != NULL) { // RECT rect1; pwnd->SetWindowPos(NULL, 0, 0, cx, cy - 20, NULL); } pwnd=GetDlgItem(IDC_CHECK_PAUSE); if (pwnd!=NULL) { //RECT rect1; CRect rect1; pwnd->GetWindowRect(rect1); ScreenToClient(&rect1); pwnd->SetWindowPos(NULL,0, cy - rect1.Height()-4,rect1.Width(),rect1.Height(),NULL); } pwnd=GetDlgItem(IDC_CHECK_NOSCROLL); if (pwnd!=NULL) { CRect rect1; pwnd->GetWindowRect(rect1); ScreenToClient(&rect1); pwnd->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL); } //*/ } void CMyFormInputShow::OnInitialUpdate() { CFormView::OnInitialUpdate(); /* CString VersionStr = _T("V1.02"); CString BuildStr = _T("20210728"); // TODO: ÔÚ´ËÌí¼ÓרÓôúÂëºÍ/»òµ÷ÓûùÀà myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm1"), _T("MTerm1")); myLogger1.AttachWnd(m_richedit_log.m_hWnd); myLogger1.bShowLog[0] = 1; myLogger1.bShowThreadId = 0; myLogger1.bShowChannel = 0; myLogger1.bSaveLog[0] = 1; myLogger1.bShowDate = 1; SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n")); myLogger1.bShowDate = 0; // myLogger1.bShowLineCount=0; // myLogger1.bShowTime=0; myLogger1.UpdateLogDisplay(); SetTimer(1, 100, NULL); */ CString(s1); s1.Format(_T(" MyDlgBarFuncKey Onupdate ")); SysLog(s1); // LRESULT bRet = HandleInitDialog(wParam, lParam); // if (!UpdateData(FALSE)) // { // TRACE("InitDialogBar Failed£¡"); // } CRect rect0; GetClientRect(&rect0); int nWidth = rect0.Width(); int nHeight = rect0.Height(); nWidth = 720; // rect0.Width(); nHeight = 60; int nTopMargin = 32; s1.Format(_T("Width %d Height %d "), nWidth, nHeight); SysLog(s1); int nLeftMargin = 48; int nSpace = nWidth - nLeftMargin; int x1, y1, x2, y2; CRect rect1(0, 20, 300, 40); for (int i = 0; i < myNumButtonCount; i++) { x1 = nLeftMargin * 3 + i * (nSpace - nLeftMargin * 2) / 24; y1 = 2; x2 = x1 + (nSpace - nLeftMargin * 2) / 24 -2; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_NumButtons[i].Create(myNumButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myNumButtons[i].nID); m_NumButtons[i].ShowWindow(SW_SHOW); } for (int i = 0; i < myCmdButtonCount; i++) { x1 = nLeftMargin * 3 + (i +16) * (nSpace - nLeftMargin * 2) / 20; y1 = 2; x2 = x1 + nSpace / 24; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_CmdButtons[i].Create(myCmdButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myCmdButtons[i].nID); m_CmdButtons[i].ShowWindow(SW_SHOW); } // font1.CreatePointFont(95, _T("¿¬Ìå")); for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = nTopMargin + i * nHeight / 3; x2 = x1 + nSpace / 11; y2 = y1 + nHeight / 3; rect1.SetRect(x1, y1, x2, y2); m_buttons[0][i][j].Create(myButtons[0][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[0][i][j].nID); m_buttons[0][i][j].ShowWindow(SW_SHOW); // init; } } for (int i = 0; i < m_Lines; i++) { for (int j = 0; j < 11; j++) { x1 = nLeftMargin + j * nSpace / 11; y1 = nTopMargin + 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 = nTopMargin + 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 = nTopMargin + 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 = nTopMargin + 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 = nTopMargin + 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 ; } int CMyFormInputShow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message); } void CMyFormInputShow::OnTimer(UINT_PTR nIDEvent) { // TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ /* if (nIDEvent == 1) { KillTimer(1); SetTimer(2, 200, NULL); } else if (nIDEvent == 2) { myLogger1.UpdateLogDisplay(); } else { } */ CFormView::OnTimer(nIDEvent); } void CMyFormInputShow::OnBnClickedButton1() { CString s1; s1.Format(_T("Button1 Clicked")); SysLog(s1); } void CMyFormInputShow::SetBtnDisplayESC(int n) { for (int n = 1; n < 5; n++) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 11; j++) { m_buttons[n][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 CMyFormInputShow::SetBtnDisplay(int n) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 11; j++) { m_buttons[current_btn_window][i][j].ShowWindow(SW_HIDE); } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 11; j++) { m_buttons[n][i][j].ShowWindow(SW_SHOW); } } current_btn_window = n; } void CMyFormInputShow::stInit() { m_InputCell = { CMTerm1View::typeNO, false, false, false, false, false, false, false, false, false, false, false, false, 0x10, _T(""), 0, 0 }; } int CMyFormInputShow::display(tagInputCell stDisplayCell) { static CString strOp, strParam , strNum; static CString str; switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È©À©¼"); } else { strOp = _T("-| |-"); } break; case CMTerm1View::typeNC: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È/©À©¼"); } else { strOp = _T("-|/|-"); } break; case CMTerm1View::typeOUT: strOp = _T("-[ ]"); break; case CMTerm1View::typeSET: strOp = _T("-"); break; case CMTerm1View::typeRESET: strOp = _T("-"); break; case CMTerm1View::typeDF: strOp = _T("(DF)"); break; case CMTerm1View::typeDF_: strOp = _T("(DF/)"); break; case CMTerm1View::typeNOT: strOp = _T("-/-"); break; case CMTerm1View::typeTM: strOp = _T("-[TM]"); break; case CMTerm1View::typeCMP: break; default: break; } if (stDisplayCell.bnot) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È/©À©¼"); } else { strOp = _T("-|/|-"); } break; case CMTerm1View::typeOUT: strOp = _T("-/-"); break; case CMTerm1View::typeSET: strOp = _T("-/-"); break; case CMTerm1View::typeRESET: strOp = _T("-/-"); break; case CMTerm1View::typeDF: strOp = _T("(DF/)"); break; case CMTerm1View::typeDF_: strOp = _T("(DF)"); break; case CMTerm1View::typeNOT: strOp = _T("-/-"); break; case CMTerm1View::typeTM: strOp = _T("-/-"); break; default: break; } } if (stDisplayCell.bpp) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È¡ü©À©¼"); } else { strOp = _T("-|¡ü|-"); } break; case CMTerm1View::typeOUT: strOp = _T("-[¡ü]"); break; default: break; } } if (stDisplayCell.bpn) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È¡ý©À©¼"); } else { strOp = _T("-|¡ý|-"); } break; case CMTerm1View::typeOUT: strOp = _T("-[¡ý]"); break; default: break; } } if (stDisplayCell.bDouble) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È©À©¼D"); } else { strOp = _T("-| |-D"); } break; case CMTerm1View::typeOUT: strOp = _T("-| |-D"); break; case CMTerm1View::typeSET: strOp = _T("-| |-D"); break; case CMTerm1View::typeRESET: strOp = _T("-| |-D"); break; case CMTerm1View::typeDF: strOp = _T("-| |-D"); break; case CMTerm1View::typeDF_: strOp = _T("-| |-D"); break; case CMTerm1View::typeNOT: strOp = _T("-| |-D"); break; case CMTerm1View::typeTM: strOp = _T("-| |-D"); break; default: break; } } if (stDisplayCell.bDouble1) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È©À©¼"); } else { strOp = _T("-| |-"); } break; case CMTerm1View::typeOUT: strOp = _T("-| |-"); break; case CMTerm1View::typeSET: strOp = _T("-| |-"); break; case CMTerm1View::typeRESET: strOp = _T("-| |-"); break; case CMTerm1View::typeDF: strOp = _T("-| |-"); break; case CMTerm1View::typeDF_: strOp = _T("-| |-"); break; case CMTerm1View::typeNOT: strOp = _T("-| |-"); break; case CMTerm1View::typeTM: strOp = _T("-| |-"); break; default: break; } } if (stDisplayCell.bFloat) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È©À©¼F"); } else { strOp = _T("-| |-F"); } break; case CMTerm1View::typeOUT: strOp = _T("-| |-F"); break; case CMTerm1View::typeSET: strOp = _T("-| |-F"); break; case CMTerm1View::typeRESET: strOp = _T("-| |-F"); break; case CMTerm1View::typeDF: strOp = _T("-| |-F"); break; case CMTerm1View::typeDF_: strOp = _T("-| |-F"); break; case CMTerm1View::typeNOT: strOp = _T("-| |-F"); break; case CMTerm1View::typeTM: strOp = _T("-| |-F"); break; default: break; } } if (stDisplayCell.bFloat1) { switch (stDisplayCell.OP) { case CMTerm1View::typeNO: if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp)) { strOp = _T("©¸©È©À©¼"); } else { strOp = _T("-| |-"); } case CMTerm1View::typeOUT: strOp = _T("-| |-"); break; case CMTerm1View::typeSET: strOp = _T("-| |-"); break; case CMTerm1View::typeRESET: strOp = _T("-| |-"); break; case CMTerm1View::typeDF: strOp = _T("-| |-"); break; case CMTerm1View::typeDF_: strOp = _T("-| |-"); break; case CMTerm1View::typeNOT: strOp = _T("-| |-"); break; case CMTerm1View::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 KLCoilTypeP: strParam = _T("P"); break; case KLCoilTypeT: strParam = _T("T"); break; case KLCoilTypeC: strParam = _T("C"); break; case KLCoilTypeE: strParam = _T("E"); 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 ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt)) { strParam = "="; } if ((!m_InputCell.bcmpEq) && (m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt)) { strParam = "<"; } if ((!m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (m_InputCell.bcmpGt)) { strParam = ">"; } if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpLt)) { strParam = "<="; } if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpGt)) { strParam = ">="; } if ((m_InputCell.bcmpLt) && (m_InputCell.bcmpGt)) { strParam = "<>"; } if (strParam.Trim() == _T("")) { strParam = m_InputCell.sParamName.Trim();; } strNum = stDisplayCell.num; str = strOp + _T(" ") + strParam + " " + strNum; //ÉèÖÃÊäÈë¿òÖеÄÎı¾ SetDlgItemText(IDC_EDIT_INPUT, str); return 0; } //ÉèÖÃÊäÈë¿òÊôÐÔ int CMyFormInputShow::SetCurCellPos(int nRow, int nCol, CMTerm1View::stCell theCell) { m_InputCell.clear(); m_InputCell.row = nRow; m_InputCell.col = nCol; int nType = theCell.nType; switch (nType) { case CMTerm1View::typeNone: m_InputCell.OP = CMTerm1View::typeNO; break; case CMTerm1View::typeLine1: m_InputCell.OP = nType; break; case CMTerm1View::typeLine2: m_InputCell.OP = nType; break; case CMTerm1View::typeNO: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeNC: m_InputCell.OP = nType; break; case CMTerm1View::typePP: m_InputCell.OP = nType; break; case CMTerm1View::typePN: m_InputCell.OP = nType; break; case CMTerm1View::typeNOT: m_InputCell.OP = nType; break; case CMTerm1View::typeDF: m_InputCell.OP = nType; break; case CMTerm1View::typeDF_: m_InputCell.OP = nType; break; case CMTerm1View::typeOUT: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeSET: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeRESET: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeCMP: m_InputCell.OP = nType; break; case CMTerm1View::typeExt1: m_InputCell.sCellName = theCell.sParam; m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); m_InputCell.OP = nType; break; case CMTerm1View::typeExt2: break; case CMTerm1View::typeExt3: break; case CMTerm1View::typeTM: m_InputCell.OP = CMTerm1View::typeTM; break; case CMTerm1View::typeFN1: m_InputCell.OP = CMTerm1View::typeFN1; break; case CMTerm1View::typeFN2: m_InputCell.OP = CMTerm1View::typeFN2; break; case CMTerm1View::typeFN3: m_InputCell.OP = CMTerm1View::typeFN3; break; case CMTerm1View::typeCoil: break; default: break; } display(m_InputCell); return 0; } void CMyFormInputShow::OnBtnRet() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë CString strName; CMTerm1View::stCell cell1; CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); CView* p2 = (CView*)pChild->GetActiveView(); if (p2 == NULL) return; CMTerm1View* p3 = (CMTerm1View*)p2; // m_wndDlgBar_InputShow.SetDisplay(0x00140000); showPage = 0; SetBtnDisplay(showPage); switch (m_InputCell.OP) { case CMTerm1View::typeNO: case CMTerm1View::typeNC: case CMTerm1View::typeOUT: case CMTerm1View::typeSET: case CMTerm1View::typeRESET: case CMTerm1View::typeTM: switch (m_InputCell.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 + m_InputCell.num; cell1.nType = m_InputCell.OP; cell1.nProgStep = 0; cell1.bEditing = 1; cell1.sParam = strName + m_InputCell.num;; cell1.bLeftLineUp = 0; cell1.nDataType = CMTerm1View::typeCoil; cell1.nDataAddr = _tstoi(m_InputCell.num); cell1.bModified = 1; p3->SetCellToView(cell1); // m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } /// /// ²åÈë°´Å¥µã»÷ʼþ /// void CMyFormInputShow::OnBtnInsert() { if (m_InputCell.OP == NULL) { DbgLog(_T("Error£º²åÈëʧ°Ü£¬Î´Ñ¡ÔñÒª²åÈëµÄ²Ù×÷")); return; } if (m_InputCell.param == -1) { DbgLog(_T("Error£º²åÈëʧ°Ü£¬Î´ÉèÖÃÐòºÅ")); return; } if (m_InputCell.num == (_T(""))) { DbgLog(_T("Error£º²åÈëʧ°Ü£¬Î´ÉèÖñàºÅ")); return; } CString s1; CString strName; CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); CView* p2 = (CView*)pChild->GetActiveView(); if (p2 == NULL) return; CMTerm1View* p3 = (CMTerm1View*)p2; //ÐÂÊôÐÔÆ¥ÅäÇ°£¬¼ì²éÔ­µ¥Ôª¸ñÊÇ·ñÊÇÊúÏ߸ñ if (focusCell.nType == CMTerm1View::typeLine2) { focusCell.bLeftLineUp = 1; flag = 1; } else { flag = 0; } switch (m_InputCell.OP) { case CMTerm1View::typeNO: case CMTerm1View::typeNC: case CMTerm1View::typeOUT: case CMTerm1View::typeSET: case CMTerm1View::typeRESET: case CMTerm1View::typeTM: switch (m_InputCell.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; } focusCell.sCoilName = strName + m_InputCell.num; focusCell.nType = m_InputCell.OP; focusCell.nProgStep = 0; focusCell.bEditing = 1; focusCell.sParam = strName + m_InputCell.num;; focusCell.nDataType = CMTerm1View::typeCoil; focusCell.nDataAddr = _tstoi(m_InputCell.num); focusCell.bModified = 1; p3->SetCellToView(focusCell, flag); //²åÈëÍê³Éºó£¬ÉèÖð´Å¥·µ»ØµÚÒ»Ò³ showPage = 0; SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); } /// /// ɾ³ý°´Å¥µã»÷ʼþ /// void CMyFormInputShow::OnBtnDelete() { CString s1; CString strName; CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); CView* p2 = (CView*)pChild->GetActiveView(); if (p2 == NULL) return; CMTerm1View* p3 = (CMTerm1View*)p2; focusCell.clear(); // p3->SetCellToView(focusCell); //²åÈëÍê³Éºó£¬ÉèÖð´Å¥·µ»ØµÚÒ»Ò³ showPage = 0; SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); } void CMyFormInputShow::OnBtnEsc() { SetBtnDisplayESC(0); } int CMyFormInputShow::SetDisplay(int inputInfo) { /*stInputCell.OP = CMTerm1View::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 { m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; m_InputCell.bcmpGt = false; m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.bLeftLineUp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x07: m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x08: m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break; case 0x0b: m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: m_InputCell.bpp = true; m_InputCell.bpn = false; lastLParam = LParam; break; case 0x11: m_InputCell.bpp = false; m_InputCell.bpn = true; lastLParam = LParam; break; case 0x12: m_InputCell.bpp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: m_InputCell.OP = CMTerm1View::typeNC; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNC; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; m_InputCell.bnot = true; break; case 0x14: m_InputCell.bnot = false; break; case 0x15: m_InputCell.bDouble = true; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x17: m_InputCell.bDouble = false; m_InputCell.bDouble1 = true; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x16: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = true; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x18: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = true; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; default: break; } } str = strOp; break; case 'B': str = strOp; if (HParam == 0x1) //operator 1 { m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; m_InputCell.bcmpGt = false; m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.bLeftLineUp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x07: m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x08: m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x9: m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break; case 0x0b: m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: m_InputCell.bpp = true; m_InputCell.bpn = false; lastLParam = LParam; break; case 0x11: m_InputCell.bpp = false; m_InputCell.bpn = true; lastLParam = LParam; break; case 0x12: m_InputCell.bpp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: m_InputCell.OP = CMTerm1View::typeNC; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNC; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; m_InputCell.bnot = true; break; case 0x14: m_InputCell.bnot = false; break; case 0x15: m_InputCell.bDouble = true; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x17: m_InputCell.bDouble = false; m_InputCell.bDouble1 = true; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x16: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = true; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x18: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = true; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; m_InputCell.sParamName = _T("X"); break; case 2: m_InputCell.param = KLCoilTypeY; m_InputCell.sParamName = _T("Y"); curTaskState = 'C'; break; case 3: m_InputCell.param = KLCoilTypeR; m_InputCell.sParamName = _T("R"); curTaskState = 'C'; break; case 4: m_InputCell.param = KLCoilTypeLR; m_InputCell.sParamName = _T("L"); curTaskState = 'C'; break; case 5: m_InputCell.param = KLCoilTypeP; m_InputCell.sParamName = _T("P"); curTaskState = 'C'; break; case 6: m_InputCell.param = KLCoilTypeT; m_InputCell.sParamName = _T("T"); curTaskState = 'C'; break; case 7: m_InputCell.param = KLCoilTypeC; m_InputCell.sParamName = _T("C"); curTaskState = 'C'; break; case 8: m_InputCell.param = KLCoilTypeE; m_InputCell.sParamName = _T("E"); curTaskState = 'C'; break; case 9: m_InputCell.param = OP_TMX; curTaskState = 'C'; break; case 0x0a: m_InputCell.param = OP_TMY; curTaskState = 'C'; break; case 0x0b: m_InputCell.param = OP_TMR; curTaskState = 'C'; break; case 0x0c: m_InputCell.param = OP_TML; curTaskState = 'C'; break; case 0x0d: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; m_InputCell.bcmpEq = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; m_InputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; // define op para; for translate to -/- m_InputCell.bcmpLt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpGt = false; } lastCMP = LParam; //record key num = > < curTaskState = 'B'; break; default: break; } } break; case 'C': // str = strOp + _T(" ") + strParam; if (HParam == 0x01) //operator 1 { m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; m_InputCell.bcmpGt = false; m_InputCell.bDouble = false; m_InputCell.bFloat1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.bLeftLineUp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x07: m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x08: m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break; case 0x0b: m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: m_InputCell.bpp = true; m_InputCell.bpn = false; break; case 0x11: m_InputCell.bpp = false; m_InputCell.bpn = true; break; case 0x12: m_InputCell.bpp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: m_InputCell.OP = CMTerm1View::typeNC; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNC; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; m_InputCell.bnot = true; break; case 0x14: m_InputCell.bnot = false; break; case 0x15: m_InputCell.bDouble = true; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x17: m_InputCell.bDouble = false; m_InputCell.bDouble1 = true; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x16: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = true; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x18: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = true; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; default: break; } } else if (HParam == 0x2) { switch (LParam) { case 1: m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break; case 2: m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break; case 3: m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break; case 4: m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break; case 5: m_InputCell.param = KLCoilTypeP; curTaskState = 'C'; break; case 6: m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break; case 7: m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break; case 8: m_InputCell.param = KLCoilTypeE; curTaskState = 'C'; break; case 9: m_InputCell.param = OP_TMX; curTaskState = 'C'; break; case 0x0a: m_InputCell.param = OP_TMY; curTaskState = 'C'; break; case 0x0b: m_InputCell.param = OP_TMR; curTaskState = 'C'; break; case 0x0c: m_InputCell.param = OP_TML; curTaskState = 'C'; break; case 0x0d: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; m_InputCell.bcmpEq = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; m_InputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP = 1; clickCounterCMP++; } else { m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; m_InputCell.bcmpLt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.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 ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; //state not change else { strNumTemp = _T("A"); curTaskState = 'D'; } break; case 0x0B: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("B"); curTaskState = 'D'; } break; case 0x0C: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("C"); curTaskState = 'D'; } break; case 0x0D: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("D"); curTaskState = 'D'; } break; case 0x0E: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("E"); curTaskState = 'D'; } break; case 0x0F: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("F"); curTaskState = 'D'; } break; default: break; } if (m_InputCell.num.GetLength() < 4) { m_InputCell.num.Append(strNumTemp); } else { m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1); m_InputCell.num.Append(strNumTemp); } } break; case 'D': if (HParam == 0x1) //operator 1 { m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; m_InputCell.bcmpGt = false; m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.bLeftLineUp = false; m_InputCell.brightLineUp = false; if ((LParam >= 0x01) && (LParam <= 0x0f)) { m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; //0x10 define para null lastLParam = LParam; curTaskState = 'B'; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; lastLParam = LParam; curTaskState = 'B'; break; case 0x03: m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x07: m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break; case 0x08: m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x09: m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'A'; break; case 0x0a: strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break; case 0x0b: m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x10: m_InputCell.bpp = true; m_InputCell.bpn = false; break; case 0x11: m_InputCell.bpp = false; m_InputCell.bpn = true; break; case 0x12: m_InputCell.bpp = false; m_InputCell.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: m_InputCell.OP = CMTerm1View::typeNOT; clickCounterNot = 0; curTaskState = 'A'; default: break; } switch (lastLParam) { case 0x01: m_InputCell.OP = CMTerm1View::typeNC; break; case 0x02: m_InputCell.OP = CMTerm1View::typeNC; m_InputCell.bLeftLineUp = true; m_InputCell.brightLineUp = true; break; default: break; } lastLParam = LParam; m_InputCell.bnot = true; break; case 0x14: m_InputCell.bnot = false; break; case 0x15: m_InputCell.bDouble = true; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x17: m_InputCell.bDouble = false; m_InputCell.bDouble1 = true; m_InputCell.bFloat = false; m_InputCell.bFloat1 = false; m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B'; break; case 0x16: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = true; m_InputCell.bFloat1 = false; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; case 0x18: m_InputCell.bDouble = false; m_InputCell.bDouble1 = false; m_InputCell.bFloat = false; m_InputCell.bFloat1 = true; lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B'; break; default: break; } if (curTaskState != 'D') { m_InputCell.num.Empty(); } } else if (HParam == 0x2) { switch (LParam) { case 1: m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break; case 2: m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break; case 3: m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break; case 4: m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break; case 5: strParam = _T(" P"); curTaskState = 'C'; break; case 6: m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break; case 7: m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break; case 8: strParam = _T(" E"); curTaskState = 'C'; break; case 9: m_InputCell.param = OP_TMX; curTaskState = 'C'; break; case 0x0a: m_InputCell.param = OP_TMY; curTaskState = 'C'; break; case 0x0b: m_InputCell.param = OP_TMR; curTaskState = 'C'; break; case 0x0c: m_InputCell.param = OP_TML; curTaskState = 'C'; break; case 0x0d: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x20; m_InputCell.bcmpEq = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpGt = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0e: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x21; m_InputCell.bcmpGt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpLt = false; } lastCMP = LParam; curTaskState = 'B'; break; case 0x0f: if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09)) { m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.bnot = false; m_InputCell.bpp = false; m_InputCell.bpn = false; clickCounter = 0; clickCounterNot = 0; clickCounterDF = 0; clickCounterD = 0; clickCounterF = 0; } lastLParam = 0x22; m_InputCell.bcmpLt = true; if (lastCMP != LParam) { clickCounterCMP++; } else { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpGt = false; } if (clickCounterCMP > 2) { clickCounterCMP = 1; m_InputCell.bcmpEq = false; m_InputCell.bcmpGt = false; } lastCMP = LParam; curTaskState = 'B'; break; default: break; } if (curTaskState != 'D') { m_InputCell.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 ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; //state not change else { strNumTemp = _T("A"); curTaskState = 'D'; } break; case 0x0B: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("B"); curTaskState = 'D'; } break; case 0x0C: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("C"); curTaskState = 'D'; } break; case 0x0D: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("D"); curTaskState = 'D'; } break; case 0x0E: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("E"); curTaskState = 'D'; } break; case 0x0F: if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC)) ; else { strNumTemp = _T("F"); curTaskState = 'D'; } break; default: break; } if (m_InputCell.num.GetLength() < 4) { m_InputCell.num.Append(strNumTemp); } else { m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1); m_InputCell.num.Append(strNumTemp); for (int i = 0; i < m_InputCell.num.GetLength(); i++) { if (m_InputCell.num[i] == _T('0')) { ; } else { flag = 1; break; } } if (flag == 0) { m_InputCell.num.Empty(); m_InputCell.num.Append(_T("0")); } } int num = m_InputCell.num.GetLength(); for (int i = 0; i < num; i++) { int len1 = m_InputCell.num.GetLength(); if (len1 > 1 && m_InputCell.num[0] == _T('0')) m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1); } } break; } //end switch if (HParam == 0x14) { bool editEndFlag = false; //******************************************************************************************************** switch (m_InputCell.OP) { case CMTerm1View::typeNO: case CMTerm1View::typeNC: case CMTerm1View::typeOUT: case CMTerm1View::typeSET: case CMTerm1View::typeRESET: case CMTerm1View::typeTM: if (curTaskState == 'D') { editEndFlag = true; } case CMTerm1View::typeDF: case CMTerm1View::typeDF_: if (curTaskState == 'A') { editEndFlag = true; } default: break; } if ((m_InputCell.bcmpEq) || (m_InputCell.bcmpGt) || (m_InputCell.bcmpLt)) { editEndFlag = true; } if (editEndFlag) { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputCell(m_InputCell); } else { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CString str = _T("ÎÞ·¨È·¶¨Ö¸ÁîÊäÈë"); //p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0)); p1->m_wndStatusBar.SetPaneText(0, str); } } display(m_InputCell); return 0; } int CMyFormInputShow::SetDisplay1(int inputInfo) { return 0; } void CMyFormInputShow::OnBnClickedBtnAnd() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF1£¬ÊÇÏßȦ SetDisplay(0x00010001); showPage = 1; SetBtnDisplay(showPage); break; case 1: //1Ò³µÄF1£¬ÊÇX OnBnClickedBtnX(); break; default: break; } } void CMyFormInputShow::OnBnClickedBtnOr() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF1£¬ÊÇÏßȦ SetDisplay(0x00010002); showPage = 1; SetBtnDisplay(showPage); break; case 1: //1Ò³µÄF1£¬ÊÇY OnBnClickedBtnY(); break; default: break; } } /// /// »­ÊúÏß /// /// /// 1.Ô­±¾ÎÞ×ÝÏߣ¬ÔÚ½¹µã¸ñ¼ÓÈë×óÉÏÏߣ¬Í¬ÁÐÉÏÐмÓÈë×óÏÂÏß /// 2.Ô­±¾ÓÐ×ÝÏߣ¬ÔÚÁ½¸öλÖÃÈ¡ÏûÏß»æÖÆ /// 3.µÚ0ÐнûÖ¹²åÈë×ÝÏß /// 4.½¹µãÔÚµ¥Ôª¸ñ²ÎÊýλÖýûÖ¹Ìí¼Ó /// void CMyFormInputShow::OnBnClickedBtnVline() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF3£¬ÊÇÊúÏß { CString s1; //ÏÈÅжÏÇé¿ö3 if (m_InputCell.row == 0) { //·¢ËÍ´íÎóÐÅÏ¢ DbgLog(_T("²åÈë×ÝÏßʧ°Ü£º¹â±êλÖôíÎ󣡵ÚÒ»ÐнûÖ¹²åÈëÊúÏß")); return; } //Çé¿ö4 if (focusCell.nType == CMTerm1View::typeExt1) { //·¢ËÍ´íÎóÐÅÏ¢ DbgLog(_T("²åÈë×ÝÏßʧ°Ü£º¹â±êλÖôíÎ󣡲ÎÊýλÖò»ÔÊÐíÌí¼Ó×ÝÏß")); return; } //Ô­±¾ÊÇ×ÝÏ߸ñ if (focusCell.nType == CMTerm1View::typeLine2) { flag = 2;//ͬ²½É¾³ý focusCell.bLeftLineUp = 0;//ÉèÖÃ×óÉÏÏßΪ0 focusCell.nType = CMTerm1View::typeNone;//ÉèÖÃΪ¿Õµ¥Ôª¸ñ } //Ô­±¾²»ÊÇ×ÝÏ߸ñ else { //²»ÊÇ¿Õ¸ñ£¬ÅжÏÓÐÎÞ×óÉÏ×ÝÏß if (focusCell.bLeftLineUp == 1) { focusCell.bLeftLineUp = 0;//ÉèÖÃ×óÉÏÏßΪ0 flag = 2; } else { focusCell.bLeftLineUp = 1;//ÉèÖÃ×óÉÏÏßΪ0 flag = 1; } } CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); CView* p2 = (CView*)pChild->GetActiveView(); if (p2 == NULL) { return; } CMTerm1View* p3 = (CMTerm1View*)p2; //ÉèÖûØÏÔ p3->SetCellToView(focusCell, flag); //²åÈëÍê³Éºó£¬ÉèÖð´Å¥·µ»ØµÚÒ»Ò³ showPage = 0; SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); }break; case 1: //1Ò³µÄF3£¬ÊÇR OnBnClickedBtnR(); break; default: break; } } void CMyFormInputShow::OnBnClickedBtnOut() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF4£¬ÊÇout { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010003); SetDisplay(0x00010003); showPage = 1; SetBtnDisplay(showPage); }break; case 1: //1Ò³µÄF4£¬ÊÇL OnBnClickedBtnL(); break; default: break; } } void CMyFormInputShow::OnBnClickedBtnTmCt() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF5£¬ÊÇtm/ct { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0001000b); SetDisplay(0x0001000b); showPage = 5; SetBtnDisplay(showPage); }break; case 1: //1Ò³µÄF5£¬ÊÇP OnBnClickedBtnP(); break; default: break; } } void CMyFormInputShow::OnBnClickedBtnFun() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF6£¬ÊÇFunc { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Fun ")); }break; case 1: //1Ò³µÄF6£¬ÊÇ±È½Ï OnBnClickedBtnCompare(); break; default: break; } } /// /// »­ºáÏß /// void CMyFormInputShow::OnBnClickedBtnHLine() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF1£¬ÊǺáÏß { CString s1; CString strName; CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); CView* p2 = (CView*)pChild->GetActiveView(); if (p2 == NULL) return; CMTerm1View* p3 = (CMTerm1View*)p2; focusCell.nType = 1; // p3->SetCellToView(focusCell); //²åÈëÍê³Éºó£¬ÉèÖð´Å¥·µ»ØµÚÒ»Ò³ showPage = 0; SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); }break; case 1: //1Ò³µÄF7£¬ÎÞ²Ù×÷ break; default: break; } } void CMyFormInputShow::OnBnClickedBtnNot() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF8£¬ÊÇnot { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010013); SetDisplay(0x00010013); showPage = 1; SetBtnDisplay(showPage); }break; case 1: //1Ò³µÄF8£¬ÊÇnot { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010013); SetDisplay(0x00010013); showPage = 1; SetBtnDisplay(showPage); }break; default: break; } } void CMyFormInputShow::OnBnClickedBtnIndex() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF9£¬ÊÇIndex { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Index ")); showPage = 4; SetBtnDisplay(showPage); }break; case 1: //1Ò³µÄF9£¬ÊÇIndex { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Index ")); showPage = 4; SetBtnDisplay(showPage); }break; default: break; } } void CMyFormInputShow::OnBnClickedBtnMc() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF11£¬ÊÇMC { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010004); SetDisplay(0x00010004); }break; case 1: //1Ò³µÄF11£¬ÊÇNo.Çå³ý£¨33409£¬»¹Ã»¶¨Ò壡 break; default: break; } } void CMyFormInputShow::OnBnClickedBtnMce() { //Åжϰ´Å¥ÔÚµÚ¼¸Ò³£¬´¥·¢²»Í¬µÄ²Ù×÷ switch (showPage) { case 0: //0Ò³µÄF12£¬ÊÇMCE { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010005); SetDisplay(0x00010005); }break; case 1: //1Ò³µÄF12£¬ÎÞ²Ù×÷ break; default: break; } } void CMyFormInputShow::OnBnClickedBtnSet() { switch (showPage) { case 0: { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010006); SetDisplay(0x00010006); showPage = 1; SetBtnDisplay(showPage); } break; case 1: { OnBnClickedBtnT(); } break; default: break; } } void CMyFormInputShow::OnBnClickedBtnReset() { switch (showPage) { case 0: { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010007); SetDisplay(0x00010007); showPage = 1; SetBtnDisplay(showPage); } break; case 1: { OnBnClickedBtnC(); } break; default: break; } } void CMyFormInputShow::OnBnClickedBtnDf() { switch (showPage) { case 0: { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010008); SetDisplay(0x00010008); //p1->GetInputInfo(_T("(DF)")); } break; case 1: { OnBnClickedBtnE(); } break; default: break; } } void CMyFormInputShow::OnBnClickedBtnEnd() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0001000A); SetDisplay(0x0001000A); } void CMyFormInputShow::OnBnClickedBtnCompare() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Compare")); showPage = 2; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnPFun() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("PFun")); } void CMyFormInputShow::OnBnClickedBtnUpDown() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010010); SetDisplay(0x00010010); showPage = 1; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnBit() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Bit")); showPage = 1; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnWord() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Word")); showPage = 3; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnInc1() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Inc1")); } void CMyFormInputShow::OnBnClickedBtnInc2() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Inc2")); } void CMyFormInputShow::OnBnClickedBtnPgConvert() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("PgConvert")); } void CMyFormInputShow::OnBnClickedBtnOnline() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Online")); } void CMyFormInputShow::OnBnClickedBtnOffline() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Offline")); } void CMyFormInputShow::OnBnClickedBtnClose() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Close")); } void CMyFormInputShow::OnBnClickedBtnFind() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Find")); } void CMyFormInputShow::OnBnClickedBtnNextWin() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("NextWin")); } void CMyFormInputShow::OnBnClickedBtnMonitor() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Monitor")); } void CMyFormInputShow::OnBnClickedBtnStatus() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Status")); } void CMyFormInputShow::OnBnClickedBtnRunProg() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("RunProg")); } void CMyFormInputShow::OnBnClickedBtnPlcRead() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("PlcRead")); } void CMyFormInputShow::OnBnClickedBtnPlcWrite() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("PlcWrite")); } void CMyFormInputShow::OnBnClickedBtnX() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020001); SetDisplay(0x00020001); } void CMyFormInputShow::OnBnClickedBtnY() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020002); SetDisplay(0x00020002); } void CMyFormInputShow::OnBnClickedBtnR() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020003); SetDisplay(0x00020003); } void CMyFormInputShow::OnBnClickedBtnL() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020004); SetDisplay(0x00020004); } void CMyFormInputShow::OnBnClickedBtnP() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020005); SetDisplay(0x00020005); } void CMyFormInputShow::OnBnClickedBtnCompare1() { showPage = 2; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnT() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020006); SetDisplay(0x00020006); } void CMyFormInputShow::OnBnClickedBtnC() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020007); SetDisplay(0x00020007); } void CMyFormInputShow::OnBnClickedBtnE() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020008); SetDisplay(0x00020008); } void CMyFormInputShow::OnBnClickedBtnTmx() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020009); SetDisplay(0x00020009); showPage = 0; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmy() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000A); SetDisplay(0x0002000A); showPage = 1; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmr() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000B); SetDisplay(0x0002000B); showPage = 0; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTml() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000C); SetDisplay(0x0002000C); showPage = 0; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnCt() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000D); SetDisplay(0x0002000D); showPage = 0; SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnD() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010015); SetDisplay(0x00010015); } void CMyFormInputShow::OnBnClickedBtnF() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00010016); SetDisplay(0x00010016); } void CMyFormInputShow::OnBnClickedBtnNEQ() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000D); SetDisplay(0x0002000D); } void CMyFormInputShow::OnBnClickedBtnGT() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000E); SetDisplay(0x0002000E); } void CMyFormInputShow::OnBnClickedBtnLT() { CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0002000F); SetDisplay(0x0002000F); } void CMyFormInputShow::OnBtn0() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030000); } void CMyFormInputShow::OnBtn1() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030001); } void CMyFormInputShow::OnBtn2() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030002); } void CMyFormInputShow::OnBtn3() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030003); } void CMyFormInputShow::OnBtn4() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030004); } void CMyFormInputShow::OnBtn5() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030005); } void CMyFormInputShow::OnBtn6() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030006); } void CMyFormInputShow::OnBtn7() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030007); } void CMyFormInputShow::OnBtn8() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030008); } void CMyFormInputShow::OnBtn9() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x00030009); } void CMyFormInputShow::OnBtnA() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000A); } void CMyFormInputShow::OnBtnB() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000B); } void CMyFormInputShow::OnBtnC() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000C); } void CMyFormInputShow::OnBtnD() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000D); } void CMyFormInputShow::OnBtnE() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000E); } void CMyFormInputShow::OnBtnF() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë SetDisplay(0x0003000F); } void CMyFormInputShow::OnBtnMinus() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë //m_wndDlgBar_InputShow.SetDisplay(_T("-")); } void CMyFormInputShow::OnBtnDot() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë //m_wndDlgBar_InputShow.SetDisplay(_T(".")); } void CMyFormInputShow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ if (nChar == 13) { OnBtnRet(); } CFormView::OnChar(nChar, nRepCnt, nFlags); } void CMyFormInputShow::OnKeyX() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020001); SetDisplay(0x00020001); }