From 61deef5cdf96cbfdd6ad45be49e80d597c00ca65 Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期二, 24 十二月 2024 08:37:21 +0800
Subject: [PATCH] 2024-12-24

---
 MTerm1/MTerm1BnlView.cpp |  200 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 169 insertions(+), 31 deletions(-)

diff --git a/MTerm1/MTerm1BnlView.cpp b/MTerm1/MTerm1BnlView.cpp
index 0a8e578..90a6239 100644
--- a/MTerm1/MTerm1BnlView.cpp
+++ b/MTerm1/MTerm1BnlView.cpp
@@ -5,12 +5,14 @@
 #include "MTerm1.h"
 #include "MTerm1BnlView.h"
 #include "MTerm1Doc.h"
+#include "ChildFrm.h"
 
 // CMTerm1BnlView
 
-IMPLEMENT_DYNCREATE(CMTerm1BnlView, CEditView)
+IMPLEMENT_DYNCREATE(CMTerm1BnlView, CFormView)
 
 CMTerm1BnlView::CMTerm1BnlView()
+	: CFormView(IDD_MTerm1BnlView)
 {
 
 }
@@ -19,24 +21,41 @@
 {
 }
 
+void CMTerm1BnlView::DoDataExchange(CDataExchange* pDX)
+{
+	CFormView::DoDataExchange(pDX);
+}
 
-BEGIN_MESSAGE_MAP(CMTerm1BnlView, CEditView)
+BEGIN_MESSAGE_MAP(CMTerm1BnlView, CFormView)
+	ON_BN_CLICKED(IDC_BUTTON_LOAD, &CMTerm1BnlView::OnBnClickedButtonLoad)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE, &CMTerm1BnlView::OnBnClickedButtonSave)
+	ON_BN_CLICKED(ID_PROG_CONVERT, &CMTerm1BnlView::OnBnClickedButtonConvert)
+	ON_BN_CLICKED(IDC_BUTTON_CONVERT, &CMTerm1BnlView::OnBnClickedButtonConvert)
+	ON_BN_CLICKED(IDC_BUTTON_TRNS_TOTXT, &CMTerm1BnlView::OnBnClickedButtonTrnsTotxt)
+	ON_BN_CLICKED(IDC_BUTTON_TRNS_PRG, &CMTerm1BnlView::OnBnClickedButtonTrnsPrg)
+	ON_BN_CLICKED(IDC_BUTTON4, &CMTerm1BnlView::OnBnClickedButton4)
+	ON_WM_SIZE()
+
 END_MESSAGE_MAP()
+
+// CMTerm1BnlView 璇婃柇
+
+#ifdef _DEBUG
+void CMTerm1BnlView::AssertValid() const
+{
+	CFormView::AssertValid();
+}
+
+#ifndef _WIN32_WCE
+void CMTerm1BnlView::Dump(CDumpContext& dc) const
+{
+	CFormView::Dump(dc);
+}
+#endif
+#endif //_DEBUG
 
 
 // CMTerm1BnlView 缁樺浘
-
-void CMTerm1BnlView::OnInitialUpdate()
-{
-	CEditView::OnInitialUpdate();
-	CMTerm1Doc * pDoc = (CMTerm1Doc *)GetDocument();
-	pDoc->ProgTxt;
-//	CSize sizeTotal;
-//	// TODO:  璁$畻姝よ鍥剧殑鍚堣澶у皬
-//	sizeTotal.cx = sizeTotal.cy = 100;
-//	SetScrollSizes(MM_TEXT, sizeTotal);
-}
-
 void CMTerm1BnlView::OnDraw(CDC* pDC)
 {
 	CDocument* pDoc = GetDocument();
@@ -44,21 +63,140 @@
 }
 
 
-// CMTerm1BnlView 璇婃柇
-
-#ifdef _DEBUG
-void CMTerm1BnlView::AssertValid() const
-{
-	CEditView::AssertValid();
-}
-
-#ifndef _WIN32_WCE
-void CMTerm1BnlView::Dump(CDumpContext& dc) const
-{
-	CEditView::Dump(dc);
-}
-#endif
-#endif //_DEBUG
-
-
 // CMTerm1BnlView 娑堟伅澶勭悊绋嬪簭
+
+void CMTerm1BnlView::OnInitialUpdate()
+{
+	CFormView::OnInitialUpdate();
+	// TODO: 鍦ㄦ娣诲姞涓撶敤浠g爜鍜�/鎴栬皟鐢ㄥ熀绫�
+	m_pStatusBar = ((CChildFrame*)GetParentFrame())->GetStatusBar();
+	ResizeParentToFit();
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	this->GetParentFrame()->SetWindowText(pDoc->GetTitle());
+	CString s1;
+	CStringA s1A;
+	pDoc->TransToTxt(s1A);
+	s1 = s1A;
+	SetDlgItemText(IDC_EDIT1, s1);
+}
+
+
+void CMTerm1BnlView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* /*pHint*/)
+{
+	// TODO: 鍦ㄦ娣诲姞涓撶敤浠g爜鍜�/鎴栬皟鐢ㄥ熀绫�
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	CStringA s1A;
+	pDoc->TransToTxt(s1A);
+	CString s1;
+	s1 = s1A;
+	SetDlgItemText(IDC_EDIT1, s1);
+	((CEdit*)GetDlgItem(IDC_EDIT1))->SetSel((int)lHint, (int)lHint + 1);
+}
+
+
+void CMTerm1BnlView::OnBnClickedButtonLoad()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	CFileDialog dialog1(true);
+	INT_PTR r = dialog1.DoModal();
+	if (r == IDOK)
+	{
+		CString sFilePathName = dialog1.GetFileName();
+		pDoc->LoadFromFile(sFilePathName);
+		//		pDoc->UpdateAllViews(NULL);
+	}
+}
+
+
+void CMTerm1BnlView::OnBnClickedButtonSave()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CString s1;
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	//	pDoc->DoFileSave();
+}
+
+
+void CMTerm1BnlView::OnBnClickedButtonConvert()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	CString s1;
+	CStringA s1A;
+	GetDlgItemText(IDC_EDIT1, s1);
+	s1A = s1;
+	pDoc->TransTxtToProg(s1A);
+	pDoc->TransToTxt(s1A);
+	s1 = s1A;
+	SetDlgItemText(IDC_EDIT1, s1);
+	pDoc->UpdateAllViews(this);
+}
+
+
+void CMTerm1BnlView::OnBnClickedButtonTrnsTotxt()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	CStringA s1A;
+	pDoc->TransToTxt(s1A);
+	CString s1;
+	s1 = s1A;
+	//	AnsiToT(s1A, s1);
+	SetDlgItemText(IDC_EDIT1, s1);
+
+}
+
+
+void CMTerm1BnlView::OnBnClickedButtonTrnsPrg()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	CString s1;
+	CStringA s1A;
+	GetDlgItemText(IDC_EDIT1, s1);
+	s1A = s1;
+	pDoc->TransFileToProg(s1A);
+	pDoc->UpdateAllViews(this);
+	//	AnsiToT(s1A, s1);
+
+}
+
+
+
+void CMTerm1BnlView::OnBnClickedButton4()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
+	theApp.MyKLink1.fnTest1(2);
+
+	CRect rect1;
+	this->GetClientRect(&rect1);
+	//	this->GetParentFrame()->SetWindowPos(NULL, rect1.left, rect1.top, 100, 200, SWP_NOZORDER);
+
+}
+
+
+void CMTerm1BnlView::OnSize(UINT nType, int cx, int cy)
+{
+	CFormView::OnSize(nType, cx, cy);
+	CString s1;
+	CWnd* pwnd;
+	///*
+	pwnd = GetDlgItem(IDC_EDIT1);
+	if (pwnd != NULL)
+	{
+		CRect	rect1;
+		pwnd->GetWindowRect(rect1);
+		ScreenToClient(rect1);
+
+		pwnd->SetWindowPos(NULL, 0, 0, rect1.Width(), cy - 20, NULL);
+		//		s1.Format(_T("OnSize %d  %d %d \r\n"), nType, cx, cy);
+		//((CEdit*)GetDlgItem(IDC_EDIT1))->ReplaceSel(s1);
+
+	}
+	// */
+	// 
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+
+}

--
Gitblit v1.9.1