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.其他关联修改

---
 MTerm2/MTerm2View.cpp |   82 +++++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/MTerm2/MTerm2View.cpp b/MTerm2/MTerm2View.cpp
index 067a778..ac169e9 100644
--- a/MTerm2/MTerm2View.cpp
+++ b/MTerm2/MTerm2View.cpp
@@ -196,8 +196,8 @@
 	xform1.eM12 = 0;
 	xform1.eM21 = 0;
 	xform1.eM22 = 1;
-	xform1.eDx = -scroll1.x;
-	xform1.eDy = -scroll1.y;
+	xform1.eDx = float(-scroll1.x);
+	xform1.eDy = float(-scroll1.y);
 
 	XFORM xform2 = { 1, 0, 0, 1, 0, 0 };
 
@@ -1192,8 +1192,8 @@
 	s1.Format(_T("LD db Clk %d %d  %02X  Scroll %d %d  Total %d %d Row %d Col %d"),
 		point.x, point.y, nFlags, scroll1.x, scroll1.y, tx, ty, nRow, nCol);
 	m_pStatusBar->SetPaneText(6, s1);
-	m_pStatusBar->SetPaneBackgroundColor(6, RGB(255, 255, 0));
-	m_pStatusBar->SetPaneTextColor(6, RGB(0, 0, 255));
+//	m_pStatusBar->SetPaneBackgroundColor(6, RGB(255, 255, 0));
+//	m_pStatusBar->SetPaneTextColor(6, RGB(0, 0, 255));
 //	m_pStatusBar->EnablePaneProgressBar(6);
 //	m_pStatusBar->SetPaneProgress(6, 5);
 	SysLog(s1);
@@ -1429,13 +1429,14 @@
 	s1.Format(_T("Insert Blank Line"));
 	SysLog(s1);
 	m_FocusRow;
+	//褰撳墠琛屼箣鍚庣殑鎵�鏈夛紝涓嬬Щ涓�琛�
 	for (int i = m_nTotalRow - 1; i >= m_FocusRow; i--) {
 		for (int j = 0; j < m_CellPerLine; j++) {
 			Cells[i + 1][j] = Cells[i][j];
 		}
 	}
 	m_nTotalRow += 1;
-		
+	// 褰撳墠琛岀伆鑹�	
 	for (int j = 0; j < m_CellPerLine; j++)	{
 		Cells[m_FocusRow][j].clear();
 		Cells[m_FocusRow][j].bEditing = 1;
@@ -1445,11 +1446,45 @@
 			Cells[m_FocusRow][j].bLeftLineDn = 1;
 		}
 	}
+
+	// 褰撳墠琛� 鍔犲叆 瑙︾偣
+//	m_FocusCol;
+//	Cells[m_FocusRow][0].nType= typeNO;
+//	Cells[m_FocusRow][0].nDataType = KLCoilTypeX;
+//	Cells[m_FocusRow][0].nDataAddr = 15;
+//	Cells[m_FocusRow][0].sCoilName = "ABCDEFG";
+
 	m_bModified = 1;
 	needReDraw = 1;
 	this->RedrawWindow();
 }
+int FindTypeIndex(CString str[], CString strType, int num)
+{
+	for (int i = 0;i < num;i++)
+	{
+		if (strType == str[i])
+		{
+			return i;
+		}
+	}
+	return -1;
+}
 
+void CMTerm2View::GetIncToView(stCell cell1)               //**************************************************************************************************//
+{
+
+
+	Cells[m_FocusRow][m_FocusCol] = cell1;
+
+	m_bModified = 1;
+	needReDraw = 1;
+	m_FocusCol += 1;
+	if (m_FocusCol >= 16) 
+	{ m_FocusCol = 0;m_FocusRow += 1; }
+	
+	this->RedrawWindow();
+	
+}
 void CMTerm2View::OnUpdateInsertBlankLine(CCmdUI *pCmdUI)
 {
 	// TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜
@@ -1535,17 +1570,17 @@
 		if (!pDoc->m_bOnline) {
 			s1 = _T("绂荤嚎");
 			m_pStatusBar->SetPaneText(idxOnline, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxOnline);
+//			m_pStatusBar->SetPaneBackgroundColor(idxOnline);
 		}
 		else if (pDoc->m_bOnline) {
 			if (pDoc->m_bSimulate)	{
 				s1 = _T("鍦ㄧ嚎(浠跨湡)");
 				m_pStatusBar->SetPaneText(2, s1);
-				m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor);
+//				m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor);
 			}else{
 				s1 = _T("鍦ㄧ嚎");
 				m_pStatusBar->SetPaneText(2, s1);
-				m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor);
+//				m_pStatusBar->SetPaneBackgroundColor(idxOnline, OnlineColor);
 			}
 		}
 	}
@@ -1553,20 +1588,20 @@
 		if (!pDoc->m_bOnline)		{
 			s1 = _T("");
 			m_pStatusBar->SetPaneText(idxRunning, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxRunning);
-			m_pStatusBar->SetPaneWidth(idxRunning, 0);
+//			m_pStatusBar->SetPaneBackgroundColor(idxRunning);
+//			m_pStatusBar->SetPaneWidth(idxRunning, 0);
 			m_pStatusBar->SetPaneStyle(idxRunning, SBPS_DISABLED);
 
 		}else if (!pDoc->m_bPlcRunning) {
 			s1 = _T("PROG");
 			m_pStatusBar->SetPaneText(idxRunning, s1);
-			m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength()*8);
-			m_pStatusBar->SetPaneBackgroundColor(idxRunning, ProgColor);
+//			m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength()*8);
+//			m_pStatusBar->SetPaneBackgroundColor(idxRunning, ProgColor);
 		}else {
 			s1 = _T("RUN");
 			m_pStatusBar->SetPaneText(idxRunning, s1);
-			m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength() * 8);
-			m_pStatusBar->SetPaneBackgroundColor(idxRunning, RunningColor);
+//			m_pStatusBar->SetPaneWidth(idxRunning, s1.GetLength() * 8);
+//			m_pStatusBar->SetPaneBackgroundColor(idxRunning, RunningColor);
 		}
 	}
 	if (nIndex == idxMonitor || nIndex == -1) { // 鐩戞帶 //
@@ -1574,11 +1609,11 @@
 		if (!m_bMonitoring) {
 			s1 = _T("[鐩戞帶鍋滄]");
 			m_pStatusBar->SetPaneText(idxMonitor, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxMonitor);
+//			m_pStatusBar->SetPaneBackgroundColor(idxMonitor);
 		}else{
 			s1 = _T("[姝e湪鐩戞帶]");
 			m_pStatusBar->SetPaneText(idxMonitor, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxMonitor, MonitorColor);
+//			m_pStatusBar->SetPaneBackgroundColor(idxMonitor, MonitorColor);
 		}
 	}
 	if (nIndex == idxAddress || nIndex == -1) { // 鍦板潃锛屾湰绔�
@@ -1586,11 +1621,11 @@
 		if (!pDoc->m_bOnline) {
 			s1 = _T("鏈珯");
 			m_pStatusBar->SetPaneText(idxAddress, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxMonitor);
+//			m_pStatusBar->SetPaneBackgroundColor(idxMonitor);
 		}else {
 			s1 = _T("鏈珯");
 			m_pStatusBar->SetPaneText(idxAddress, s1);
-			m_pStatusBar->SetPaneBackgroundColor(idxMonitor, AddressColor);
+//			m_pStatusBar->SetPaneBackgroundColor(idxMonitor, AddressColor);
 		}
 
 	}
@@ -1659,12 +1694,12 @@
 	if (pDoc->m_bPlcRunning) {
 		s1 = _T("杩愯");
 		m_pStatusBar->SetPaneText(3, s1);
-		m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0));
+//		m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0));
 	}
 	else {
 		s1 = _T("鍋滄");
 		m_pStatusBar->SetPaneText(3, s1);
-		m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0));
+//		m_pStatusBar->SetPaneTextColor(3, RGB(0, 0, 0));
 	}
 	s1.Format(_T("PCmdUI %d %d"), pCmdUI->m_nID, pCmdUI->m_nIndex);
 	DbgLog(s1);
@@ -2385,7 +2420,7 @@
 			Progsec += thisprogsec;
 		}
 		DbgLog(_T("\r\n")+ sProg);
-		int n = Progsec.Progs.size();
+		int n = int(Progsec.Progs.size());
 		s1.Format(_T("progSec steps %d "), n);
 		DbgLog(s1);
 		for (int i = 0; i < n; i++) {
@@ -2402,7 +2437,7 @@
 		allprogs += Progsec;
 	}
 	//杈撳嚭绋嬪簭
-	int n=allprogs.Progs.size();
+	int n=(int)allprogs.Progs.size();
 	s1.Format(_T("all prog steps %d "), n);
 	DbgLog(s1);
 	for (int i = 0; i < n; i++)	{
@@ -2414,7 +2449,7 @@
 		OpTxt = OpTxtA;
 		OpShowTxt = OpShowTxtA;
 		s1.Format(_T("%d %s %s"), optype, OpTxt, OpShowTxt);
-		DbgLog(s1);
+//		DbgLog(s1);
 	}
 	return 0;
 }
@@ -2722,3 +2757,4 @@
 	}
 	return 0;
 }
+

--
Gitblit v1.9.1