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/MTerm1View.h | 58 ++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 36 insertions(+), 22 deletions(-) diff --git a/MTerm1/MTerm1View.h b/MTerm1/MTerm1View.h index 85053dc..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 @@ -42,13 +43,14 @@ typePN=15, //涓嬮檷娌� typeNOT=16, typeDF = 17, + typeDF_ = 18, typeOUT=19, typeSET=20, typeRESET=21, typeCMP, - typeExt1, //琚墠闈㈢殑鎸囦护鍗犵敤鐨勭┖闂� + typeExt1, //23 0x17 //琚墠闈㈢殑鎸囦护鍗犵敤鐨勭┖闂� typeExt2, typeExt3, @@ -62,28 +64,28 @@ }; struct stCell { - int nType; - int nProgStep; - int bFocused = 0; - int bSelected = 0; - int bEditing = 0; - int bModified = 0; + int nType; //鍗曞厓绫诲瀷銆� + int nProgStep; //瀵瑰簲绋嬪簭鐨勬鏁� + int bFocused = 0; //鐑偣閫変腑 + int bSelected = 0; //閫変腑 + int bEditing = 0; //缂栬緫涓� + int bModified = 0; //琚慨鏀逛簡 - int bErrFocus = 0; + int bErrFocus = 0; //閿欒鐑偣 - int bLeftLineUp = 0; - int bLeftLineDn = 0; - int nStat = 0; - int nTrace = 0; - int nDataWidth = 0; - int nDataType=0; - int nDataAddr=0; - CString sParam; - CString sCoilName; + int bLeftLineUp = 0; //宸︿晶鍚戜笂绔栫嚎 + int bLeftLineDn = 0; //宸︿晶鍚戜笅绔栫嚎 + int nStat = 0; //褰撳墠鐘舵��// 鐩戞帶鏃舵牴鎹姸鎬侊紝鏄剧ず鏁板�兼垨鑹插潡 + int nTrace = 0; //褰撳墠璺熻釜鐘舵�� +// int nDataWidth = 0; + int nDataType=0; //鍙傛暟鏁版嵁绫诲瀷 + int nDataAddr=0; //鍙傛暟鏁版嵁鍦板潃/鍊� + CString sParam; //鍙傛暟鍚� + CString sCoilName; //绾垮湀鍚� void clear() { nType = 0; bFocused = 0; bSelected = 0; bEditing = 0; bModified = 0; bLeftLineUp = 0; bLeftLineDn = 0; nStat = 0; - nDataWidth = 0; nDataType = 0; nDataAddr = 0; + nDataType = 0; nDataAddr = 0; sParam.Empty(); sCoilName.Empty(); } }; @@ -123,14 +125,15 @@ int m_TopMargin = 0; int m_LeftMargin = 54; //宸︿晶杈硅窛 int m_CellPerLine = 16; //姣忚鍗曞厓鏁� - int m_CellWidth = 64; //鍗曞厓瀹藉害 + int m_CellWidth = 64; //鍗曞厓瀹藉害 int m_CellHeight = 28; //鍗曞厓楂樺害 int m_CommentHeight = 32; //娉ㄩ噴楂樺害 int m_LinePosY = 20; //鍏冧欢鏄剧ず浣嶇疆 - int m_FocusRow = 0; //鐒︾偣琛屽垪浣嶇疆 + int m_FocusRow = 0; //鐒︾偣琛屽垪浣嶇疆 int m_FocusCol = 0; + int m_oldFocusRow = 0; int m_oldFocusCol = 0; int m_nCurProgStep = 0; @@ -197,6 +200,10 @@ void DrawCell(CDC* pDC, int nRow, int nCol); int TransProgToLDS(); + + /// <summary> + /// Flag::鏄惁闇�瑕侀噸缁樿鍥撅紝榛樿涓�1=>true + /// </summary> int needReDraw = 1; int DoReDraw(); @@ -206,6 +213,9 @@ int ScrollCellIntoView(int nRow, int nCol); int isCellInView(int nRow, int nCol); + int CellFocusChg(int nRow, int nCol); + + std::pair<int, CString> CMTerm1View::LDSCheckRule(); // 閲嶅啓 public: @@ -281,8 +291,12 @@ afx_msg void OnInputIoComment(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); int ScanLDSCells(int nStartLine, int nEndLine, int nPosY, int nPosX, int nLevel, stProgSection & progsec, CString & sProgSec, int &nSteps); - void GetIncToView(stCell cell1); - + 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 + }; #ifndef _DEBUG // MultiTerminal2View.cpp 涓殑璋冭瘯鐗堟湰 -- Gitblit v1.9.1