From 4ed7fc8447d202e21ef9907e2aac63ef6fcbf301 Mon Sep 17 00:00:00 2001 From: zxd <zxdvslxy@gmail.com> Date: 星期二, 17 十月 2023 12:33:23 +0800 Subject: [PATCH] 提交图码转换部分修改: 1.基本图形转换 2.ANS\ORS\PSHS\POPS命令的处理 3.重构了转换方法,命名为CMTerm1View::ScanLDSCells2();同时将翻译单独提出为方法CMTerm1View::Translate2Prog() 4.快捷键的添加绑定 5.其他相关方法修改,Insert,Delete,FocusChg…… 6.其他关联修改 --- MTerm1/KDefine.h | 2 MTerm1/MyDlgBarFuncKey.h | 29 + MTerm1/Resource.h | 47 + MTerm1/MTerm1View.h | 6 MTerm1/MTerm1.cpp | 1 MTerm1/MyFormInputShow.h | 25 MTerm1/MyFormInputShow.cpp | 639 ++++++++++++++------- MTerm1/MTerm1.rc | 0 MTerm1/MTerm1View.cpp | 974 +++++++++++++++++++-------------- MTerm1/MTerm1Doc.cpp | 2 10 files changed, 1,082 insertions(+), 643 deletions(-) diff --git a/MTerm1/KDefine.h b/MTerm1/KDefine.h index 51603cf..6fac2e0 100644 --- a/MTerm1/KDefine.h +++ b/MTerm1/KDefine.h @@ -34,6 +34,8 @@ KLCoilTypeC = 6 | TYPECOIL, //Counter KLCoilTypeLR = 7 | TYPECOIL, //Link register KLCoilTypeSR = 8 | TYPECOIL, //Link register + KLCoilTypeP = 9 | TYPECOIL, //P register + KLCoilTypeE = 10 | TYPECOIL, //E register }; enum enKLDataTypes diff --git a/MTerm1/MTerm1.cpp b/MTerm1/MTerm1.cpp index d59587c..caad9c8 100644 --- a/MTerm1/MTerm1.cpp +++ b/MTerm1/MTerm1.cpp @@ -260,6 +260,7 @@ { //TODO: 澶勭悊鍙兘宸叉坊鍔犵殑闄勫姞璧勬簮 AfxOleTerm(FALSE); + //this->CleanState(); return CWinAppEx::ExitInstance(); } diff --git a/MTerm1/MTerm1.rc b/MTerm1/MTerm1.rc index 89a1c74..6b14463 100644 --- a/MTerm1/MTerm1.rc +++ b/MTerm1/MTerm1.rc Binary files differ diff --git a/MTerm1/MTerm1Doc.cpp b/MTerm1/MTerm1Doc.cpp index 856ca5b..67b10c9 100644 --- a/MTerm1/MTerm1Doc.cpp +++ b/MTerm1/MTerm1Doc.cpp @@ -51,6 +51,8 @@ {KLCoilTypeSR,"SR"}, {KLCoilTypeC,"C"}, {KLCoilTypeT,"T"}, + {KLCoilTypeP,"P"}, + {KLCoilTypeE,"E"}, }; int CMTerm1Doc::nCoilTypeDefCount = sizeof(CMTerm1Doc::CoilTypeNameDef) / sizeof(stTypeNameDef); diff --git a/MTerm1/MTerm1View.cpp b/MTerm1/MTerm1View.cpp index 4abbea4..8a0bc34 100644 --- a/MTerm1/MTerm1View.cpp +++ b/MTerm1/MTerm1View.cpp @@ -1155,6 +1155,7 @@ nCol = 0; } } + CellFocusChg(nRow, nCol); } if (nChar == VK_RIGHT) { nCol += 1; @@ -1167,15 +1168,17 @@ nCol = m_CellPerLine - 1; } } + CellFocusChg(nRow, nCol); } if (nChar == VK_UP) { nRow -= 1; if (nRow < 0) { nRow = 0; } + CellFocusChg(nRow, nCol); } if (nChar == VK_DOWN) { nRow += 1; if (nRow >= m_nTotalRow + nLinesinView) { nRow = m_nTotalRow + nLinesinView -1; } - + CellFocusChg(nRow, nCol); } m_FocusRow = nRow; m_FocusCol = nCol; @@ -1485,16 +1488,16 @@ void CMTerm1View::OnProgConvert() { //杞崲鍓嶅厛瀵筁DS鐨勮鍒欒繘琛屾楠岋紙妫�楠岃鍒欎笌杩斿洖鍙傛暟骞舵湭瀹屽叏纭畾 - std::pair<int,CString> result = LDSCheckRule(); - if (result.first == 111) - { - DbgLog(result.second); - return; - } + // std::pair<int,CString> result = LDSCheckRule(); + //if (result.first == 111) + //{ + // DbgLog(result.second); + // return; + //} CString s1; s1.Format(_T("Prog Convert")); - SysLog(s1); + SysLog(s1); int r = TransLDSToProg(); s1.Format(_T("LDS To Prog result %d"), r); SysLog(s1); @@ -1591,6 +1594,12 @@ /// <param name="cell1"></param> void CMTerm1View::SetCellToView(stCell cell1, int flag) //**************************************************************************************************// { + bool changeVLine = false; + if ((Cells[m_FocusRow][m_FocusCol].bLeftLineDn != cell1.bLeftLineDn) + || (Cells[m_FocusRow][m_FocusCol].bLeftLineUp != cell1.bLeftLineUp)) + { + changeVLine = true; + } Cells[m_FocusRow][m_FocusCol] = cell1; m_bModified = 1; needReDraw = 1; @@ -1614,6 +1623,7 @@ } //娣诲姞绾电嚎鏃跺悓姝ユ坊鍔犱笂涓�琛� Cells[m_FocusRow - 1][m_FocusCol].bLeftLineDn = 1; + }break; case 2: { @@ -1625,13 +1635,18 @@ } //鍒犻櫎绾电嚎鏃跺悓姝ュ垹闄や笂涓�琛� Cells[m_FocusRow - 1][m_FocusCol].bLeftLineDn = 0; + }break; default: break; } - - //鍗曞厓鏍间綅缃悗绉� - m_FocusCol += 1; + //濡傛灉鍙樺寲鐨勬槸绔栫嚎锛岀劍鐐逛笉鍚庣Щ + if (!changeVLine) + { + //鍗曞厓鏍间綅缃悗绉� + m_FocusCol += 1; + } + if (m_FocusCol >= 16) { m_FocusCol = 0; @@ -1951,6 +1966,9 @@ POINT StPts[100]; // StPts[0] = POINT{ 0, 0 }; POINT EndPt[100]; + + POINT StrPt[100]; + int nStrPts = 0; int nEndPts = 0; nSts = 0; int nCurLine = 0; @@ -2048,9 +2066,16 @@ } else if (nPairOp == 0) { - nCurLine = maxy + 1; //鍙﹁捣涓�琛� - maxy = nCurLine; - cx = 0; cy = nCurLine; + if (i > 0 && nOp == pDoc->Progs[i-1].nOpType1)//濡傛灉鍓嶉潰涔熸槸ST锛岄偅灏变笉鎹㈣ + { + + } + else + { + nCurLine = ++maxy; + cx = 0; + cy = nCurLine; + } } } stpos[nSts] = i; @@ -2306,57 +2331,73 @@ cx++; break; case OP_ANS: + //ANS璇存槑鏄湁鐜矾锛屾暣琛岃繘琛岀Щ鍔紙鍚戝彸锛変粠鍚庡悜鍓嶈繘琛岀Щ鍔� + EndPt[nEndPts].y; + for (int i = EndPt[nEndPts-1].x ; i > 0; i--) + { + for (int j = EndPt[nEndPts].x; j >= 0; j--) + { + if (j > 0 + && Cells[cy + 1][j-1].nType == typeNone + || Cells[cy + 1][j - 1].nType == typeLine1 + || Cells[cy + 1][j - 1].nType == typeLine2) + { + continue; + } + + Cells[cy + 1][j] = Cells[cy + 1][j - 1]; + } + } + + Cells[EndPt[nEndPts].y][EndPt[nEndPts-1].x].bLeftLineDn = 1; + Cells[EndPt[nEndPts].y+1][EndPt[nEndPts-1].x].bLeftLineUp = 1; + nSts--; nEndPts--; break; case OP_ORS: - //褰撳墠搴忓垪涓庡墠闈㈢殑搴忓垪鍚堝苟銆� - //褰撳墠搴忓垪鐨勫紑濮嬬粨鏉熶綅缃� - //EndPt[nEndPts] = POINT{ cx,cy }; - //nEndPts++; - //StPts[nSts - 1]; EndPt[nEndPts - 1]; - //鍓嶄竴搴忓垪鐨勫紑濮嬬粨鏉熶綅缃� - StPts[nSts - 1]; - EndPt[nEndPts - 1]; + if (nEndPts <= 0) { break; } - ////鍒ゆ柇浜岃�呴暱搴� - //if (cx < EndPt[nEndPts - 1].x) - //{ - // //鏈琛ラ綈 - // for (int j = cx; j < EndPt[nEndPts - 1].x; j++) - // { - // Cells[cy][j].nType = typeLine1; - // } - // cx = EndPt[nEndPts - 1].x; - //} - //else - //{ - // //鍓嶄竴琛岃ˉ榻� - // for (int j = EndPt[nEndPts - 1].x; j < cx; j++) - // { - // Cells[EndPt[nEndPts - 1].y][j].nType = typeLine1; - // } - //} - ////杩炴帴涓婁笅绾� - //for (int j = EndPt[nEndPts - 1].y; j < cy; j++) - //{ - // Cells[j][cx].bLeftLineDn = 1; - // Cells[j + 1][cx].bLeftLineUp = 1; - //} - ////鍏夋爣浣嶇疆, 鍓嶄竴缁撴潫鐐逛綅缃� - //cy = EndPt[nEndPts - 1].y; + //鍒ゆ柇浜岃�呴暱搴� + if (cx < EndPt[nEndPts - 1].x) + { + //鏈琛ラ綈 + for (int j = cx; j < EndPt[nEndPts - 1].x; j++) + { + Cells[cy][j].nType = typeLine1; + } + cx = EndPt[nEndPts - 1].x; + } + else + { + //鍓嶄竴琛岃ˉ榻� + for (int j = EndPt[nEndPts - 1].x; j < cx; j++) + { + if (Cells[EndPt[nEndPts - 1].y][j].nType == typeNone) + { + Cells[EndPt[nEndPts - 1].y][j].nType = typeLine1; + } + } + } + //杩炴帴涓婁笅绾� + + Cells[cy][cx].bLeftLineUp = 1; + Cells[cy-1][cx].bLeftLineDn = 1; + + //鍏夋爣浣嶇疆, 鍓嶄竴缁撴潫鐐逛綅缃� nSts--; nEndPts--; - + cy = EndPt[nEndPts].y; + cx = EndPt[nEndPts].x; break; case OP_PSHS: - EndPt[nEndPts] = POINT{ cx,cy }; - nEndPts++; + StrPt[nStrPts] = POINT{ EndPt[nEndPts].x,EndPt[nEndPts].y+1 }; + nStrPts++; break; case OP_RDS: cx = EndPt[nEndPts - 1].x; @@ -2373,20 +2414,9 @@ } break; case OP_POPS: - cx = EndPt[nEndPts - 1].x; - for (int j = cx; j < m_CellPerLine; j++) { - if (Cells[cy][j].nType != 0) - { - cy++; j = cx - 1; break; - } - } - for (int j = EndPt[nEndPts - 1].y; j < cy; j++) - { - Cells[j][cx].bLeftLineDn = 1; - Cells[j + 1][cx].bLeftLineUp = 1; - } - nEndPts--; - + nStrPts--; + cy = StrPt[nStrPts].y; + cx = StrPt[nStrPts].x; break; case OP_OUT: case OP_SET: @@ -2528,7 +2558,7 @@ return 0; } bool firstCoil = true;//鏈绗竴涓崟鍏冩牸 - +bool isPops = false; /// <summary> /// 姊舰鍥捐浆Prog /// </summary> @@ -2586,7 +2616,7 @@ { nStartLine = 0; nEndLine = Divs[i]; - } + } else { nStartLine = Divs[i - 1]+1; @@ -2665,13 +2695,21 @@ { firstCoil = true; //寰幆閬嶅巻鍗曞厓鏍�(杞崲鐨勯�昏緫鍦ㄨ繖涓嚱鏁�) - ScanLDSCells(nStartLine, nEndLine, nCurPosY, nCurPosX, 0, thisprogsec, sProgSec, nSteps); + //ScanLDSCells(nStartLine, nEndLine, nCurPosY, nCurPosX, 0, thisprogsec, sProgSec, nSteps); + //ScanLDSCells2(nStartLine, nEndLine, nCurPosY, nCurPosX, 0, thisprogsec, sProgSec, nSteps); } - sProg += sProgSec; - nAllSteps += nSteps; - Progsec += thisprogsec; + //sProg += sProgSec; + // nAllSteps += nSteps; + //Progsec += thisprogsec; } - + CString sProgSec; + int nSteps = 0;; + nCurPosY = i; + stProgSection thisprogsec; + ScanLDSCells2(nStartLine, nEndLine, nCurPosY, nCurPosX, 16,0, thisprogsec, sProgSec, nSteps); + sProg += sProgSec; + nAllSteps += nSteps; + Progsec += thisprogsec; DbgLog(_T("\r\n")+ sProg); int n = int(Progsec.Progs.size()); s1.Format(_T("绋嬪簭娈垫鏁帮細 %d "), n); @@ -2702,7 +2740,7 @@ for (int i = 0; i < n; i++) { int optype=allprogs.Progs[i].nOpType1; - allprogs.Progs[i].PairTo = 0; + allprogs.Progs[i].PairTo = 0;//?????????? allprogs.Progs[i].nBinStep = i; CStringA OpTxtA,OpShowTxtA; CString OpTxt,OpShowTxt; @@ -2736,7 +2774,7 @@ { CString s1; int nCurPosX, nCurPosY; - int nNextX = 1;//姝ラ暱 + int nNextX = 1;//姝ラ暱(涓嬩釜璧峰鐐圭Щ鍔ㄧ殑璺濈) nCurPosY = nPosY; nCurPosX = nPosX; int nCoilType, CoilAddr; @@ -2744,7 +2782,7 @@ for (int j = nPosX; j < m_CellPerLine; j += nNextX) { nCurPosX = j; - //鍏堝鐞嗗綋鍓嶅崟鍏�; + //鍏堝鐞嗗綋鍓嶅崟鍏冨熀鏈俊鎭�; int nType = Cells[nCurPosY][nCurPosX].nType; CString sCellName = Cells[nCurPosY][nCurPosX].sCoilName; CMTerm1Doc::stProg theprog; @@ -2761,30 +2799,28 @@ || Cells[nCurPosY][j + nNextX].bLeftLineDn) { - ////鍏堢湅寰�涓婇潰鏈夋病鏈夎繛鎺� - //if (Cells[nCurPosY][j + nNextX].bLeftLineUp) - //{ - // // 寰�涓婇潰鏈夎繛鎺ヤ笖鏈夎Е鐐硅繛鎺ワ紝鎵嶄娇鐢∣RS - // s1.Format(_T("%d %d ORS "), nCurPosY, nCurPosX); - // DbgLog(s1); - // theprog.nOpType1 = OP_ORS; - // //theprog.nOpType1 = OP_ST; - // //theprog.PairTo = OP_ORS; - // progsec.Append(theprog); - // sProgSec.AppendFormat(_T("ORS \r\n")); - // firstCoil = false; - // nSteps += 1; - // nLevel -= 1; - //} - //宸︿笂鏄惁鏈夐摼鎺� + //鍏堢湅寰�涓婇潰鏈夋病鏈夎繛鎺� + if (Cells[nCurPosY][j + nNextX].bLeftLineUp) + { + // 寰�涓婇潰鏈夎繛鎺ヤ笖鏈夎Е鐐硅繛鎺ワ紝鎵嶄娇鐢∣RS + s1.Format(_T("%d %d ORS "), nCurPosY, nCurPosX); + DbgLog(s1); + theprog.nOpType1 = OP_ORS; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("ORS \r\n")); + firstCoil = false; + nSteps += 1; + nLevel -= 1; + } + //鍙充晶涓�鏍肩殑宸︿笂鏄惁鏈夐摼鎺� int nLeftUpCon = 0; if (Cells[nCurPosY][j + nNextX].bLeftLineUp) { nLeftUpCon = 1; } - //鍚戜笅鏌ユ壘锛岀湅鐪嬬珫绾跨殑宸︿晶涓嬮潰杩樻湁娌℃湁杩炴帴鍏朵粬涓滆タ - int nLeftDnCon = 0;//鍗曞厓鏍煎乏渚у悜涓嬭繛鎺ユ暟 - for (int k = nCurPosY + 1; k <= nEndLine; k++) + //鍚戜笅鏌ユ壘锛岀湅鐪嬬珫绾跨殑鍙充晶涓�鏍肩殑宸︿晶涓嬮潰杩樻湁娌℃湁杩炴帴鍏朵粬涓滆タ + int nLeftDnCon = 0;//鍗曞厓鏍煎彸渚т竴鏍肩殑宸︿晶鍚戜笅杩炴帴鏁� + for (int k = nCurPosY; k <= nEndLine; k++) { if (Cells[k][j + nNextX].bLeftLineDn) { @@ -2802,12 +2838,12 @@ s1.Format(_T("LeftUp %d LeftDn %d"), nLeftUpCon, nLeftDnCon); DbgLog(s1); - //宸︿晶涓嬮潰鏈夎繛鎺ワ紝閭d箞鎵弿鍒拌繖涓珫绾挎椂杩斿洖锛岀户缁壂鎻忓乏渚т笅闈㈢殑鍐呭銆� + //鍙充晶涓�鏍肩殑宸︿晶涓嬮潰鏈夎繛鎺ワ紝閭d箞鎵弿鍒拌繖涓珫绾挎椂杩斿洖锛岀户缁壂鎻忓乏渚т笅闈㈢殑鍐呭銆� if (nLeftDnCon) { return 1; } - // 宸︿晶涓嬮潰娌℃湁杩炴帴锛岄偅涔堣繖涓氨鏄乏闈㈡渶鍚庣殑鍗曞厓锛屽紑濮嬪鐞嗗彸闈㈢殑鍗曞厓銆� + //鍙充晶涓�鏍肩殑宸︿晶涓嬮潰娌℃湁杩炴帴锛岄偅涔堣繖涓氨鏄乏闈㈡渶鍚庣殑鍗曞厓锛屽紑濮嬪鐞嗗彸闈㈢殑鍗曞厓銆� else { if (nLeftUpCon) @@ -2854,13 +2890,13 @@ if (nRightCon == 1) { - s1.Format(_T(">>>> Go %d : %d , level %d "), nLineTop, j + nNextX, nLevel); + s1.Format(_T(">>>> Go %d : %d , level %d "), nLineTop, j + nNextX, nLevel); DbgLog(s1); CString ProgSec; int theSteps = 0; stProgSection thisprogsec; - // + //杩欐湁闂锛屽簲璇ユ槸鍦ㄦ渶楂樼偣鐨勬椂鍊欙紝鍗曠嫭杩涜涓�娆¤浆鎹紵 int r = ScanLDSCells(nStartLine, nEndLine, nLineTop, j + nNextX, nLevel, thisprogsec, ProgSec, theSteps); sProgSec += ProgSec; @@ -2868,6 +2904,7 @@ progsec += thisprogsec; s1.Format(_T("<<<< Re %d : %d , Result %d "), nLineTop, j + nNextX, 0); DbgLog(s1); + continue; } else { @@ -2899,7 +2936,7 @@ DbgLog(s1); if (nRightCount == 0) { - + //杩欓噷鏄笉鏄簲璇ュ仛鐐逛粈涔� } else if (res[nRightCount - 1] == 0) { @@ -2948,7 +2985,12 @@ } } } - + //濡傛灉娌℃湁绔栫嚎鐩存帴缈昏瘧 + else + { + Translate2Prog(nType, j + nNextX, nLevel, sCellName, progsec, sProgSec, nSteps); + } + /* #pragma region 鏍规嵁鍗曞厓鏍肩被鍨嬭浆鎹负鎸囦护鍜宲rog if (nType == typeNO) @@ -3180,253 +3222,371 @@ } #pragma endregion - + */ } return 0; } - /* - void CMTerm1View::chuansileitetoprog(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection& progsec, CString& sProgSec, int& nSteps) - { - CString s1; - int nCurPosX, nCurPosY; - int nNextX = 1;//姝ラ暱 - nCurPosY = nPosY; - nCurPosX = nPosX; - int nCoilType, CoilAddr; - CMTerm1Doc* pDoc = GetDocument(); -#pragma region 鏍规嵁鍗曞厓鏍肩被鍨嬭浆鎹负鎸囦护鍜宲rog +// 璁板綍y,x +std::pair<int, int> popsPoint[100]; int nPSHS = -1; +int CMTerm1View::ScanLDSCells2(int nStartLine, int nEndLine, int nPosY, int nPosX, int nSizeX, + int nLevel, stProgSection& progsec, CString& sProgSec, int& nSteps) +{ + CString s1; + int nCurPosX, nCurPosY; + int nNextX = 0;//姝ラ暱锛堝埌涓嬩釜绾垮湀璧峰浣嶇疆搴旂Щ鍔ㄨ窛绂� + nCurPosY = nStartLine; + nCurPosX = nPosX; + int nCoilType, CoilAddr; + CMTerm1Doc* pDoc = GetDocument(); - if (nType == typeNO) - { - if (firstCoil && nType != typeLine1 && nType != typeLine2) - { - //鍏堢湅寰�涓婇潰鏈夋病鏈夎繛鎺� - if (Cells[nCurPosY][j + nNextX].bLeftLineUp) - { - // 寰�涓婇潰鏈夎繛鎺ヤ笖鏈夎Е鐐硅繛鎺ワ紝鎵嶄娇鐢∣R - s1.Format(_T("%d %d OR %s"), nCurPosY, nCurPosX, sCellName); - sProgSec.AppendFormat(_T("OR %s\r\n"), sCellName); - .nOpType1 = OP_OR; - } - else - { - s1.Format(_T("%d %d ST %s"), nCurPosY, nCurPosX, sCellName); - sProgSec.AppendFormat(_T("ST %s\r\n"), sCellName); - theprog.nOpType1 = OP_ST; - } - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - firstCoil = false; - } - else - { - s1.Format(_T("%d %d AN %s"), nCurPosY, nCurPosX, sCellName); - sProgSec.AppendFormat(_T("NO %s\r\n"), sCellName); - theprog.nOpType1 = OP_AN; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - } - nSteps += 1; - DbgLog(s1); - nNextX = 1; - } - else if (nType == typeNC) - { - if (firstCoil && nType != typeLine1 && nType != typeLine2) - { - s1.Format(_T("%d %d ST/ %s"), nCurPosY, nCurPosX, sCellName); - sProgSec.AppendFormat(_T("ST/ %s\r\n"), sCellName); - theprog.nOpType1 = OP_ST_; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - firstCoil = false; - } - else - { - s1.Format(_T("%d %d AN/ %s"), nCurPosY, nCurPosX, sCellName); - sProgSec.AppendFormat(_T("AN/ %s\r\n"), sCellName); - theprog.nOpType1 = OP_AN_; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - } - DbgLog(s1); - nSteps += 1; - nNextX = 1; - } - else if (nType == typePP) - { - s1.Format(_T("%d %d PP %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - //progsec.Append(theprog); - sProgSec.AppendFormat(_T("PP %s\r\n"), sCellName); - nSteps += 1; - nNextX = 1; - } - else if (nType == typePN) - { - s1.Format(_T("%d %d PN %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - //progsec.Append(theprog); - sProgSec.AppendFormat(_T("PN %s\r\n"), sCellName, sCellName); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeNOT) - { - s1.Format(_T("%d %d NOT %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("NOT %s\r\n"), sCellName); - theprog.nOpType1 = OP_NOT; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeDF) - { - s1.Format(_T("%d %d DF %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("DF %s\r\n"), sCellName); - theprog.nOpType1 = OP_DF; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeDF_) - { - s1.Format(_T("%d %d DF/ %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("DF/ %s\r\n"), sCellName); - theprog.nOpType1 = OP_DF_; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeOUT) - { - s1.Format(_T("%d %d OUT %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("OUT %s\r\n"), sCellName); - theprog.nOpType1 = OP_OUT; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeSET) - { - s1.Format(_T("%d %d SET %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("SET %s\r\n"), sCellName); - theprog.nOpType1 = OP_SET; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeRESET) - { - s1.Format(_T("%d %d RESET %s"), nCurPosY, nCurPosX, sCellName); - DbgLog(s1); - sProgSec.AppendFormat(_T("RESET %s\r\n"), sCellName); - theprog.nOpType1 = OP_RESET; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - nSteps += 1; - nNextX = 1; - } - else if (nType == typeCMP) - { - s1.Format(_T("%d %d CMP %s %s %s"), nCurPosY, nCurPosX, sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - DbgLog(s1); - theprog.nOpType1 = OP_ST_GT; - theprog.nParamCount = 1; - progsec.Append(theprog); - sProgSec.AppendFormat(_T("CMP %s %s %s \r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - nSteps += 1; - nNextX = 3; - } - else if (nType == typeTM) - { - s1.Format(_T("%d %d TM %s %d %s"), nCurPosY, nCurPosX, sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - DbgLog(s1); - theprog.nOpType1 = OP_TMX; - theprog.nParamCount = 1; - pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); - theprog.Params[0].nParamType = nCoilType; - theprog.Params[0].nParamAddr = CoilAddr; - theprog.Params[0].sParamStr = sCellNameA; - progsec.Append(theprog); - sProgSec.AppendFormat(_T("TM %s %d %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - nSteps += 1; - nNextX = 3; - } - else if (nType == typeFN1) - { - s1.Format(_T("%d %d FN1 %s %s"), nCurPosY, nCurPosX, sCellName, Cells[nCurPosY][nCurPosX + 1].sParam); - DbgLog(s1); - theprog.nOpType1 = OP_INC; - progsec.Append(theprog); - sProgSec.AppendFormat(_T("FN1 %s %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam); - nSteps += 1; - nNextX = 2; - } - else if (nType == typeFN2) - { - s1.Format(_T("%d %d FN2 %s %s %s "), nCurPosY, nCurPosX, sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - DbgLog(s1); - theprog.nOpType1 = OP_MV; - progsec.Append(theprog); - sProgSec.AppendFormat(_T("FN2 %s %s %s \r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); - nSteps += 1; - nNextX = 3; - } - else if (nType == typeFN3) - { - s1.Format(_T("%d %d FN3 %s %s %s %s"), nCurPosY, nCurPosX, sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam, Cells[nCurPosY][nCurPosX + 3].sParam); - DbgLog(s1); - theprog.nOpType1 = OP_ADD3; - progsec.Append(theprog); - sProgSec.AppendFormat(_T("FN3 %s %s %s %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam, Cells[nCurPosY][nCurPosX + 3].sParam); - nSteps += 1; - nNextX = 4; - } - else - { - nNextX = 1; - //continue; - } + for (int j = nPosX; j < nSizeX; j += nNextX) + { + nCurPosX = j; + //鍏堝鐞嗗綋鍓嶅崟鍏�; + int nType = Cells[nCurPosY][nCurPosX].nType; + CString sCellName = Cells[nCurPosY][nCurPosX].sCoilName; + CMTerm1Doc::stProg theprog; + CStringA sCellNameA; + sCellNameA = sCellName; + CString ProgSec; + int theSteps = 0; -#pragma endregion + stProgSection thisprogsec; + + //鍒ゆ柇瓒婄晫 + if (j + nNextX >= m_CellPerLine) + { + continue; + } + //if (!firstCoil && Cells[nCurPosY][j].bLeftLineUp) + //{ + // break; + //} + if (Cells[nCurPosY][nCurPosX].nType == typeNone) + { + nNextX = 1; + continue; + } + //寮�濮嬬炕璇戝崟涓崟鍏冩牸锛屽苟杩斿洖涓嬩釜鍗曞厓鏍间綅缃� + nNextX = Translate2Prog(nType, nCurPosY, nCurPosX, sCellName, progsec, sProgSec, nSteps); + //1.鍒ゆ柇姝ゅ崟鍏冩牸鍙充晶涓�鏍兼槸鍚︽湁鍚戜笅鐨勭珫绾� + if (Cells[nCurPosY][j + nNextX].bLeftLineDn) + { + //1.1:鏈夊垎鏀紝鐩存帴寮�濮嬭鍙栦笅涓�琛� + if (Cells[nCurPosY +1][j].nType == typeNone) + { + if (Cells[nCurPosY + 1][j + nNextX].nType != typeNone) + { + firstCoil = true; + } + continue; + } + + firstCoil = true; + ScanLDSCells2(nCurPosY + 1, nCurPosY + 1, nCurPosY + 1, 0, j + nNextX, ++nLevel, thisprogsec, ProgSec, theSteps); + + //鏈塐R鍏崇郴涓斾笉鍙竴涓妭鐐� + if (theSteps > 1 && nLevel > 0) + { + // 姝ユ暟澶т簬1锛屾槸澶嶅悎缁撴灉锛屾墠浣跨敤ORS + s1.Format(_T("%d %d ORS "), nCurPosY, nCurPosX); + DbgLog(s1); + theprog.nOpType1 = OP_ORS; + //progsec.Append(theprog); + //sProgSec.AppendFormat(_T("ORS \r\n")); + thisprogsec.Append(theprog); + ProgSec.AppendFormat(_T("ORS \r\n")); + firstCoil = false; + nSteps += 1; + } + + //1.2:浠庡悗鍚戝墠鏌ユ壘涓嬩竴琛屾槸鍚﹁繕鏈夊悜涓婄殑绔栫嚎锛堝舰鎴愰棴鐜級锛圤RS銆丄NS锛� + for (int k = j; k >= 0; k--) + { + if (Cells[nCurPosY + 1][k].nType == typeNone) + { + //濡傛灉閬囧埌绌烘牸锛岃繕娌℃悳鍒帮紝灏辩粨鏉熸悳绱� + break; + } + if (Cells[nCurPosY+1][k].bLeftLineUp) + { + //濡傛灉鏈変竴鏉$珫绾匡紝璇存槑鏄舰鎴愪簡鐜紝瑕佺敤ANS + if (theSteps >= 1 && nLevel > 0) + { + //姝ユ暟澶т簬1锛屾槸澶嶅悎缁撴灉锛屼娇鐢ˋNS + s1.Format(_T("%d %d ANS "), nCurPosY, nCurPosX); + DbgLog(s1); + theprog.nOpType1 = OP_ANS; + //progsec.Append(theprog); + //sProgSec.AppendFormat(_T("ANS \r\n")); + thisprogsec.Append(theprog); + ProgSec.AppendFormat(_T("ANS \r\n")); + nSteps += 1; + } + } + } + + //灏嗚浆鎹㈠畬鎴愮殑閮ㄥ垎鍔犲叆鍒版�婚泦涓� + nSteps += theSteps; + progsec += thisprogsec; + sProgSec += ProgSec; + + //1.3:鏌ヨ姝ゅ垎鏀笅涓�绾ц繛鎺ョ偣宸﹀彸鍧囧瓨鍦ㄨ妭鐐癸紝瀛樺湪灏盤SHS + if (Cells[nCurPosY + 1][j].nType != typeNone + && Cells[nCurPosY + 1][j + 1].nType != typeNone) + { + ++nPSHS; + CString push = _T("PSHS \r\n"); + theprog.nOpType1 = OP_PSHS; + progsec.Append(theprog); + sProgSec.Append(push); + popsPoint[nPSHS] = std::make_pair(nCurPosY + 1, j + 1); + } + }//end 1.鍒ゆ柇姝ゅ崟鍏冩牸鍙充晶涓�鏍兼槸鍚︽湁鍚戜笅鐨勭珫绾� + + } + nLevel--; + //宸插洖鍒拌捣濮嬪眰 + if (nLevel == 0) + { + CMTerm1Doc::stProg theprog; + for (int i = nPSHS; i >= 0; i--) + { + //+POP + CString pop = _T("POPS \r\n"); + theprog.nOpType1 = OP_POPS; + progsec.Append(theprog); + sProgSec.Append(pop); + //+fanyi + //寮�濮嬬炕璇戝崟涓崟鍏冩牸锛屽苟杩斿洖涓嬩釜鍗曞厓鏍间綅缃� + //firstCoil = true; + ScanLDSCells2(popsPoint[nPSHS].first, popsPoint[nPSHS].first, popsPoint[nPSHS].first, popsPoint[nPSHS].second, 16, nLevel, progsec, sProgSec, nSteps); + nPSHS--; + + } + if (nPSHS == -1) + { + fill(popsPoint, popsPoint + 100, std::make_pair(0, 0)); + } + } + + return 0; } -*/ + + +int CMTerm1View::Translate2Prog( + int nType, int nCurPosY, int nCurPosX, CString sCellName, + stProgSection& progsec, CString& sProgSec, int& nSteps) +{ + CString s1; + int nNextX = 1;//姝ラ暱 + int nCoilType, CoilAddr; + CMTerm1Doc::stProg theprog; + CMTerm1Doc* pDoc = GetDocument(); + CStringA sCellNameA; + sCellNameA = sCellName; + //if (nType == typeNone) + //{ + // return 0; + //} + if (nType == typeNO) + { + if (firstCoil && nType != typeLine1 && nType != typeLine2) + { + //鍏堢湅寰�涓婇潰鏈夋病鏈夎繛鎺� + if (Cells[nCurPosY][nCurPosX + nNextX].bLeftLineUp) + { + // 寰�涓婇潰鏈夎繛鎺ワ紝浣跨敤OR + sProgSec.AppendFormat(_T("OR %s\r\n"), sCellName); + theprog.nOpType1 = OP_OR; + } + else + { + sProgSec.AppendFormat(_T("ST %s\r\n"), sCellName); + theprog.nOpType1 = OP_ST; + } + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + firstCoil = false; + } + else + { + sProgSec.AppendFormat(_T("AN %s\r\n"), sCellName); + theprog.nOpType1 = OP_AN; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + } + + nSteps += 1; + nNextX = 1; + } + else if (nType == typeNC) + { + if (firstCoil && nType != typeLine1 && nType != typeLine2) + { + sProgSec.AppendFormat(_T("ST/ %s\r\n"), sCellName); + theprog.nOpType1 = OP_ST_; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + firstCoil = false; + } + else + { + sProgSec.AppendFormat(_T("AN/ %s\r\n"), sCellName); + theprog.nOpType1 = OP_AN_; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + } + nSteps += 1; + nNextX = 1; + } + else if (nType == typePP) + { + //progsec.Append(theprog); + sProgSec.AppendFormat(_T("PP %s\r\n"), sCellName); + nSteps += 1; + nNextX = 1; + } + else if (nType == typePN) + { + //progsec.Append(theprog); + sProgSec.AppendFormat(_T("PN %s\r\n"), sCellName, sCellName); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeNOT) + { + sProgSec.AppendFormat(_T("NOT %s\r\n"), sCellName); + theprog.nOpType1 = OP_NOT; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeDF) + { + sProgSec.AppendFormat(_T("DF %s\r\n"), sCellName); + theprog.nOpType1 = OP_DF; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeDF_) + { + sProgSec.AppendFormat(_T("DF/ %s\r\n"), sCellName); + theprog.nOpType1 = OP_DF_; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeOUT) + { + sProgSec.AppendFormat(_T("OUT %s\r\n"), sCellName); + theprog.nOpType1 = OP_OUT; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeSET) + { + sProgSec.AppendFormat(_T("SET %s\r\n"), sCellName); + theprog.nOpType1 = OP_SET; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeRESET) + { + sProgSec.AppendFormat(_T("RESET %s\r\n"), sCellName); + theprog.nOpType1 = OP_RESET; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + nSteps += 1; + nNextX = 1; + } + else if (nType == typeCMP) + { + theprog.nOpType1 = OP_ST_GT; + theprog.nParamCount = 1; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("CMP %s %s %s \r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); + nSteps += 1; + nNextX = 3; + } + else if (nType == typeTM) + { + theprog.nOpType1 = OP_TMX; + theprog.nParamCount = 1; + pDoc->TxtToCoilType(sCellNameA, &nCoilType, &CoilAddr); + theprog.Params[0].nParamType = nCoilType; + theprog.Params[0].nParamAddr = CoilAddr; + theprog.Params[0].sParamStr = sCellNameA; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("TM %s %d %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); + nSteps += 1; + nNextX = 3; + } + else if (nType == typeFN1) + { + theprog.nOpType1 = OP_INC; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("FN1 %s %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam); + nSteps += 1; + nNextX = 2; + } + else if (nType == typeFN2) + { + theprog.nOpType1 = OP_MV; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("FN2 %s %s %s \r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam); + nSteps += 1; + nNextX = 3; + } + else if (nType == typeFN3) + { + theprog.nOpType1 = OP_ADD3; + progsec.Append(theprog); + sProgSec.AppendFormat(_T("FN3 %s %s %s %s\r\n"), sCellName, Cells[nCurPosY][nCurPosX + 1].sParam, Cells[nCurPosY][nCurPosX + 2].sParam, Cells[nCurPosY][nCurPosX + 3].sParam); + nSteps += 1; + nNextX = 4; + } + else + { + nNextX = 1; + //continue; + } + return nNextX; +} + /// <summary> /// 鍏ㄩ儴鍥惧舰鏍¢獙 @@ -3436,75 +3596,75 @@ /// 璁″垝鍦ㄧ涓�涓繑鍥炲�间腑浣跨敤涓嶅悓鐨勯敊璇唬鐮佷唬琛ㄤ笉鍚岀殑閿欒绫诲瀷锛� /// 骞跺湪绗簩涓繑鍥炲�间腑濉厖閿欒鎻愮ず淇℃伅 /// </remark> -std::pair<int, CString> CMTerm1View::LDSCheckRule() -{ - CString message; - int nDivCount = 0; - int Divs[100] = { 0 }; - //浠ヨ涓哄崟浣嶄粠涓婂埌涓嬮亶鍘嗭紙琛岄亶鍘嗭級 - for (int i = 0; i < m_nTotalRow; i++) - { - int nRow = i; - int bConnected = 0; - bool checkFlag = false;//0鍒楁楠岀粨鏋� + std::pair<int, CString> CMTerm1View::LDSCheckRule() + { + CString message; + int nDivCount = 0; + int Divs[100] = { 0 }; + //浠ヨ涓哄崟浣嶄粠涓婂埌涓嬮亶鍘嗭紙琛岄亶鍘嗭級 + for (int i = 0; i < m_nTotalRow; i++) + { + int nRow = i; + int bConnected = 0; + bool checkFlag = false;//0鍒楁楠岀粨鏋� - //鏈鐨�0鍒楁鏌� - if (Cells[nRow][0].nType == 0) - { - checkFlag = true; - } + //鏈鐨�0鍒楁鏌� + if (Cells[nRow][0].nType == 0) + { + checkFlag = true; + } - //閬嶅巻姝よ鐨�1-15鍒楋紙纭畾鍗曞厓鏍硷級 - for (int j = 1; j < m_CellPerLine; j++) - { - int nCol = j; - //濡傛灉0鍒椾负绌� - if (checkFlag) - { - //鏈夊乏渚т笂绔栫嚎 - if (Cells[nRow][nCol].bLeftLineUp) - { - //濡傛灉涓婂眰涓虹┖鍗曞厓鏍硷紝鏃犳晥绔栫嚎锛岀洿鎺ュ垹闄�-----鍙互鍗曠嫭鍒ゆ柇 - if (nRow - 1 >= 0 && Cells[nRow-1][nCol].nType == 0) - { - //娓呯悊鍗曞厓鏍� - Cells[nRow][nCol].clear(); - } - //濡傛灉鏄痭one锛岄敊璇細鐭矾鎴栧洖璺� - else if (Cells[nRow][nCol].nType == 0) - { - message.Format(_T("((%d,%d) 闄勮繎浣嶇疆浜х敓瑙︾偣鐭矾鎴栧洖璺紒"),nRow,nCol); - return std::make_pair(111, message); - } - //濡傛灉涓嶄负none銆傚彲浠ヨ浆鎹紝浣嗘槸鎻愮ず锛氭棤娉曠粯鍒跺浘褰紙绋嬪簭涓嶅悎鐞嗭級 - if (Cells[nRow][nCol].nType != 1) - { - message.Format(_T("((%d,%d) 鏃犳硶缁樺埗鍥惧舰锛堢▼搴忎笉鍚堢悊锛�"), nRow, nCol); - return std::make_pair(111, message); - } + //閬嶅巻姝よ鐨�1-15鍒楋紙纭畾鍗曞厓鏍硷級 + for (int j = 1; j < m_CellPerLine; j++) + { + int nCol = j; + //濡傛灉0鍒椾负绌� + if (checkFlag) + { + //鏈夊乏渚т笂绔栫嚎 + if (Cells[nRow][nCol].bLeftLineUp) + { + //濡傛灉涓婂眰涓虹┖鍗曞厓鏍硷紝鏃犳晥绔栫嚎锛岀洿鎺ュ垹闄�-----鍙互鍗曠嫭鍒ゆ柇 + if (nRow - 1 >= 0 && Cells[nRow - 1][nCol].nType == 0) + { + //娓呯悊鍗曞厓鏍� + Cells[nRow][nCol].clear(); + } + //濡傛灉鏄痭one锛岄敊璇細鐭矾鎴栧洖璺� + else if (Cells[nRow][nCol].nType == 0) + { + message.Format(_T("((%d,%d) 闄勮繎浣嶇疆浜х敓瑙︾偣鐭矾鎴栧洖璺紒"), nRow, nCol); + return std::make_pair(111, message); + } + //濡傛灉涓嶄负none銆傚彲浠ヨ浆鎹紝浣嗘槸鎻愮ず锛氭棤娉曠粯鍒跺浘褰紙绋嬪簭涓嶅悎鐞嗭級 + if (Cells[nRow][nCol].nType != 1) + { + message.Format(_T("((%d,%d) 鏃犳硶缁樺埗鍥惧舰锛堢▼搴忎笉鍚堢悊锛�"), nRow, nCol); + return std::make_pair(111, message); + } - } - //娌℃湁宸︿晶涓婄珫绾匡紝涓旀鍗曞厓鏍肩被鍨� 涓嶄负绌烘垨绾� - else if (Cells[nRow][nCol].nType > 2) - { - //姝ゅ崟鍏冩牸涓哄崟鐙殑绾垮湀鎴栨寚浠ゅ崟鍏冿紝闇�瑕佽Е鐐硅緭鍏� - message.Format(_T("((%d,%d) 闇�瑕佽Е鐐硅緭鍏�"), nRow, nCol); - return std::make_pair(111, message); - } - //鏈夊乏渚т笅绔栫嚎锛屼笖姝ゅ崟鍏冩牸绫诲瀷涓虹┖ - if (Cells[nRow][nCol].bLeftLineDn) - { - //涓嶆敮鎸佸洖璺� - } - } - //濡�0鍒楅潪绌� - else - { + } + //娌℃湁宸︿晶涓婄珫绾匡紝涓旀鍗曞厓鏍肩被鍨� 涓嶄负绌烘垨绾� + else if (Cells[nRow][nCol].nType > 2) + { + //姝ゅ崟鍏冩牸涓哄崟鐙殑绾垮湀鎴栨寚浠ゅ崟鍏冿紝闇�瑕佽Е鐐硅緭鍏� + message.Format(_T("((%d,%d) 闇�瑕佽Е鐐硅緭鍏�"), nRow, nCol); + return std::make_pair(111, message); + } + //鏈夊乏渚т笅绔栫嚎锛屼笖姝ゅ崟鍏冩牸绫诲瀷涓虹┖ + if (Cells[nRow][nCol].bLeftLineDn) + { + //涓嶆敮鎸佸洖璺� + } + } + //濡�0鍒楅潪绌� + else + { - } - } + } + } - } - return std::make_pair(0,message); -} + } + return std::make_pair(0, message); + } diff --git a/MTerm1/MTerm1View.h b/MTerm1/MTerm1View.h index 34fe522..1edbbeb 100644 --- a/MTerm1/MTerm1View.h +++ b/MTerm1/MTerm1View.h @@ -6,6 +6,7 @@ #include <memory> #include <vector> +#include <stack> #include "MTerm1Doc.h" class CMTerm1View : public CScrollView @@ -290,7 +291,10 @@ afx_msg void OnInputIoComment(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); int ScanLDSCells(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection & progsec, CString & sProgSec, int &nSteps); - void chuansileitetoprog(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection& progsec, CString& sProgSec, int& nSteps); + int ScanLDSCells2(int nStartLine, int nEndLine, int nPosY, int nPosX, int nSizeX, int nLevel, stProgSection& progsec, CString& sProgSec, int& nSteps); + int CMTerm1View::Translate2Prog( + int nType, int nCurPosY, int nCurPosX, CString sCellName, + stProgSection& progsec, CString& sProgSec, int& nSteps); void SetCellToView(stCell cell1, int flag = 0);//modify0919zxd }; diff --git a/MTerm1/MyDlgBarFuncKey.h b/MTerm1/MyDlgBarFuncKey.h index 5526700..b6d04ed 100644 --- a/MTerm1/MyDlgBarFuncKey.h +++ b/MTerm1/MyDlgBarFuncKey.h @@ -63,6 +63,35 @@ #define IDC_BUTTON_TML 34704 #define IDC_BUTTON_CT 34706 +#define IDC_BUTTON_NOCLEAR 33410 +#define IDC_BUTTON_WX 34101 +#define IDC_BUTTON_WY 34102 +#define IDC_BUTTON_WR 34103 +#define IDC_BUTTON_WL 34104 +#define IDC_BUTTON_DT 34105 +#define IDC_BUTTON_LD 34106 +#define IDC_BUTTON_FL 34107 +#define IDC_BUTTON_SV 34201 +#define IDC_BUTTON_EV 34202 +#define IDC_BUTTON_K 34203 +#define IDC_BUTTON_H 34204 +#define IDC_BUTTON_M 34205 +#define IDC_BUTTON_f 34206 +#define IDC_BUTTON_IXI0 34401 +#define IDC_BUTTON_IYI1 34402 +#define IDC_BUTTON_I2 34403 +#define IDC_BUTTON_I3 34404 +#define IDC_BUTTON_I4 34405 +#define IDC_BUTTON_I5 34406 +#define IDC_BUTTON_I6 34407 +#define IDC_BUTTON_I7 34408 +#define IDC_BUTTON_I8 34409 +#define IDC_BUTTON_I9 34501 +#define IDC_BUTTON_IA 34502 +#define IDC_BUTTON_IB 34503 +#define IDC_BUTTON_IC 34504 +#define IDC_BUTTON_ID 34505 + class CMyDlgBarFuncKey : public CDialogBar { diff --git a/MTerm1/MyFormInputShow.cpp b/MTerm1/MyFormInputShow.cpp index e7834a3..7629e86 100644 --- a/MTerm1/MyFormInputShow.cpp +++ b/MTerm1/MyFormInputShow.cpp @@ -7,35 +7,36 @@ #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); @@ -78,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) @@ -167,8 +168,8 @@ ON_WM_CHAR() -END_MESSAGE_MAP() +END_MESSAGE_MAP() // CMyFormLog 诊断 @@ -186,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) { @@ -196,7 +195,6 @@ return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } - int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -208,14 +206,12 @@ return 0; } - void CMyFormInputShow::OnDestroy() { CFormView::OnDestroy(); // TODO: 在此处添加消息处理程序代码 } - void CMyFormInputShow::OnSize(UINT nType, int cx, int cy) { @@ -258,7 +254,6 @@ //*/ } - void CMyFormInputShow::OnInitialUpdate() { @@ -399,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: 在此添加消息处理程序代码和/或调用默认值 @@ -429,10 +420,8 @@ CFormView::OnTimer(nIDEvent); } - void CMyFormInputShow::OnBnClickedButton1() { - // TODO: 在此添加控件通知处理程序代码 CString s1; s1.Format(_T("Button1 Clicked")); SysLog(s1); @@ -504,7 +493,7 @@ int CMyFormInputShow::display(tagInputCell stDisplayCell) { - static CString strOp, strParam, strNum; + static CString strOp, strParam , strNum; static CString str; switch (stDisplayCell.OP) { @@ -812,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]")) @@ -843,6 +838,7 @@ break; } + if ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt)) { strParam = "="; @@ -867,12 +863,18 @@ { 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) { @@ -884,7 +886,6 @@ { case CMTerm1View::typeNone: m_InputCell.OP = CMTerm1View::typeNO; - break; case CMTerm1View::typeLine1: m_InputCell.OP = nType; @@ -895,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: @@ -903,7 +905,6 @@ break; case CMTerm1View::typePP: m_InputCell.OP = nType; - break; case CMTerm1View::typePN: m_InputCell.OP = nType; @@ -920,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: @@ -940,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; @@ -982,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) { @@ -1027,22 +1029,16 @@ 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(); } @@ -1053,18 +1049,21 @@ /// </summary> void CMyFormInputShow::OnBtnInsert() { - //if (m_InputCell.OP == NULL) - //{ - // DbgLog(_T("Error:插入失败,未选择要插入的操作")); - // return; - //} - - //if (m_InputCell.num == (_T(""))) - //{ - // DbgLog(_T("Error:插入失败,未设置编号")); - // return; - //} - + 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; @@ -1142,7 +1141,8 @@ p3->SetCellToView(focusCell, flag); //插入完成后,设置按钮返回第一页 - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); } @@ -1153,7 +1153,6 @@ void CMyFormInputShow::OnBtnDelete() { CString s1; - CString strName; CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); @@ -1166,16 +1165,14 @@ // p3->SetCellToView(focusCell); //插入完成后,设置按钮返回第一页 - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); DbgLog(focusCell.sCoilName); } void CMyFormInputShow::OnBtnEsc() { - // TODO: 在此添加命令处理程序代码 - //m_wndDlgBar_InputShow.SetDisplay(_T("Esc")); SetBtnDisplayESC(0); - // m_wndDlgBar_Func_Key.SetBtnDisplayESC(); } int CMyFormInputShow::SetDisplay(int inputInfo) @@ -1828,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: @@ -2238,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: @@ -3021,28 +3022,48 @@ 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> @@ -3056,86 +3077,141 @@ /// </remark> void CMyFormInputShow::OnBnClickedBtnVline() { - CString s1; + //判断按钮在第几页,触发不同的操作 + 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) + //先判断情况3 + if (m_InputCell.row == 0) { - focusCell.bLeftLineUp = 0;//设置左上线为0 - flag = 2; + //发送错误信息 + 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 { - focusCell.bLeftLineUp = 1;//设置左上线为0 - flag = 1; + //不是空格,判断有无左上纵线 + 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; } - - 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); - - //插入完成后,设置按钮返回第一页 - SetBtnDisplay(0); - DbgLog(focusCell.sCoilName); } 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> @@ -3143,92 +3219,207 @@ /// </summary> void CMyFormInputShow::OnBnClickedBtnHLine() { + //判断按钮在第几页,触发不同的操作 + switch (showPage) + { + case 0: + //0页的F1,是横线 + { + CString s1; + CString strName; - CString s1; + CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); + CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame(); + CView* p2 = (CView*)pChild->GetActiveView(); + if (p2 == NULL) return; + CMTerm1View* p3 = (CMTerm1View*)p2; - 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); - //插入完成后,设置按钮返回第一页 - SetBtnDisplay(0); - DbgLog(focusCell.sCoilName); + 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); @@ -3236,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")); } @@ -3287,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")); } @@ -3355,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); @@ -3371,7 +3544,6 @@ } void CMyFormInputShow::OnBnClickedBtnR() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020003); @@ -3379,7 +3551,6 @@ } void CMyFormInputShow::OnBnClickedBtnL() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020004); @@ -3387,7 +3558,6 @@ } void CMyFormInputShow::OnBnClickedBtnP() { - CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd(); p1->GetInputInfo(0x00020005); @@ -3396,7 +3566,8 @@ void CMyFormInputShow::OnBnClickedBtnCompare1() { - SetBtnDisplay(2); + showPage = 2; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnT() { @@ -3430,7 +3601,8 @@ p1->GetInputInfo(0x00020009); SetDisplay(0x00020009); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmy() { @@ -3438,7 +3610,8 @@ p1->GetInputInfo(0x0002000A); SetDisplay(0x0002000A); - SetBtnDisplay(1); + showPage = 1; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTmr() { @@ -3446,7 +3619,8 @@ p1->GetInputInfo(0x0002000B); SetDisplay(0x0002000B); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnTml() { @@ -3454,7 +3628,8 @@ p1->GetInputInfo(0x0002000C); SetDisplay(0x0002000C); - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } void CMyFormInputShow::OnBnClickedBtnCt() { @@ -3462,8 +3637,8 @@ p1->GetInputInfo(0x0002000D); SetDisplay(0x0002000D); - - SetBtnDisplay(0); + showPage = 0; + SetBtnDisplay(showPage); } @@ -3607,3 +3782,5 @@ if (nChar == 13) { OnBtnRet(); } CFormView::OnChar(nChar, nRepCnt, nFlags); } + + diff --git a/MTerm1/MyFormInputShow.h b/MTerm1/MyFormInputShow.h index e0315cd..596c372 100644 --- a/MTerm1/MyFormInputShow.h +++ b/MTerm1/MyFormInputShow.h @@ -89,7 +89,7 @@ bool bFloat1 = false; bool bLeftLineUp = false; bool brightLineUp = false; - int param = 0; + int param = -1; CString sCellName; CString sParamName; CString num = _T(""); @@ -98,7 +98,7 @@ void clear() { OP = 0; bnot = 0; bpp = 0; bpn = 0; bcmpEq = 0; bcmpLt = 0; bcmpGt = 0; bDouble = 0; bDouble1 = 0; bFloat = 0; bFloat1 = 0; bLeftLineUp = 0; brightLineUp = 0; - param = 0; sCellName.Empty(); num.Empty(); + param = -1; sCellName = _T(""); sParamName = _T(""); num = _T(""); } }; @@ -248,6 +248,27 @@ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + + afx_msg void OnHotkey0(); + afx_msg void OnHotkey1(); + afx_msg void OnHotkeyF1(); + afx_msg void OnHotkeyF2(); + afx_msg void OnHotkeyF3(); + afx_msg void OnHotkeyF4(); + afx_msg void OnHotkeyF5(); + afx_msg void OnHotkeyF6(); + afx_msg void OnHotkeyF7(); + afx_msg void OnHotkeyF8(); + afx_msg void OnHotkeyF9(); + afx_msg void OnHotkeyF11(); + afx_msg void OnHotkeyF12(); + + + + afx_msg void OnHotkeyX(); + afx_msg void OnHotkeyY(); + afx_msg void OnHotkeyDelete(); + afx_msg void OnHotkeyInsert(); }; diff --git a/MTerm1/Resource.h b/MTerm1/Resource.h index 483b541..fb6ffd7 100644 --- a/MTerm1/Resource.h +++ b/MTerm1/Resource.h @@ -645,7 +645,50 @@ #define ID_SHOW_LOG 33092 #define ID_33093 33093 #define ID_MENU_SHOWNAV 33094 -#define IDS_STRING101 33101 +#define IDS_STRING101 33100 +#define IDC_BUTTON_AND 33101 +#define IDC_BUTTON_OR 33102 +#define IDC_BUTTON_VLINE 33103 +#define IDC_BUTTON_OUT 33104 +#define IDC_BUTTON_TMCT 33105 +#define IDC_BUTTON_FUN 33106 +#define IDC_BUTTON_HLINE 33107 +#define IDC_BUTTON_NOT 33108 +#define IDC_BUTTON_INDEX 33109 +#define IDC_BUTTON_MC 33110 +#define IDC_BUTTON_MCE 33111 +#define IDC_BUTTON_E 33183 +#define IDC_BUTTON_SET 33201 +#define IDC_BUTTON_RESET 33202 +#define IDC_BUTTON_DF 33203 +#define IDC_BUTTON_END 33204 +#define IDC_BUTTON_COMPARE 33205 +#define IDC_BUTTON_PFUN 33206 +#define IDC_BUTTON_UPDOWN 33207 +#define IDC_BUTTON_BIT 33208 +#define IDC_BUTTON_WORD 33209 +#define IDC_BUTTON_INSTRUCTION1 33210 +#define IDC_BUTTON_INSTRUCTION2 33211 +#define IDC_BUTTON_PGCONVERT 33301 +#define IDC_BUTTON_ONLINE 33302 +#define IDC_BUTTON_OFFLINE 33303 +#define IDC_BUTTON_COLSE 33304 +#define IDC_BUTTON_FIND 33305 +#define IDC_BUTTON_NEXTWIN 33306 +#define IDC_BUTTON_MONITOR 33307 +#define IDC_BUTTON_STATUS 33308 +#define IDC_BUTTON_RUNPROG 33309 +#define IDC_BUTTON_PLCREAD 33310 +#define IDC_BUTTON_PLCWRITE 33311 +#define IDC_BUTTON_X 33401 +#define IDC_BUTTON_Y 33402 +#define IDC_BUTTON_R 33403 +#define IDC_BUTTON_L 33404 +#define IDC_BUTTON_P 33405 +#define IDC_BUTTON_COMPARE1 33406 +#define IDC_BUTTON_NOT1 33408 +#define IDC_BUTTON_T 33501 +#define IDC_BUTTON_C 33502 #define ID_INDICATOR_SEL_TYPE 59135 #define ID_INDICATOR_MACHINE_TYPE 59142 #define ID_INDICATOR_PROGRAM_POS 59143 @@ -660,7 +703,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 359 -#define _APS_NEXT_COMMAND_VALUE 33095 +#define _APS_NEXT_COMMAND_VALUE 33185 #define _APS_NEXT_CONTROL_VALUE 1087 #define _APS_NEXT_SYMED_VALUE 319 #endif -- Gitblit v1.9.1