QuakeGod
2023-09-12 78e91efc666606328e3fc63fbd54eb2da4442799
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// MTerm1CtrlView.cpp: 实现文件
//
 
#include "pch.h"
#include "MTerm1.h"
#include "MTerm1CtrlView.h"
#include "MTerm1Doc.h"
#include "ChildFrm.h"
#include "../MyLib/Functions.hpp"
// CMTerm1CtrlView
 
IMPLEMENT_DYNCREATE(CMTerm1CtrlView, CFormView)
 
CMTerm1CtrlView::CMTerm1CtrlView()
    : CFormView(IDD_MTerm1CtrlView)
{
 
}
 
CMTerm1CtrlView::~CMTerm1CtrlView()
{
}
 
void CMTerm1CtrlView::DoDataExchange(CDataExchange* pDX)
{
    CFormView::DoDataExchange(pDX);
}
 
BEGIN_MESSAGE_MAP(CMTerm1CtrlView, CFormView)
    ON_BN_CLICKED(IDC_BUTTON_LOAD, &CMTerm1CtrlView::OnBnClickedButtonLoad)
    ON_BN_CLICKED(IDC_BUTTON_SAVE, &CMTerm1CtrlView::OnBnClickedButtonSave)
    ON_BN_CLICKED(ID_PROG_CONVERT, &CMTerm1CtrlView::OnBnClickedButtonConvert)
    ON_BN_CLICKED(IDC_BUTTON_CONVERT, &CMTerm1CtrlView::OnBnClickedButtonConvert)
    ON_BN_CLICKED(IDC_BUTTON_TRNS_TOTXT, &CMTerm1CtrlView::OnBnClickedButtonTrnsTotxt)
    ON_BN_CLICKED(IDC_BUTTON_TRNS_PRG, &CMTerm1CtrlView::OnBnClickedButtonTrnsPrg)
    ON_BN_CLICKED(IDC_BUTTON4, &CMTerm1CtrlView::OnBnClickedButton4)
END_MESSAGE_MAP()
 
 
// CMTerm1CtrlView 诊断
 
#ifdef _DEBUG
void CMTerm1CtrlView::AssertValid() const
{
    CFormView::AssertValid();
}
 
#ifndef _WIN32_WCE
void CMTerm1CtrlView::Dump(CDumpContext& dc) const
{
    CFormView::Dump(dc);
}
#endif
#endif //_DEBUG
 
 
// CMTerm1CtrlView 消息处理程序
 
void CMTerm1CtrlView::OnInitialUpdate()
{
    CFormView::OnInitialUpdate();
    // TODO: 在此添加专用代码和/或调用基类
    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 CMTerm1CtrlView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* /*pHint*/)
{
    // TODO: 在此添加专用代码和/或调用基类
    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 CMTerm1CtrlView::OnBnClickedButtonLoad()
{
    // TODO: 在此添加控件通知处理程序代码
    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 CMTerm1CtrlView::OnBnClickedButtonSave()
{
    // TODO: 在此添加控件通知处理程序代码
    CString s1;
    CMTerm1Doc * pDoc = (CMTerm1Doc *)GetDocument();
//    pDoc->DoFileSave();
}
 
 
void CMTerm1CtrlView::OnBnClickedButtonConvert()
{
    // TODO: 在此添加控件通知处理程序代码
    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 CMTerm1CtrlView::OnBnClickedButtonTrnsTotxt()
{
    // TODO: 在此添加控件通知处理程序代码
    CMTerm1Doc * pDoc = (CMTerm1Doc *)GetDocument();
    CStringA s1A;
    pDoc->TransToTxt(s1A);
    CString s1;
    s1 = s1A;
//    AnsiToT(s1A, s1);
    SetDlgItemText(IDC_EDIT1, s1);
 
}
 
 
void CMTerm1CtrlView::OnBnClickedButtonTrnsPrg()
{
    // TODO: 在此添加控件通知处理程序代码
    CMTerm1Doc * pDoc = (CMTerm1Doc *)GetDocument();
    CString s1;
    CStringA s1A;
    GetDlgItemText(IDC_EDIT1, s1);
    s1A = s1;
    pDoc->TransFileToProg(s1A);
    pDoc->UpdateAllViews(this);
    //    AnsiToT(s1A, s1);
 
}
 
 
 
void CMTerm1CtrlView::OnBnClickedButton4()
{
    // TODO: 在此添加控件通知处理程序代码
    CMTerm1Doc * pDoc = (CMTerm1Doc *)GetDocument();
    pDoc->MyKLink1.fnTest1(2);
 
    CRect rect1;
    this->GetClientRect(&rect1);
//    this->GetParentFrame()->SetWindowPos(NULL, rect1.left, rect1.top, 100, 200, SWP_NOZORDER);
 
}