From 6fa60de2b0d0237054aa7571191df0f291838031 Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期五, 20 十月 2023 22:27:53 +0800 Subject: [PATCH] fix conflict --- MTerm1/MyFormInputShow.cpp | 740 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 560 insertions(+), 180 deletions(-) diff --git a/MTerm1/MyFormInputShow.cpp b/MTerm1/MyFormInputShow.cpp index a604166..c01fc15 100644 --- a/MTerm1/MyFormInputShow.cpp +++ b/MTerm1/MyFormInputShow.cpp @@ -5,36 +5,38 @@ #include "MTerm1.h" #include "MyFormInputShow.h" - #include "MainFrm.h" +static int flag = 0; +static int showPage = 0; // CMyFormLog structButton myButtons[6][3][11] = { - {{33101,_T("-| |-"), 33102,_T("└┤├┘") ,33103,_T("|"), 33104,_T("-[OUT]") ,33105,_T("TM/CT") ,33106,_T("Fun") ,33107,_T("——") ,33108,_T("NOT/") ,33109,_T("INDEX") ,33110,_T("(MC)") ,33111,_T("(MCE)") }, - {33201,_T("-<SET>-"), 33202,_T("-<RESET>") ,33203,_T("(DF(/))"), 33204,_T("(END)") ,33205,_T("比较") ,33206,_T("PFun") ,33207,_T("↑↓") ,33208,_T("[位]") ,33209,_T("[字]") ,33210,_T("指令1") ,33211,_T("指令2") }, - {33301,_T("PG转换"), 33302,_T("在线") ,33303,_T("离线"), 33304,_T("关闭") ,33305,_T("查找") ,33306,_T("次Win") ,33307,_T("监控Go") ,33308,_T("状态") ,33309,_T("Run/Prog") ,33310,_T("PLC读取") ,33311,_T("PLC写入") } }, + {{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("-<SET>-"), IDC_BUTTON_RESET,_T("-<RESET>") ,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写入") } }, - {{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("") }, + {{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("") }}, - {{33701,_T("D"), 33702,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,33706,_T("=") ,33707,_T(">") ,33708,_T("<") ,33709,_T("") ,33710,_T("") ,33711,_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("") }}, - {{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("") }}, + {{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("") }}, - {{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("") }, + {{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("") }}, - {{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("") }, + {{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); @@ -77,7 +79,7 @@ ON_WM_DESTROY() ON_WM_SIZE() ON_WM_MOUSEACTIVATE() - ON_WM_TIMER() + ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON1, &CMyFormInputShow::OnBnClickedButton1) @@ -166,8 +168,8 @@ ON_WM_CHAR() + ON_COMMAND(ID_KEY_X, &CMyFormInputShow::OnKeyX) END_MESSAGE_MAP() - // CMyFormLog 诊断 @@ -185,9 +187,7 @@ #endif #endif //_DEBUG - // CMyFormLog 消息处理程序 - BOOL CMyFormInputShow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { @@ -195,7 +195,6 @@ return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } - int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -207,14 +206,12 @@ return 0; } - void CMyFormInputShow::OnDestroy() { CFormView::OnDestroy(); // TODO: 在此处添加消息处理程序代码 } - void CMyFormInputShow::OnSize(UINT nType, int cx, int cy) { @@ -257,7 +254,6 @@ //*/ } - void CMyFormInputShow::OnInitialUpdate() { @@ -398,15 +394,11 @@ } - int CMyFormInputShow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { - // TODO: 在此添加消息处理程序代码和/或调用默认值 - return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message); } - void CMyFormInputShow::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调用默认值 @@ -428,17 +420,12 @@ CFormView::OnTimer(nIDEvent); } - void CMyFormInputShow::OnBnClickedButton1() { - // TODO: 在此添加控件通知处理程序代码 CString s1; s1.Format(_T("Button1 Clicked")); SysLog(s1); } - - - void CMyFormInputShow::SetBtnDisplayESC(int n) { @@ -458,13 +445,17 @@ current_btn_window = 0; } +/// <summary> +/// 展示第几页的按钮 +/// </summary> +/// <param name="n"></param> void CMyFormInputShow::SetBtnDisplay(int n) { for (int i = 0; i < 3; i++) { - for (int j = 0; j < 11; j++) { + for (int j = 0; j < 11; j++) { m_buttons[current_btn_window][i][j].ShowWindow(SW_HIDE); - } + } } for (int i = 0; i < 3; i++) { @@ -474,7 +465,6 @@ } current_btn_window = n; } - void CMyFormInputShow::stInit() { @@ -494,14 +484,16 @@ false, false, 0x10, - _T("") + _T(""), + 0, + 0 }; } int CMyFormInputShow::display(tagInputCell stDisplayCell) { - static CString strOp, strParam, strNum; + static CString strOp, strParam , strNum; static CString str; switch (stDisplayCell.OP) { @@ -809,11 +801,17 @@ 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]")) @@ -840,6 +838,7 @@ break; } + if ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt)) { strParam = "="; @@ -864,22 +863,29 @@ { 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; @@ -890,7 +896,8 @@ case CMTerm1View::typeNO: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; - m_InputCell.param= theCell.nDataType; + + m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeNC: @@ -898,7 +905,6 @@ break; case CMTerm1View::typePP: m_InputCell.OP = nType; - break; case CMTerm1View::typePN: m_InputCell.OP = nType; @@ -915,19 +921,19 @@ case CMTerm1View::typeOUT: m_InputCell.OP = nType; m_InputCell.sCellName = theCell.sCoilName; - m_InputCell.param = theCell.nDataType; + 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.param = theCell.nDataType; + 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.param = theCell.nDataType; + m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); break; case CMTerm1View::typeCMP: @@ -935,7 +941,7 @@ break; case CMTerm1View::typeExt1: m_InputCell.sCellName = theCell.sParam; - m_InputCell.param = theCell.nDataType; + m_InputCell.sParamName = theCell.sParam.SpanExcluding(_T("0123456789ABCDEF-.")); m_InputCell.num.Format(_T("%d"), theCell.nDataAddr); m_InputCell.OP = nType; break; @@ -977,7 +983,8 @@ if (p2 == NULL) return; CMTerm1View* p3 = (CMTerm1View*)p2; // m_wndDlgBar_InputShow.SetDisplay(0x00140000); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); switch (m_InputCell.OP) { @@ -1022,46 +1029,152 @@ 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(); } + + +/// <summary> +/// 插入按钮点击事件 +/// </summary> void CMyFormInputShow::OnBtnInsert() { - // TODO: 在此添加命令处理程序代码 - SetDisplay(0x00240000); - // m_wndDlgBar_Func_Key.SetBtnDisplayESC(); -} -void CMyFormInputShow::OnBtnDelete() -{ - // TODO: 在此添加命令处理程序代码 - SetDisplay(0x00340000); - // m_wndDlgBar_Func_Key.SetBtnDisplayESC(); -} -void CMyFormInputShow::OnBtnEsc() -{ - // TODO: 在此添加命令处理程序代码 - //m_wndDlgBar_InputShow.SetDisplay(_T("Esc")); - SetBtnDisplayESC(0); - // m_wndDlgBar_Func_Key.SetBtnDisplayESC(); + 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); + } -static int flag = 0; +/// <summary> +/// 删除按钮点击事件 +/// </summary> +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; @@ -1712,21 +1825,24 @@ switch (LParam) { case 1: - m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeX; + curTaskState = 'C'; + m_InputCell.sParamName = _T("X"); + break; case 2: - m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeY; m_InputCell.sParamName = _T("Y"); curTaskState = 'C'; break; case 3: - m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeR; m_InputCell.sParamName = _T("R"); curTaskState = 'C'; break; case 4: - m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeLR; m_InputCell.sParamName = _T("L"); curTaskState = 'C'; break; case 5: - strParam = _T(" P"); curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeP; m_InputCell.sParamName = _T("P"); curTaskState = 'C'; break; case 6: - m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeT; m_InputCell.sParamName = _T("T"); curTaskState = 'C'; break; case 7: - m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeC; m_InputCell.sParamName = _T("C"); curTaskState = 'C'; break; case 8: - strParam = _T(" E"); curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeE; m_InputCell.sParamName = _T("E"); curTaskState = 'C'; break; case 9: m_InputCell.param = OP_TMX; curTaskState = 'C'; break; case 0x0a: @@ -2122,13 +2238,14 @@ case 4: m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break; case 5: - strParam = _T(" P"); curTaskState = 'C'; break; + 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: - strParam = _T(" E"); curTaskState = 'C'; break; + m_InputCell.param = KLCoilTypeE; curTaskState = 'C'; break; case 9: m_InputCell.param = OP_TMX; curTaskState = 'C'; break; case 0x0a: @@ -2905,135 +3022,404 @@ int CMyFormInputShow::SetDisplay1(int inputInfo) { - // TODO: 在此处添加实现代码. - return 0; } void CMyFormInputShow::OnBnClickedBtnAnd() { - - SetDisplay(0x00010001); - - SetBtnDisplay(1); + //判断按钮在第几页,触发不同的操作 + 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() { - - // CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - // p1->GetInputInfo(0x00010002); - - SetDisplay(0x00010002); - SetBtnDisplay(1); + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F1,是线圈 + SetDisplay(0x00010002); + showPage = 1; + SetBtnDisplay(showPage); + break; + case 1: + //1页的F1,是Y + OnBnClickedBtnY(); + break; + default: + break; + } } +/// <summary> +/// 画竖线 +/// </summary> +/// <remark> +/// 1.原本无纵线,在焦点格加入左上线,同列上行加入左下线 +/// 2.原本有纵线,在两个位置取消线绘制 +/// 3.第0行禁止插入纵线 +/// 4.焦点在单元格参数位置禁止添加 +/// </remark> void CMyFormInputShow::OnBnClickedBtnVline() { + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F3,是竖线 + { + CString s1; - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - //p1->GetInputInfo(_T("|")); + //先判断情况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() { - - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010003); - - SetDisplay(0x00010003); - SetBtnDisplay(1); + //判断按钮在第几页,触发不同的操作 + 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() { - - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x0001000b); - - SetDisplay(0x0001000b); - - SetBtnDisplay(5); + //判断按钮在第几页,触发不同的操作 + 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() { - - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - //p1->GetInputInfo(_T("Fun ")); + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F6,是Func + { + CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); + //p1->GetInputInfo(_T("Fun ")); + }break; + case 1: + //1页的F6,是比较 + OnBnClickedBtnCompare(); + break; + default: + break; + } } + +/// <summary> +/// 画横线 +/// </summary> void CMyFormInputShow::OnBnClickedBtnHLine() { + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F1,是横线 + { + CString s1; + CString strName; - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - //p1->GetInputInfo(_T("——")); + 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() /****************************************************************************/ + +void CMyFormInputShow::OnBnClickedBtnNot() { + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F8,是not + { + CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); + p1->GetInputInfo(0x00010013); - 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); - - SetBtnDisplay(1); + 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); - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - //p1->GetInputInfo(_T("Index ")); - SetBtnDisplay(4); + }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); - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010004); + SetDisplay(0x00010004); + }break; + case 1: + //1页的F11,是No.清除(33409,还没定义! - SetDisplay(0x00010004); + break; + default: + break; + } } void CMyFormInputShow::OnBnClickedBtnMce() { + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F12,是MCE + { + CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); + p1->GetInputInfo(0x00010005); - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010005); - - SetDisplay(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); - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010006); - - SetDisplay(0x00010006); - SetBtnDisplay(1); + 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); - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010007); - - SetDisplay(0x00010007); - - SetBtnDisplay(1); + 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; + } - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); - p1->GetInputInfo(0x00010008); - - SetDisplay(0x00010008); - - - //p1->GetInputInfo(_T("(DF)")); } void CMyFormInputShow::OnBnClickedBtnEnd() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x0001000A); @@ -3041,50 +3427,46 @@ } void CMyFormInputShow::OnBnClickedBtnCompare() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Compare")); - SetBtnDisplay(2); + 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); - - SetBtnDisplay(1); + showPage = 1; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnBit() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Bit")); - SetBtnDisplay(1); + showPage = 1; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnWord() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); //p1->GetInputInfo(_T("Word")); - SetBtnDisplay(3); + 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")); } @@ -3092,67 +3474,56 @@ 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")); } @@ -3160,15 +3531,12 @@ void CMyFormInputShow::OnBnClickedBtnX() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020001); - SetDisplay(0x00020001); } void CMyFormInputShow::OnBnClickedBtnY() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020002); @@ -3176,7 +3544,6 @@ } void CMyFormInputShow::OnBnClickedBtnR() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020003); @@ -3184,7 +3551,6 @@ } void CMyFormInputShow::OnBnClickedBtnL() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020004); @@ -3192,7 +3558,6 @@ } void CMyFormInputShow::OnBnClickedBtnP() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020005); @@ -3201,7 +3566,8 @@ void CMyFormInputShow::OnBnClickedBtnCompare1() { - SetBtnDisplay(2); + showPage = 2; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnT() { @@ -3235,7 +3601,8 @@ p1->GetInputInfo(0x00020009); SetDisplay(0x00020009); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmy() { @@ -3243,7 +3610,8 @@ p1->GetInputInfo(0x0002000A); SetDisplay(0x0002000A); - SetBtnDisplay(1); + showPage = 1; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmr() { @@ -3251,7 +3619,8 @@ p1->GetInputInfo(0x0002000B); SetDisplay(0x0002000B); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTml() { @@ -3259,7 +3628,8 @@ p1->GetInputInfo(0x0002000C); SetDisplay(0x0002000C); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnCt() { @@ -3267,8 +3637,8 @@ p1->GetInputInfo(0x0002000D); SetDisplay(0x0002000D); - - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } @@ -3412,3 +3782,13 @@ if (nChar == 13) { OnBtnRet(); } CFormView::OnChar(nChar, nRepCnt, nFlags); } + + +void CMyFormInputShow::OnKeyX() +{ + // TODO: 在此添加命令处理程序代码 + CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); + p1->GetInputInfo(0x00020001); + + SetDisplay(0x00020001); +} -- Gitblit v1.9.1