| | |
| | |
|
| | | #include <memory>
|
| | | #include <vector>
|
| | | #include <stack>
|
| | |
|
| | | #include "MTerm1Doc.h"
|
| | | class CMTerm1View : public CScrollView
|
| | |
| | | typePN=15, //下降沿
|
| | | typeNOT=16,
|
| | | typeDF = 17,
|
| | |
|
| | | typeDF_ = 18,
|
| | | typeOUT=19,
|
| | | typeSET=20,
|
| | | typeRESET=21,
|
| | |
|
| | | typeCMP,
|
| | | typeExt1, //被前面的指令占用的空间
|
| | | typeExt1, //23 0x17 //被前面的指令占用的空间
|
| | | typeExt2,
|
| | | typeExt3,
|
| | |
|
| | |
| | | };
|
| | | 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();
|
| | | }
|
| | | };
|
| | |
| | | return 0;
|
| | | }
|
| | | };
|
| | | std::pair<int, int> popsPoint[100];
|
| | | |
| | | int nPSHS = -1;
|
| | | bool firstCoil = true;//本段第一个单元格
|
| | |
|
| | | bool isPops = false;
|
| | | int m_nTotalRow=0;
|
| | | bool m_bMonitoring = false; //监控中
|
| | | bool m_bShowComments = true; //显示注释
|
| | |
| | | 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;
|
| | |
| | |
|
| | | void DrawCell(CDC* pDC, int nRow, int nCol);
|
| | | int TransProgToLDS();
|
| | |
|
| | | /// <summary>
|
| | | /// Flag::是否需要重绘视图,默认为1=>true
|
| | | /// </summary>
|
| | | int needReDraw = 1;
|
| | |
|
| | | int DoReDraw();
|
| | |
| | |
|
| | | 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:
|
| | |
| | | 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 中的调试版本
|