zxd
2023-09-14 d34256830982fb9ea822c1e9b874c3b7fa0a614d
提交 | 用户 | age
df0321 1 // MyFormLog.cpp : 实现文件
Q 2 //
3
4 #include "pch.h"
5 #include "MTerm1.h"
6 #include "MyFormInputShow.h"
7
8 #include "MainFrm.h"
d34256 9
df0321 10
Q 11 // CMyFormLog
12 structButton myButtons[6][3][11] =
13 {
14     {{33101,_T("-|  |-"), 33102,_T("└┤├┘") ,33103,_T("|"), 33104,_T("-[OUT]") ,33105,_T("TM/CT") ,33106,_T("Fun") ,33107,_T("——") ,33108,_T("NOT/") ,33109,_T("INDEX") ,33110,_T("(MC)") ,33111,_T("(MCE)") },
15     {33201,_T("-<SET>-"), 33202,_T("-<RESET>") ,33203,_T("(DF(/))"), 33204,_T("(END)") ,33205,_T("比较") ,33206,_T("PFun") ,33207,_T("↑↓") ,33208,_T("[位]") ,33209,_T("[字]") ,33210,_T("指令1") ,33211,_T("指令2") },
16     {33301,_T("PG转换"), 33302,_T("在线") ,33303,_T("离线"), 33304,_T("关闭") ,33305,_T("查找") ,33306,_T("次Win") ,33307,_T("监控Go") ,33308,_T("状态") ,33309,_T("Run/Prog") ,33310,_T("PLC读取") ,33311,_T("PLC写入") } },
17
18     {{33401,_T("X"), 33402,_T("Y") ,33403,_T("R"), 33404,_T("L") ,33405,_T("P") ,33406,_T("比较") ,33407,_T("") ,33408,_T("NOT/") ,33409,_T("INDEX") ,33410,_T("No.清除") ,33411,_T("") },
19     {33501,_T("T"), 33502,_T("C") ,33503,_T("E"), 33504,_T("") ,33505,_T("") ,33506,_T("") ,33507,_T("↑↓") ,33508,_T("") ,33509,_T("") ,33510,_T("") ,33511,_T("") },
20     {33601,_T(""), 33602,_T("") ,33603,_T(""), 33604,_T("") ,33605,_T("") ,33606,_T("") ,33607,_T("") ,33608,_T("") ,33609,_T("") ,33610,_T("") ,33611,_T("") }},
21
22     {{33701,_T("D"), 33702,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,33706,_T("=") ,33707,_T(">") ,33708,_T("<") ,33709,_T("") ,33710,_T("") ,33711,_T("") },
23     {33801,_T(""), 33802,_T("") ,33803,_T(""), 33804,_T("") ,33805,_T("") ,33806,_T("") ,33807,_T("") ,33808,_T("") ,33809,_T("") ,33810,_T("") ,33811,_T("") },
24     {33901,_T(""), 33902,_T("") ,33903,_T(""), 33904,_T("") ,33905,_T("") ,33906,_T("") ,33907,_T("") ,33908,_T("") ,33909,_T("") ,33910,_T("") ,33911,_T("") }},
25
26     {{34101,_T("WX"), 34102,_T("WY") ,34103,_T("WR"), 34104,_T("WL") ,34105,_T("DT") ,34106,_T("LD") ,34107,_T("FL") ,34108,_T("") ,34109,_T("INDEX") ,34110,_T("No.清除") ,34111,_T("") },
27     {34201,_T("SV"), 34202,_T("EV") ,34203,_T("K"), 34204,_T("H") ,34205,_T("M") ,34206,_T("f") ,34207,_T("") ,34208,_T("") ,34209,_T("") ,34210,_T("") ,34211,_T("") },
28     {34301,_T("PG转换"), 34302,_T("") ,34303,_T(""), 34304,_T("") ,34305,_T("") ,34306,_T("") ,34307,_T("") ,34308,_T("") ,34309,_T("") ,34310,_T("") ,34311,_T("") }},
29
30     {{34401,_T("IX(I0)"), 34402,_T("IY(I1)") ,34403,_T("I2"), 34404,_T("I3") ,34405,_T("I4") ,34406,_T("I5") ,34407,_T("I6") ,34408,_T("I7") ,34409,_T("I8") ,34410,_T("") ,34411,_T("") },
31     {34501,_T("I9"), 34502,_T("IA") ,34503,_T("IB"), 34504,_T("IC") ,34505,_T("ID") ,34506,_T("") ,34507,_T("↑↓") ,34508,_T("") ,34509,_T("") ,34510,_T("") ,34511,_T("") },
32     {34601,_T(""), 34602,_T("") ,34603,_T(""), 34604,_T("") ,34605,_T("") ,34606,_T("") ,34607,_T("") ,34608,_T("") ,34609,_T("") ,34610,_T("") ,34611,_T("") }},
33
34     {{34701,_T("TMX"), 34702,_T("TMY") ,34703,_T("TMR"), 34704,_T("TML") ,34705,_T("") ,34706,_T("-[CT]-") ,34707,_T("") ,34708,_T("") ,34709,_T("INDEX") ,34710,_T("") ,34711,_T("") },
35     {34801,_T(""), 34802,_T("") ,34803,_T(""), 34804,_T("") ,34805,_T("") ,34806,_T("") ,34807,_T("") ,34808,_T("") ,34809,_T("") ,34810,_T("") ,34811,_T("") },
36     {34901,_T(""), 34902,_T("") ,34903,_T(""), 34904,_T("") ,34905,_T("") ,34906,_T("") ,34907,_T("") ,34908,_T("") ,34909,_T("") ,3490,_T("") ,34911,_T("") }},
37 };
38
39 static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(structButton);
40
41 structButton myNumButtons[18] =
42 {
43     ID_BUTTON_0,_T("0"), ID_BUTTON_1,_T("1") ,ID_BUTTON_2,_T("2"), ID_BUTTON_3,_T("3") ,ID_BUTTON_4,_T("4") ,ID_BUTTON_5,_T("5") ,ID_BUTTON_6,_T("6") ,ID_BUTTON_7,_T("7") ,
44     ID_BUTTON_8,_T("8") ,ID_BUTTON_9,_T("9") ,ID_BUTTON_A,_T("A"),ID_BUTTON_B,_T("B"),ID_BUTTON_C,_T("C"),ID_BUTTON_D,_T("D"),ID_BUTTON_E,_T("E"),ID_BUTTON_F,_T("F"),
45     ID_BUTTON_MINUS,_T("-"),ID_BUTTON_DOT,_T(".")
46 };
47
48 static int myNumButtonCount = sizeof(myNumButtons) / sizeof(structButton);
49
50 structButton myCmdButtons[4] =
51 {
52     ID_BUTTON_RET, _T("↙"), ID_BUTTON_INSERT, _T("Ins"), ID_BUTTON_DELETE, _T("Del"), ID_BUTTON_ESC, _T("Esc")
53 };
54 static int myCmdButtonCount = sizeof(myCmdButtons) / sizeof(structButton);
55
56
57 IMPLEMENT_DYNCREATE(CMyFormInputShow, CFormView)
58
59 CMyFormInputShow::CMyFormInputShow()
60     : CFormView(CMyFormInputShow::IDD)
61 {
62
63 }
64
65 CMyFormInputShow::~CMyFormInputShow()
66 {
67 }
68
69 void CMyFormInputShow::DoDataExchange(CDataExchange* pDX)
70 {
71     CFormView::DoDataExchange(pDX);
72     DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input);
73 }
74
75 BEGIN_MESSAGE_MAP(CMyFormInputShow, CFormView)
76     ON_WM_CREATE()
77     ON_WM_DESTROY()
78     ON_WM_SIZE()
79     ON_WM_MOUSEACTIVATE()
80     ON_WM_TIMER()
81
82     ON_BN_CLICKED(IDC_BUTTON1, &CMyFormInputShow::OnBnClickedButton1)
83
84     ON_BN_CLICKED(IDC_BUTTON_AND, &CMyFormInputShow::OnBnClickedBtnAnd)
85     ON_BN_CLICKED(IDC_BUTTON_OR, &CMyFormInputShow::OnBnClickedBtnOr)
86     ON_BN_CLICKED(IDC_BUTTON_VLINE, &CMyFormInputShow::OnBnClickedBtnVline)
87     ON_BN_CLICKED(IDC_BUTTON_OUT, &CMyFormInputShow::OnBnClickedBtnOut)
88     ON_BN_CLICKED(IDC_BUTTON_TMCT, &CMyFormInputShow::OnBnClickedBtnTmCt)
89     ON_BN_CLICKED(IDC_BUTTON_FUN, &CMyFormInputShow::OnBnClickedBtnFun)
90     ON_BN_CLICKED(IDC_BUTTON_HLINE, &CMyFormInputShow::OnBnClickedBtnHLine)
91     ON_BN_CLICKED(IDC_BUTTON_NOT, &CMyFormInputShow::OnBnClickedBtnNot)
92     ON_BN_CLICKED(IDC_BUTTON_INDEX, &CMyFormInputShow::OnBnClickedBtnIndex)
93     ON_BN_CLICKED(IDC_BUTTON_MC, &CMyFormInputShow::OnBnClickedBtnMc)
94     ON_BN_CLICKED(IDC_BUTTON_MCE, &CMyFormInputShow::OnBnClickedBtnMce)
95
96     ON_BN_CLICKED(IDC_BUTTON_SET, &CMyFormInputShow::OnBnClickedBtnSet)
97     ON_BN_CLICKED(IDC_BUTTON_RESET, &CMyFormInputShow::OnBnClickedBtnReset)
98     ON_BN_CLICKED(IDC_BUTTON_DF, &CMyFormInputShow::OnBnClickedBtnDf)
99     ON_BN_CLICKED(IDC_BUTTON_END, &CMyFormInputShow::OnBnClickedBtnEnd)
100     ON_BN_CLICKED(IDC_BUTTON_COMPARE, &CMyFormInputShow::OnBnClickedBtnCompare)
101     ON_BN_CLICKED(IDC_BUTTON_PFUN, &CMyFormInputShow::OnBnClickedBtnPFun)
102     ON_BN_CLICKED(IDC_BUTTON_UPDOWN, &CMyFormInputShow::OnBnClickedBtnUpDown)
103     ON_BN_CLICKED(IDC_BUTTON_BIT, &CMyFormInputShow::OnBnClickedBtnBit)
104     ON_BN_CLICKED(IDC_BUTTON_WORD, &CMyFormInputShow::OnBnClickedBtnWord)
105     ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION1, &CMyFormInputShow::OnBnClickedBtnInc1)
106     ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION2, &CMyFormInputShow::OnBnClickedBtnInc2)
107
108     ON_BN_CLICKED(IDC_BUTTON_PGCONVERT, &CMyFormInputShow::OnBnClickedBtnPgConvert)
109     ON_BN_CLICKED(IDC_BUTTON_ONLINE, &CMyFormInputShow::OnBnClickedBtnOnline)
110     ON_BN_CLICKED(IDC_BUTTON_OFFLINE, &CMyFormInputShow::OnBnClickedBtnOffline)
111     ON_BN_CLICKED(IDC_BUTTON_COLSE, &CMyFormInputShow::OnBnClickedBtnClose)
112     ON_BN_CLICKED(IDC_BUTTON_FIND, &CMyFormInputShow::OnBnClickedBtnFind)
113     ON_BN_CLICKED(IDC_BUTTON_NEXTWIN, &CMyFormInputShow::OnBnClickedBtnNextWin)
114     ON_BN_CLICKED(IDC_BUTTON_MONITOR, &CMyFormInputShow::OnBnClickedBtnMonitor)
115     ON_BN_CLICKED(IDC_BUTTON_STATUS, &CMyFormInputShow::OnBnClickedBtnStatus)
116     ON_BN_CLICKED(IDC_BUTTON_RUNPROG, &CMyFormInputShow::OnBnClickedBtnRunProg)
117     ON_BN_CLICKED(IDC_BUTTON_PLCREAD, &CMyFormInputShow::OnBnClickedBtnPlcRead)
118     ON_BN_CLICKED(IDC_BUTTON_PLCWRITE, &CMyFormInputShow::OnBnClickedBtnPlcWrite)
119
120     ON_BN_CLICKED(IDC_BUTTON_X, &CMyFormInputShow::OnBnClickedBtnX)
121     ON_BN_CLICKED(IDC_BUTTON_Y, &CMyFormInputShow::OnBnClickedBtnY)
122     ON_BN_CLICKED(IDC_BUTTON_R, &CMyFormInputShow::OnBnClickedBtnR)
123     ON_BN_CLICKED(IDC_BUTTON_L, &CMyFormInputShow::OnBnClickedBtnL)
124     ON_BN_CLICKED(IDC_BUTTON_P, &CMyFormInputShow::OnBnClickedBtnP)
125     ON_BN_CLICKED(IDC_BUTTON_COMPARE1, &CMyFormInputShow::OnBnClickedBtnCompare1)
126     ON_BN_CLICKED(IDC_BUTTON_NOT1, &CMyFormInputShow::OnBnClickedBtnNot)
127     ON_BN_CLICKED(IDC_BUTTON_T, &CMyFormInputShow::OnBnClickedBtnT)
128     ON_BN_CLICKED(IDC_BUTTON_C, &CMyFormInputShow::OnBnClickedBtnC)
129     ON_BN_CLICKED(IDC_BUTTON_E, &CMyFormInputShow::OnBnClickedBtnE)
130     ON_BN_CLICKED(IDC_BUTTON_UPDOWN1, &CMyFormInputShow::OnBnClickedBtnUpDown)
131
132     ON_BN_CLICKED(IDC_BUTTON_TMX, &CMyFormInputShow::OnBnClickedBtnTmx)
133     ON_BN_CLICKED(IDC_BUTTON_TMY, &CMyFormInputShow::OnBnClickedBtnTmy)
134     ON_BN_CLICKED(IDC_BUTTON_TMR, &CMyFormInputShow::OnBnClickedBtnTmr)
135     ON_BN_CLICKED(IDC_BUTTON_TML, &CMyFormInputShow::OnBnClickedBtnTml)
136     ON_BN_CLICKED(IDC_BUTTON_CT, &CMyFormInputShow::OnBnClickedBtnCt)
137
138     ON_BN_CLICKED(IDC_BUTTON_D, &CMyFormInputShow::OnBnClickedBtnD)
139     ON_BN_CLICKED(IDC_BUTTON_F, &CMyFormInputShow::OnBnClickedBtnF)
140     ON_BN_CLICKED(IDC_BUTTON_NEQ, &CMyFormInputShow::OnBnClickedBtnNEQ)
141     ON_BN_CLICKED(IDC_BUTTON_GT, &CMyFormInputShow::OnBnClickedBtnGT)
142     ON_BN_CLICKED(IDC_BUTTON_LT, &CMyFormInputShow::OnBnClickedBtnLT)
143
144     ON_BN_CLICKED(ID_BUTTON_0, &CMyFormInputShow::OnBtn0)
145     ON_BN_CLICKED(ID_BUTTON_1, &CMyFormInputShow::OnBtn1)
146     ON_BN_CLICKED(ID_BUTTON_2, &CMyFormInputShow::OnBtn2)
147     ON_BN_CLICKED(ID_BUTTON_3, &CMyFormInputShow::OnBtn3)
148     ON_BN_CLICKED(ID_BUTTON_4, &CMyFormInputShow::OnBtn4)
149     ON_BN_CLICKED(ID_BUTTON_5, &CMyFormInputShow::OnBtn5)
150     ON_BN_CLICKED(ID_BUTTON_6, &CMyFormInputShow::OnBtn6)
151     ON_BN_CLICKED(ID_BUTTON_7, &CMyFormInputShow::OnBtn7)
152     ON_BN_CLICKED(ID_BUTTON_8, &CMyFormInputShow::OnBtn8)
153     ON_BN_CLICKED(ID_BUTTON_9, &CMyFormInputShow::OnBtn9)
154     ON_BN_CLICKED(ID_BUTTON_A, &CMyFormInputShow::OnBtnA)
155     ON_BN_CLICKED(ID_BUTTON_B, &CMyFormInputShow::OnBtnB)
156     ON_BN_CLICKED(ID_BUTTON_C, &CMyFormInputShow::OnBtnC)
157     ON_BN_CLICKED(ID_BUTTON_D, &CMyFormInputShow::OnBtnD)
158     ON_BN_CLICKED(ID_BUTTON_E, &CMyFormInputShow::OnBtnE)
159     ON_BN_CLICKED(ID_BUTTON_F, &CMyFormInputShow::OnBtnF)
160     ON_BN_CLICKED(ID_BUTTON_MINUS, &CMyFormInputShow::OnBtnMinus)
161     ON_BN_CLICKED(ID_BUTTON_DOT, &CMyFormInputShow::OnBtnDot)
162     ON_BN_CLICKED(ID_BUTTON_RET, &CMyFormInputShow::OnBtnRet)
163     ON_BN_CLICKED(ID_BUTTON_INSERT, &CMyFormInputShow::OnBtnInsert)
164     ON_BN_CLICKED(ID_BUTTON_DELETE, &CMyFormInputShow::OnBtnDelete)
165     ON_BN_CLICKED(ID_BUTTON_ESC, &CMyFormInputShow::OnBtnEsc)
166
167
168     ON_WM_CHAR()
169 END_MESSAGE_MAP()
170
171
172 // CMyFormLog 诊断
173
174 #ifdef _DEBUG
175 void CMyFormInputShow::AssertValid() const
176 {
177     CFormView::AssertValid();
178 }
179
180 #ifndef _WIN32_WCE
181 void CMyFormInputShow::Dump(CDumpContext& dc) const
182 {
183     CFormView::Dump(dc);
184 }
185 #endif
186 #endif //_DEBUG
187
188
189 // CMyFormLog 消息处理程序
190
191
192 BOOL CMyFormInputShow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
193 {
194     // TODO: 在此添加专用代码和/或调用基类
195
196     return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
197 }
198
199
200 int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct)
201 {
202     if (CFormView::OnCreate(lpCreateStruct) == -1)
203         return -1;
204
205     // TODO:  在此添加您专用的创建代码
206
207     return 0;
208 }
209
210
211 void CMyFormInputShow::OnDestroy()
212 {
213     CFormView::OnDestroy();
214
215     // TODO: 在此处添加消息处理程序代码
216 }
217
218
219 void CMyFormInputShow::OnSize(UINT nType, int cx, int cy)
220 {
221     CFormView::OnSize(nType, cx, cy);
222     // TODO: 在此处添加消息处理程序代码
223     CWnd * pwnd;
224 /*
225     pwnd=GetDlgItem(IDC_EDIT_LOG);
226     if (pwnd!=NULL)
227     {
228 //        RECT    rect1;
229         pwnd->SetWindowPos(NULL,0,0,cx,cy-20,NULL);
230     }
231 //*/
232
233 /*
234     pwnd = GetDlgItem(IDC_RICHEDIT2_LOG);
235     if (pwnd != NULL)
236     {
237         //        RECT    rect1;
238         pwnd->SetWindowPos(NULL, 0, 0, cx, cy - 20, NULL);
239     }
240     pwnd=GetDlgItem(IDC_CHECK_PAUSE);
241     if (pwnd!=NULL)
242     {
243         //RECT    rect1;
244         CRect rect1;
245         pwnd->GetWindowRect(rect1);
246         ScreenToClient(&rect1);
247         pwnd->SetWindowPos(NULL,0, cy - rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
248     }
249     pwnd=GetDlgItem(IDC_CHECK_NOSCROLL);
250     if (pwnd!=NULL)
251     {
252         CRect rect1;
253         pwnd->GetWindowRect(rect1);
254         ScreenToClient(&rect1);
255         pwnd->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
256     }
257 //*/
258
259 }
260
261
262 void CMyFormInputShow::OnInitialUpdate()
263 {
264     CFormView::OnInitialUpdate();
265 /*
266     CString VersionStr = _T("V1.02");
267     CString BuildStr = _T("20210728");
268     // TODO: 在此添加专用代码和/或调用基类
269     myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm1"), _T("MTerm1"));
270     myLogger1.AttachWnd(m_richedit_log.m_hWnd);
271     myLogger1.bShowLog[0] = 1;
272     myLogger1.bShowThreadId = 0;
273     myLogger1.bShowChannel = 0;
274     myLogger1.bSaveLog[0] = 1;
275     myLogger1.bShowDate = 1;
276     SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n"));
277     myLogger1.bShowDate = 0;
278 //    myLogger1.bShowLineCount=0;
279 //    myLogger1.bShowTime=0;
280     myLogger1.UpdateLogDisplay();
281     SetTimer(1, 100, NULL);
282 */
283
284     CString(s1);
285
286     s1.Format(_T(" MyDlgBarFuncKey Onupdate "));
287     SysLog(s1);
288
289 //    LRESULT bRet = HandleInitDialog(wParam, lParam);
290 //    if (!UpdateData(FALSE))
291 //    {
292 //        TRACE("InitDialogBar Failed!");
293 //    }
294
295     CRect rect0;
296     GetClientRect(&rect0);
297     int nWidth = rect0.Width();
298     int nHeight = rect0.Height();
299     nWidth = 720; // rect0.Width();
300     nHeight = 60;
301     int nTopMargin = 32;
302     s1.Format(_T("Width %d Height %d "), nWidth, nHeight);
303     SysLog(s1);
304     int nLeftMargin = 48;
305
306     int nSpace = nWidth - nLeftMargin;
307     int x1, y1, x2, y2;
308     CRect rect1(0, 20, 300, 40);
309     for (int i = 0; i < myNumButtonCount; i++) {
310         x1 = nLeftMargin * 3 + i * (nSpace - nLeftMargin * 2) / 24;
311         y1 = 2;
312         x2 = x1 + (nSpace - nLeftMargin * 2) / 24 -2;
313         y2 = y1 + nHeight / 3;
314         rect1.SetRect(x1, y1, x2, y2);
315         m_NumButtons[i].Create(myNumButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myNumButtons[i].nID);
316         m_NumButtons[i].ShowWindow(SW_SHOW);
317     }
318
319     for (int i = 0; i < myCmdButtonCount; i++) {
320         x1 = nLeftMargin * 3 + (i +16) * (nSpace - nLeftMargin * 2) / 20;
321         y1 = 2;
322         x2 = x1 + nSpace / 24;
323         y2 = y1 + nHeight / 3;
324         rect1.SetRect(x1, y1, x2, y2);
325         m_CmdButtons[i].Create(myCmdButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myCmdButtons[i].nID);
326         m_CmdButtons[i].ShowWindow(SW_SHOW);
327     }
328     //    font1.CreatePointFont(95, _T("楷体"));
329     for (int i = 0; i < m_Lines; i++) {
330         for (int j = 0; j < 11; j++) {
331             x1 = nLeftMargin + j * nSpace / 11;
332             y1 = nTopMargin + i * nHeight / 3;
333             x2 = x1 + nSpace / 11;
334             y2 = y1 + nHeight / 3;
335             rect1.SetRect(x1, y1, x2, y2);
336             m_buttons[0][i][j].Create(myButtons[0][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[0][i][j].nID);
337             m_buttons[0][i][j].ShowWindow(SW_SHOW);
338             //            init;
339         }
340     }
341     for (int i = 0; i < m_Lines; i++) {
342         for (int j = 0; j < 11; j++) {
343             x1 = nLeftMargin + j * nSpace / 11;
344             y1 = nTopMargin + i * nHeight / 3;
345             x2 = x1 + nSpace / 11;
346             y2 = y1 + nHeight / 3;
347             rect1.SetRect(x1, y1, x2, y2);
348             m_buttons[1][i][j].Create(myButtons[1][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[1][i][j].nID);
349             //            bit;
350         }
351     }
352     for (int i = 0; i < m_Lines; i++) {
353         for (int j = 0; j < 11; j++) {
354             x1 = nLeftMargin + j * nSpace / 11;
355             y1 = nTopMargin + i * nHeight / 3;
356             x2 = x1 + nSpace / 11;
357             y2 = y1 + nHeight / 3;
358             rect1.SetRect(x1, y1, x2, y2);
359             m_buttons[2][i][j].Create(myButtons[2][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[2][i][j].nID);
360             //            compare;
361         }
362     }
363     for (int i = 0; i < m_Lines; i++) {
364         for (int j = 0; j < 11; j++) {
365             x1 = nLeftMargin + j * nSpace / 11;
366             y1 = nTopMargin + i * nHeight / 3;
367             x2 = x1 + nSpace / 11;
368             y2 = y1 + nHeight / 3;
369             rect1.SetRect(x1, y1, x2, y2);
370             m_buttons[3][i][j].Create(myButtons[3][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[3][i][j].nID);
371             //            word;
372         }
373     }
374     for (int i = 0; i < m_Lines; i++) {
375         for (int j = 0; j < 11; j++) {
376             x1 = nLeftMargin + j * nSpace / 11;
377             y1 = nTopMargin + i * nHeight / 3;
378             x2 = x1 + nSpace / 11;
379             y2 = y1 + nHeight / 3;
380             rect1.SetRect(x1, y1, x2, y2);
381             m_buttons[4][i][j].Create(myButtons[4][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[4][i][j].nID);
382             //            index;
383         }
384     }
385     for (int i = 0; i < m_Lines; i++) {
386         for (int j = 0; j < 11; j++) {
387             x1 = nLeftMargin + j * nSpace / 11;
388             y1 = nTopMargin + i * nHeight / 3;
389             x2 = x1 + nSpace / 11;
390             y2 = y1 + nHeight / 3;
391             rect1.SetRect(x1, y1, x2, y2);
392             m_buttons[5][i][j].Create(myButtons[5][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[5][i][j].nID);
393             //            TMCT;
394         }
395     }
396
397     return ;   
398
399 }
400
401
402 int CMyFormInputShow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
403 {
404     // TODO: 在此添加消息处理程序代码和/或调用默认值
405
406     return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message);
407 }
408     
409
410 void CMyFormInputShow::OnTimer(UINT_PTR nIDEvent)
411 {
412     // TODO: 在此添加消息处理程序代码和/或调用默认值
413 /*
414     if (nIDEvent == 1)
415     {
416         KillTimer(1);
417         SetTimer(2, 200, NULL);
418     }
419     else if (nIDEvent == 2)
420     {
421         myLogger1.UpdateLogDisplay();
422     }
423     else
424     {
425
426     }
427 */
428     CFormView::OnTimer(nIDEvent);
429 }
430
431
432 void CMyFormInputShow::OnBnClickedButton1()
433 {
434     // TODO: 在此添加控件通知处理程序代码
435     CString s1;
436     s1.Format(_T("Button1 Clicked"));
437     SysLog(s1);
438 }
439
440 void CMyFormInputShow::SetBtnDisplayESC(int n)
441 {
442     for (int n = 1; n < 5; n++)
443     {
444         for (int i = 0; i < 3; i++) {
445             for (int j = 0; j < 11; j++) {
446                 m_buttons[n][i][j].ShowWindow(SW_HIDE);
447             }
448         }
449     }
450     for (int i = 0; i < 3; i++) {
451         for (int j = 0; j < 11; j++) {
452             m_buttons[0][i][j].ShowWindow(SW_SHOW);
453         }
454     }
455     current_btn_window = 0;
456 }
457
458 void CMyFormInputShow::SetBtnDisplay(int n)
459 {
460
461     for (int i = 0; i < 3; i++) {
d34256 462           for (int j = 0; j < 11; j++) {
df0321 463             m_buttons[current_btn_window][i][j].ShowWindow(SW_HIDE);
d34256 464          }
df0321 465     }
Q 466
467     for (int i = 0; i < 3; i++) {
468         for (int j = 0; j < 11; j++) {
469             m_buttons[n][i][j].ShowWindow(SW_SHOW);
470         }
471     }
472     current_btn_window = n;
473 }
474
475 void CMyFormInputShow::stInit()
476 {
477     m_InputCell =
478     {
479          CMTerm1View::typeNO,
480          false,
481          false,
482          false,
483          false,
484          false,
485          false,
486          false,
487          false,
488          false,
489          false,
490          false,
491          false,
492          0x10,
d34256 493         _T(""),
Z 494         0,
495         0
df0321 496     };
Q 497 }
498
499
500 int CMyFormInputShow::display(tagInputCell stDisplayCell)
501 {
502     static CString strOp, strParam, strNum;
503     static CString str;
504     switch (stDisplayCell.OP)
505     {
506     case CMTerm1View::typeNO:
507         if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
508         {
509             strOp = _T("└┤├┘");
510         }
511         else
512         {
513             strOp = _T("-| |-");
514         }
515
516         break;
517     case CMTerm1View::typeNC:
518         if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
519         {
520             strOp = _T("└┤/├┘");
521         }
522         else
523         {
524             strOp = _T("-|/|-");
525         }
526
527         break;
528     case CMTerm1View::typeOUT:
529         strOp = _T("-[ ]");
530         break;
531     case CMTerm1View::typeSET:
532         strOp = _T("-<S>");
533         break;
534     case CMTerm1View::typeRESET:
535         strOp = _T("-<R>");
536         break;
537     case CMTerm1View::typeDF:
538         strOp = _T("(DF)");
539         break;
540     case CMTerm1View::typeDF_:
541         strOp = _T("(DF/)");
542         break;
543     case CMTerm1View::typeNOT:
544         strOp = _T("-/-");
545         break;
546     case CMTerm1View::typeTM:
547         strOp = _T("-[TM]");
548         break;
549     case CMTerm1View::typeCMP:
550         break;
551     default:
552         break;
553     }
554
555     if (stDisplayCell.bnot)
556     {
557         switch (stDisplayCell.OP)
558         {
559         case CMTerm1View::typeNO:
560             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
561             {
562                 strOp = _T("└┤/├┘");
563             }
564             else
565             {
566                 strOp = _T("-|/|-");
567             }
568             break;
569         case CMTerm1View::typeOUT:
570             strOp = _T("-/-");
571             break;
572         case CMTerm1View::typeSET:
573             strOp = _T("-/-");
574             break;
575         case CMTerm1View::typeRESET:
576             strOp = _T("-/-");
577             break;
578         case CMTerm1View::typeDF:
579             strOp = _T("(DF/)");
580             break;
581         case CMTerm1View::typeDF_:
582             strOp = _T("(DF)");
583             break;
584         case CMTerm1View::typeNOT:
585             strOp = _T("-/-");
586             break;
587         case CMTerm1View::typeTM:
588             strOp = _T("-/-");
589             break;
590         default:
591             break;
592         }
593     }
594     if (stDisplayCell.bpp)
595     {
596         switch (stDisplayCell.OP)
597         {
598         case CMTerm1View::typeNO:
599             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
600             {
601                 strOp = _T("└┤↑├┘");
602             }
603             else
604             {
605                 strOp = _T("-|↑|-");
606             }
607             break;
608         case CMTerm1View::typeOUT:
609             strOp = _T("-[↑]");
610             break;
611         default:
612             break;
613         }
614     }
615     if (stDisplayCell.bpn)
616     {
617         switch (stDisplayCell.OP)
618         {
619         case CMTerm1View::typeNO:
620             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
621             {
622                 strOp = _T("└┤↓├┘");
623             }
624             else
625             {
626                 strOp = _T("-|↓|-");
627             }
628             break;
629         case CMTerm1View::typeOUT:
630             strOp = _T("-[↓]");
631             break;
632         default:
633             break;
634         }
635     }
636
637     if (stDisplayCell.bDouble)
638     {
639         switch (stDisplayCell.OP)
640         {
641         case CMTerm1View::typeNO:
642             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
643             {
644                 strOp = _T("└┤├┘D");
645             }
646             else
647             {
648                 strOp = _T("-| |-D");
649             }
650             break;
651         case CMTerm1View::typeOUT:
652             strOp = _T("-| |-D");
653             break;
654         case CMTerm1View::typeSET:
655             strOp = _T("-| |-D");
656             break;
657         case CMTerm1View::typeRESET:
658             strOp = _T("-| |-D");
659             break;
660         case CMTerm1View::typeDF:
661             strOp = _T("-| |-D");
662             break;
663         case CMTerm1View::typeDF_:
664             strOp = _T("-| |-D");
665             break;
666         case CMTerm1View::typeNOT:
667             strOp = _T("-| |-D");
668             break;
669         case CMTerm1View::typeTM:
670             strOp = _T("-| |-D");
671             break;
672         default:
673             break;
674         }
675     }
676
677
678     if (stDisplayCell.bDouble1)
679     {
680         switch (stDisplayCell.OP)
681         {
682         case CMTerm1View::typeNO:
683             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
684             {
685                 strOp = _T("└┤├┘");
686             }
687             else
688             {
689                 strOp = _T("-| |-");
690             }
691             break;
692         case CMTerm1View::typeOUT:
693             strOp = _T("-| |-");
694             break;
695         case CMTerm1View::typeSET:
696             strOp = _T("-| |-");
697             break;
698         case CMTerm1View::typeRESET:
699             strOp = _T("-| |-");
700             break;
701         case CMTerm1View::typeDF:
702             strOp = _T("-| |-");
703             break;
704         case CMTerm1View::typeDF_:
705             strOp = _T("-| |-");
706             break;
707         case CMTerm1View::typeNOT:
708             strOp = _T("-| |-");
709             break;
710         case CMTerm1View::typeTM:
711             strOp = _T("-| |-");
712             break;
713         default:
714             break;
715         }
716     }
717
718     if (stDisplayCell.bFloat)
719     {
720         switch (stDisplayCell.OP)
721         {
722         case CMTerm1View::typeNO:
723             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
724             {
725                 strOp = _T("└┤├┘F");
726             }
727             else
728             {
729                 strOp = _T("-| |-F");
730             }
731             break;
732         case CMTerm1View::typeOUT:
733             strOp = _T("-| |-F");
734             break;
735         case CMTerm1View::typeSET:
736             strOp = _T("-| |-F");
737             break;
738         case CMTerm1View::typeRESET:
739             strOp = _T("-| |-F");
740             break;
741         case CMTerm1View::typeDF:
742             strOp = _T("-| |-F");
743             break;
744         case CMTerm1View::typeDF_:
745             strOp = _T("-| |-F");
746             break;
747         case CMTerm1View::typeNOT:
748             strOp = _T("-| |-F");
749             break;
750         case CMTerm1View::typeTM:
751             strOp = _T("-| |-F");
752             break;
753         default:
754             break;
755         }
756     }
757
758     if (stDisplayCell.bFloat1)
759     {
760         switch (stDisplayCell.OP)
761         {
762         case CMTerm1View::typeNO:
763             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
764             {
765                 strOp = _T("└┤├┘");
766             }
767             else
768             {
769                 strOp = _T("-| |-");
770             }
771         case CMTerm1View::typeOUT:
772             strOp = _T("-| |-");
773             break;
774         case CMTerm1View::typeSET:
775             strOp = _T("-| |-");
776             break;
777         case CMTerm1View::typeRESET:
778             strOp = _T("-| |-");
779             break;
780         case CMTerm1View::typeDF:
781             strOp = _T("-| |-");
782             break;
783         case CMTerm1View::typeDF_:
784             strOp = _T("-| |-");
785             break;
786         case CMTerm1View::typeNOT:
787             strOp = _T("-| |-");
788             break;
789         case CMTerm1View::typeTM:
790             strOp = _T("-| |-");
791             break;
792         default:
793             break;
794         }
795     }
796     switch (stDisplayCell.param)
797     {
798     case KLCoilTypeX:
799         strParam = _T("X");
800         break;
801     case KLCoilTypeY:
802         strParam = _T("Y");
803         break;
804     case KLCoilTypeR:
805         strParam = _T("R");
806         break;
807     case KLCoilTypeLR:
808         strParam = _T("L");
809         break;
810     case KLCoilTypeT:
811         strParam = _T("T");
812         break;
813     case KLCoilTypeC:
814         strParam = _T("C");
815         break;
816     case OP_TMX:
817         if (strOp == _T("-[TM]"))
818             strOp = "";
819         strParam = _T("-[TMX]");
820         break;
821     case OP_TMY:
822         if (strOp == _T("-[TM]"))
823             strOp = "";
824         strParam = _T("-[TMY]");
825         break;
826     case OP_TMR:
827         if (strOp == _T("-[TM]"))
828             strOp = "";
829         strParam = _T("-[TMR]");
830         break;
831     case OP_TML:
832         if (strOp == _T("-[TM]"))
833             strOp = "";
834         strParam = _T("-[TML]");
835         break;
836     default:
837         strParam = " ";
838         break;
839     }
840
841     if ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
842     {
843         strParam = "=";
844     }
845     if ((!m_InputCell.bcmpEq) && (m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
846     {
847         strParam = "<";
848     }
849     if ((!m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
850     {
851         strParam = ">";
852     }
853     if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpLt))
854     {
855         strParam = "<=";
856     }
857     if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpGt))
858     {
859         strParam = ">=";
860     }
861     if ((m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
862     {
863         strParam = "<>";
864     }
865     strNum = stDisplayCell.num;
866     str = strOp + _T(" ") + strParam + " " + strNum;
d34256 867     //设置输入框中的文本
df0321 868     SetDlgItemText(IDC_EDIT_INPUT, str);
Q 869     return 0;
870 }
871
872 int CMyFormInputShow::SetCurCellPos(int nRow, int nCol, CMTerm1View::stCell theCell)
873 {
874     m_InputCell.clear();
d34256 875     m_InputCell.row = nRow;
Z 876     m_InputCell.col = nCol;
df0321 877     int nType = theCell.nType;
Q 878     switch (nType)
879     {
880     case CMTerm1View::typeNone:
881         m_InputCell.OP = CMTerm1View::typeNO;
882
883         break;
884     case CMTerm1View::typeLine1:
885         m_InputCell.OP = nType;
886         break;
887     case CMTerm1View::typeLine2:
888         m_InputCell.OP = nType;
889         break;
890     case CMTerm1View::typeNO:
891         m_InputCell.OP = nType;
892         m_InputCell.sCellName = theCell.sCoilName;
893         m_InputCell.param= theCell.nDataType;
894         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
895         break;
896     case CMTerm1View::typeNC:
897         m_InputCell.OP = nType;
898         break;
899     case CMTerm1View::typePP:
900         m_InputCell.OP = nType;
901
902         break;
903     case CMTerm1View::typePN:
904         m_InputCell.OP = nType;
905         break;
906     case CMTerm1View::typeNOT:
907         m_InputCell.OP = nType;
908         break;
909     case CMTerm1View::typeDF:
910         m_InputCell.OP = nType;
911         break;
912     case CMTerm1View::typeDF_:
913         m_InputCell.OP = nType;
914         break;
915     case CMTerm1View::typeOUT:
916         m_InputCell.OP = nType;
917         m_InputCell.sCellName = theCell.sCoilName;
918         m_InputCell.param = theCell.nDataType;
919         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
920         break;
921     case CMTerm1View::typeSET:
922         m_InputCell.OP = nType;
923         m_InputCell.sCellName = theCell.sCoilName;
924         m_InputCell.param = theCell.nDataType;
925         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
926         break;
927     case CMTerm1View::typeRESET:
928         m_InputCell.OP = nType;
929         m_InputCell.sCellName = theCell.sCoilName;
930         m_InputCell.param = theCell.nDataType;
931         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
932         break;
933     case CMTerm1View::typeCMP:
934         m_InputCell.OP = nType;
935         break;
936     case CMTerm1View::typeExt1:
937         m_InputCell.sCellName = theCell.sParam;
938         m_InputCell.param = theCell.nDataType;
939         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
940         m_InputCell.OP = nType;
941         break;
942     case CMTerm1View::typeExt2:
943         break;
944     case CMTerm1View::typeExt3:
945         break;
946     case CMTerm1View::typeTM:
947         m_InputCell.OP = CMTerm1View::typeTM;
948         break;
949     case CMTerm1View::typeFN1:
950         m_InputCell.OP = CMTerm1View::typeFN1;
951         break;
952     case CMTerm1View::typeFN2:
953         m_InputCell.OP = CMTerm1View::typeFN2;
954         break;
955     case CMTerm1View::typeFN3:
956         m_InputCell.OP = CMTerm1View::typeFN3;
957         break;
958     case CMTerm1View::typeCoil:
959         break;
960     default:
961         break;
962     }
963
964     display(m_InputCell);
965     return 0;
966 }
967
968
969 void CMyFormInputShow::OnBtnRet()
970 {
971     // TODO: 在此添加命令处理程序代码
972     CString strName;
973     CMTerm1View::stCell cell1;
974     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
975     CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame();
976     CView* p2 = (CView*)pChild->GetActiveView();
977     if (p2 == NULL) return;
978     CMTerm1View* p3 = (CMTerm1View*)p2;
979     //    m_wndDlgBar_InputShow.SetDisplay(0x00140000);
980     SetBtnDisplay(0);
981
982     switch (m_InputCell.OP)
983     {
984     case CMTerm1View::typeNO:
985     case CMTerm1View::typeNC:
986     case CMTerm1View::typeOUT:
987     case CMTerm1View::typeSET:
988     case CMTerm1View::typeRESET:
989     case CMTerm1View::typeTM:
990         switch (m_InputCell.param)
991         {
992         case KLCoilTypeX:
993             strName = "X";
994             break;
995         case KLCoilTypeY:
996             strName = "Y";
997             break;
998         case KLCoilTypeR:
999             strName = "R";
1000             break;
1001         case KLCoilTypeLR:
1002             strName = "L";
1003             break;
1004         case KLCoilTypeT:
1005             strName = "T";
1006             break;
1007         case KLCoilTypeC:
1008             strName = "C";
1009             break;
1010         case OP_TMX:
1011             strName = "TMX   ";
1012         case OP_TMY:
1013             strName = "TMY   ";
1014         case OP_TMR:
1015             strName = "TMR   ";
1016         case OP_TML:
1017             strName = "TML   ";
1018         default:
1019             break;
1020         }
1021     default:
1022         break;
1023     }
1024
1025
1026
1027     cell1.sCoilName = strName + m_InputCell.num;
1028     cell1.nType = m_InputCell.OP;
1029
1030     cell1.nProgStep = 0;
1031     cell1.bEditing = 1;
1032
1033     cell1.sParam = strName + m_InputCell.num;;
1034
1035     cell1.bLeftLineUp = 0;
1036     cell1.nDataType = CMTerm1View::typeCoil;
1037     cell1.nDataAddr = _tstoi(m_InputCell.num);
1038     cell1.bModified = 1;
1039     p3->SetCellToView(cell1);
1040
1041
1042     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1043 }
d34256 1044
Z 1045
1046 /// <summary>
1047 /// 插入按钮点击事件
1048 /// </summary>
df0321 1049 void CMyFormInputShow::OnBtnInsert()
Q 1050 {
d34256 1051     if (m_InputCell.OP == NULL)
Z 1052     {
1053         DbgLog(_T("Error:插入失败,未选择要插入的操作"));
1054         return;
1055     }
1056
1057     if (m_InputCell.num == (_T("")))
1058     {
1059         DbgLog(_T("Error:插入失败,未设置编号"));
1060         return;
1061     }
1062
1063
1064     CString s1;
1065
1066     CString strName;
1067     CMTerm1View::stCell cell1;
1068     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
1069     CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame();
1070     CView* p2 = (CView*)pChild->GetActiveView();
1071     if (p2 == NULL) return;
1072     CMTerm1View* p3 = (CMTerm1View*)p2;
1073
1074     switch (m_InputCell.OP)
1075     {
1076     case CMTerm1View::typeNO:
1077     case CMTerm1View::typeNC:
1078     case CMTerm1View::typeOUT:
1079     case CMTerm1View::typeSET:
1080     case CMTerm1View::typeRESET:
1081     case CMTerm1View::typeTM:
1082         switch (m_InputCell.param)
1083         {
1084         case KLCoilTypeX:
1085             strName = "X";
1086             break;
1087         case KLCoilTypeY:
1088             strName = "Y";
1089             break;
1090         case KLCoilTypeR:
1091             strName = "R";
1092             break;
1093         case KLCoilTypeLR:
1094             strName = "L";
1095             break;
1096         case KLCoilTypeT:
1097             strName = "T";
1098             break;
1099         case KLCoilTypeC:
1100             strName = "C";
1101             break;
1102         case OP_TMX:
1103             strName = "TMX   ";
1104         case OP_TMY:
1105             strName = "TMY   ";
1106         case OP_TMR:
1107             strName = "TMR   ";
1108         case OP_TML:
1109             strName = "TML   ";
1110         default:
1111             break;
1112         }
1113     default:
1114         break;
1115     }
1116
1117     cell1.sCoilName = strName + m_InputCell.num;
1118     cell1.nType = m_InputCell.OP;
1119
1120     cell1.nProgStep = 0;
1121     cell1.bEditing = 1;
1122
1123     cell1.sParam = strName + m_InputCell.num;;
1124
1125     cell1.bLeftLineUp = 0;
1126     cell1.nDataType = CMTerm1View::typeCoil;
1127     cell1.nDataAddr = _tstoi(m_InputCell.num);
1128     cell1.bModified = 1;
1129     //
1130     p3->SetCellToView(cell1);
1131     //插入完成后,设置按钮返回第一页
1132     SetBtnDisplay(0);
1133     DbgLog(cell1.sCoilName);
1134
df0321 1135 }
d34256 1136
Z 1137 /// <summary>
1138 /// 删除按钮点击事件
1139 /// </summary>
df0321 1140 void CMyFormInputShow::OnBtnDelete()
Q 1141 {
1142     // TODO: 在此添加命令处理程序代码
1143     SetDisplay(0x00340000);
1144     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1145 }
d34256 1146
df0321 1147 void CMyFormInputShow::OnBtnEsc()
Q 1148 {
1149     // TODO: 在此添加命令处理程序代码
1150     //m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
1151     SetBtnDisplayESC(0);
1152     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1153 }
1154
1155 static int flag = 0;
1156 int CMyFormInputShow::SetDisplay(int inputInfo)
1157 {
1158     /*stInputCell.OP = CMTerm1View::typeNO;
1159     stInputCell.param = KLCoilTypeY;
1160     stInputCell.num = _T("1234");*/
1161
1162     static int clickCounter = 0;
1163     static int clickCounterDF = 0;
1164     static int clickCounterNot = 0;
1165     static int clickCounterCMP = 0;
1166     static int clickCounterD = 0;
1167     static int clickCounterF = 0;
1168     static char curTaskState = 'A';
1169     static int lastLParam = 0;
1170     static int lastCMP = 0;
1171     static CString str, strStoreB, strStoreC, strNum;
1172     static CString strOp, strParam;
1173
1174
1175     CString s1, strNumTemp;
1176     int para = 0;
1177     int HParam, LParam;
1178 //    s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
1179 //    SysLog(s1);
1180     //    ChangeState(inputInfo>>16, lastTaskState, curTaskState);
1181     if (inputInfo == 0x00010008)
1182     {
1183         clickCounterDF++;
1184         if (clickCounterDF == 1)                     //DF  redefine key value
1185         {
1186
1187             inputInfo = 0x00010008;
1188         }
1189         else if (clickCounterDF == 2)
1190         {
1191             inputInfo = 0x00010009;
1192             clickCounterDF = 0;
1193         }
1194     }
1195     if (inputInfo == 0x00010010)
1196     {
1197         clickCounter++;
1198
1199         if (clickCounter == 1)  //updown  redefine key value
1200         {
1201             inputInfo = 0x00010010;
1202         }
1203         else if (clickCounter == 2)
1204         {
1205             inputInfo = 0x00010011;
1206         }
1207         else if (clickCounter == 3)
1208         {
1209             inputInfo = 0x00010012;
1210             clickCounter = 0;
1211         }
1212     }
1213     if (inputInfo == 0x00010013)
1214     {
1215         clickCounterNot++;
1216         if (clickCounterNot == 1)                     //NOT  redefine key value
1217         {
1218
1219             inputInfo = 0x00010013;
1220         }
1221         else if (clickCounterNot == 2)
1222         {
1223             inputInfo = 0x00010014;
1224             clickCounterNot = 0;
1225         }
1226     }
1227
1228     if (inputInfo == 0x00010015)
1229     {
1230         clickCounterD++;
1231         if (clickCounterD == 1)                     //D  redefine key value
1232         {
1233
1234             inputInfo = 0x00010015;
1235         }
1236         else if (clickCounterD == 2)
1237         {
1238             inputInfo = 0x00010017;
1239             clickCounterD = 0;
1240         }
1241     }
1242
1243     if (inputInfo == 0x00010016)
1244     {
1245         clickCounterF++;
1246         if (clickCounterF == 1)                     //D  redefine key value
1247         {
1248
1249             inputInfo = 0x00010016;
1250         }
1251         else if (clickCounterF == 2)
1252         {
1253             inputInfo = 0x00010018;
1254             clickCounterF = 0;
1255         }
1256     }
1257
1258     HParam = inputInfo >> 16;
1259     LParam = inputInfo & 0xffff;
1260
1261
1262     switch (curTaskState)
1263     {
1264     case 'A':
1265         if (HParam == 0x1)                      //operator 1
1266         {
1267             m_InputCell.bnot = false;
1268             m_InputCell.bpp = false;
1269             m_InputCell.bpn = false;
1270             m_InputCell.bcmpEq = false;
1271             m_InputCell.bcmpLt = false;
1272             m_InputCell.bcmpGt = false;
1273             m_InputCell.bDouble = false;
1274             m_InputCell.bDouble1 = false;
1275             m_InputCell.bFloat = false;
1276             m_InputCell.bFloat1 = false;
1277             m_InputCell.bLeftLineUp = false;
1278             m_InputCell.brightLineUp = false;
1279
1280             if ((LParam >= 0x1) && (LParam <= 0x0f))
1281             {
1282
1283                 if ((LParam == 0x8) || (LParam == 0x9))         //IF DF  not clear df
1284                 {
1285                     clickCounter = 0;
1286                     clickCounterNot = 0;
1287                     clickCounterCMP = 0;
1288                     clickCounterD = 0;
1289                     clickCounterF = 0;
1290                 }
1291                 else
1292                 {
1293                     if (lastLParam != LParam)
1294                     {
1295                         clickCounter = 0;
1296                         clickCounterNot = 0;
1297                         clickCounterDF = 0;
1298                         clickCounterCMP = 0;
1299                         clickCounterD = 0;
1300                         clickCounterF = 0;
1301                     }
1302                 }
1303             }
1304             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1305             {
1306                 clickCounter = 1;
1307                 clickCounterNot = 0;
1308                 clickCounterDF = 0;
1309                 clickCounterCMP = 0;
1310                 clickCounterD = 0;
1311                 clickCounterF = 0;
1312
1313             }
1314             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1315             {
1316                 clickCounter = 0;
1317                 clickCounterNot = 1;
1318                 clickCounterDF = 0;
1319                 clickCounterCMP = 0;
1320                 clickCounterD = 0;
1321                 clickCounterF = 0;
1322
1323             }
1324             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
1325             {
1326                 clickCounter = 0;
1327                 clickCounterNot = 1;
1328                 clickCounterDF = 0;
1329                 clickCounterCMP = 0;
1330                 clickCounterD = 0;
1331                 clickCounterF = 0;
1332             }
1333
1334             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
1335             {
1336                 clickCounter = 0;
1337                 clickCounterNot = 0;
1338                 clickCounterDF = 0;
1339                 clickCounterCMP = 0;
1340                 clickCounterD = 0;
1341                 clickCounterF = 0;
1342
1343             }
1344             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1345             {
1346                 clickCounter = 0;
1347                 clickCounterNot = 0;
1348                 clickCounterDF = 0;
1349                 clickCounterCMP = 0;
1350                 clickCounterD = 0;
1351                 clickCounterF = 0;
1352
1353             }
1354             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1355             {
1356                 clickCounter = 0;
1357                 clickCounterNot = 0;
1358                 clickCounterDF = 0;
1359                 clickCounterCMP = 0;
1360                 clickCounterD = 0;
1361                 clickCounterF = 0;
1362             }
1363
1364             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))  //D ,"", F,""
1365             {
1366                 clickCounter = 0;
1367                 clickCounterNot = 0;
1368                 clickCounterDF = 0;
1369                 clickCounterCMP = 0;
1370                 clickCounterD = 0;
1371                 clickCounterF = 1;
1372             }
1373
1374             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
1375             {
1376                 clickCounter = 0;
1377                 clickCounterNot = 0;
1378                 clickCounterDF = 0;
1379                 clickCounterCMP = 0;
1380                 clickCounterD = 0;
1381                 clickCounterF = 1;
1382             }
1383             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
1384             {
1385                 clickCounter = 0;
1386                 clickCounterNot = 0;
1387                 clickCounterDF = 0;
1388                 clickCounterCMP = 0;
1389                 clickCounterD = 0;
1390                 clickCounterF = 1;
1391             }
1392             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
1393             {
1394                 clickCounter = 0;
1395                 clickCounterNot = 0;
1396                 clickCounterDF = 0;
1397                 clickCounterCMP = 0;
1398                 clickCounterD = 1;
1399                 clickCounterF = 0;
1400             }
1401             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
1402             {
1403                 clickCounter = 0;
1404                 clickCounterNot = 0;
1405                 clickCounterDF = 0;
1406                 clickCounterCMP = 0;
1407                 clickCounterD = 1;
1408                 clickCounterF = 0;
1409             }
1410             switch (LParam)
1411             {
1412             case 0x01:
1413                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
1414
1415                 lastLParam = LParam;
1416                 curTaskState = 'B';
1417                 break;
1418             case 0x02:
1419                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
1420                 m_InputCell.bLeftLineUp = true;
1421                 m_InputCell.brightLineUp = true;
1422                 lastLParam = LParam;
1423                 curTaskState = 'B';
1424                 break;
1425             case 0x03:
1426                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
1427
1428                 lastLParam = LParam;
1429                 curTaskState = 'B';
1430                 break;
1431                 /*case 4:
1432                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
1433                 case 5:
1434                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
1435             case 0x06:
1436                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10;
1437
1438                 lastLParam = LParam; curTaskState = 'B'; break;
1439             case 0x07:
1440                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10;
1441
1442                 lastLParam = LParam; curTaskState = 'B'; break;
1443             case 0x08:
1444                 m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
1445
1446                 lastLParam = LParam;
1447                 curTaskState = 'A';
1448                 break;
1449             case 0x09:
1450                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
1451
1452                 lastLParam = LParam;
1453                 curTaskState = 'A';
1454                 break;
1455             case 0x0a:
1456                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
1457             case 0x0b:
1458                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
1459
1460                 lastLParam = LParam;
1461                 curTaskState = 'B';
1462                 break;
1463             case 0x10:
1464                 m_InputCell.bpp = true;
1465                 m_InputCell.bpn = false;
1466                 lastLParam = LParam;
1467                 break;
1468             case 0x11:
1469                 m_InputCell.bpp = false;
1470                 m_InputCell.bpn = true;
1471                 lastLParam = LParam;
1472                 break;
1473             case 0x12:
1474                 m_InputCell.bpp = false;
1475                 m_InputCell.bpn = false;
1476                 lastLParam = LParam;
1477                 break;
1478             case 0x13:
1479                 switch (lastLParam)
1480                 {
1481                 case 0x03:
1482                 case 0x06:
1483                 case 0x07:
1484                 case 0x15:
1485                 case 0x17:
1486                 case 0x16:
1487                 case 0x18:
1488                 case 0x20:
1489                 case 0x21:
1490                 case 0x22:
1491                     m_InputCell.OP = CMTerm1View::typeNOT;
1492                     clickCounterNot = 0;
1493                     curTaskState = 'A';
1494                 default:
1495                     break;
1496                 }
1497                 switch (lastLParam)
1498                 {
1499                 case 0x01:
1500                     m_InputCell.OP = CMTerm1View::typeNC; break;
1501                 case 0x02:
1502                     m_InputCell.OP = CMTerm1View::typeNC;
1503                     m_InputCell.bLeftLineUp = true;
1504                     m_InputCell.brightLineUp = true;
1505                     break;
1506                 default:
1507                     break;
1508                 }
1509                 lastLParam = LParam;
1510                 m_InputCell.bnot = true;
1511                 break;
1512             case 0x14:
1513                 m_InputCell.bnot = false;
1514                 break;
1515             case 0x15:
1516                 m_InputCell.bDouble = true;
1517                 m_InputCell.bDouble1 = false;
1518                 m_InputCell.bFloat = false;
1519                 m_InputCell.bFloat1 = false;
1520                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1521                 break;
1522             case 0x17:
1523                 m_InputCell.bDouble = false;
1524                 m_InputCell.bDouble1 = true;
1525                 m_InputCell.bFloat = false;
1526                 m_InputCell.bFloat1 = false;
1527                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1528                 break;
1529             case 0x16:
1530                 m_InputCell.bDouble = false;
1531                 m_InputCell.bDouble1 = false;
1532                 m_InputCell.bFloat = true;
1533                 m_InputCell.bFloat1 = false;
1534                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1535                 break;
1536             case 0x18:
1537                 m_InputCell.bDouble = false;
1538                 m_InputCell.bDouble1 = false;
1539                 m_InputCell.bFloat = false;
1540                 m_InputCell.bFloat1 = true;
1541                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1542                 break;
1543             default:
1544                 break;
1545             }
1546         }
1547
1548         str = strOp;
1549         break;
1550     case 'B':
1551         str = strOp;
1552         if (HParam == 0x1)                      //operator 1
1553         {
1554             m_InputCell.bnot = false;
1555             m_InputCell.bpp = false;
1556             m_InputCell.bpn = false;
1557             m_InputCell.bcmpEq = false;
1558             m_InputCell.bcmpLt = false;
1559             m_InputCell.bcmpGt = false;
1560             m_InputCell.bDouble = false;
1561             m_InputCell.bDouble1 = false;
1562             m_InputCell.bFloat = false;
1563             m_InputCell.bFloat1 = false;
1564             m_InputCell.bLeftLineUp = false;
1565             m_InputCell.brightLineUp = false;
1566             if ((LParam >= 0x0) && (LParam <= 0x0f))
1567             {
1568
1569                 if ((LParam == 0x08) || (LParam == 0x09))
1570                 {
1571                     clickCounter = 0;
1572                     clickCounterNot = 0;
1573                     clickCounterCMP = 0;
1574                     clickCounterD = 0;
1575                     clickCounterF = 0;
1576                 }
1577                 else
1578                 {
1579                     if (lastLParam != LParam)
1580                     {
1581                         clickCounter = 0;
1582                         clickCounterNot = 0;
1583                         clickCounterDF = 0;
1584                         clickCounterCMP = 0;
1585                         clickCounterD = 0;
1586                         clickCounterF = 0;
1587                     }
1588                 }
1589
1590             }
1591             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1592             {
1593                 clickCounter = 1;
1594                 clickCounterNot = 0;
1595                 clickCounterDF = 0;
1596                 clickCounterCMP = 0;
1597                 clickCounterD = 0;
1598                 clickCounterF = 0;
1599
1600             }
1601             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1602             {
1603                 clickCounter = 1;
1604                 clickCounterNot = 0;
1605                 clickCounterDF = 0;
1606                 clickCounterCMP = 0;
1607                 clickCounterD = 0;
1608                 clickCounterF = 0;
1609
1610             }
1611             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1612             {
1613                 clickCounter = 0;
1614                 clickCounterNot = 1;
1615                 clickCounterDF = 0;
1616                 clickCounterCMP = 0;
1617                 clickCounterD = 0;
1618                 clickCounterF = 0;
1619
1620             }
1621             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
1622             {
1623                 clickCounter = 0;
1624                 clickCounterNot = 1;
1625                 clickCounterDF = 0;
1626                 clickCounterCMP = 0;
1627                 clickCounterD = 0;
1628                 clickCounterF = 0;
1629             }
1630             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
1631             {
1632                 clickCounter = 0;
1633                 clickCounterNot = 0;
1634                 clickCounterDF = 0;
1635                 clickCounterCMP = 0;
1636                 clickCounterD = 0;
1637                 clickCounterF = 1;
1638             }
1639             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
1640             {
1641                 clickCounter = 0;
1642                 clickCounterNot = 0;
1643                 clickCounterDF = 0;
1644                 clickCounterCMP = 0;
1645                 clickCounterD = 0;
1646                 clickCounterF = 1;
1647             }
1648             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
1649             {
1650                 clickCounter = 0;
1651                 clickCounterNot = 0;
1652                 clickCounterDF = 0;
1653                 clickCounterCMP = 0;
1654                 clickCounterD = 1;
1655                 clickCounterF = 0;
1656             }
1657             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
1658             {
1659                 clickCounter = 0;
1660                 clickCounterNot = 0;
1661                 clickCounterDF = 0;
1662                 clickCounterCMP = 0;
1663                 clickCounterD = 1;
1664                 clickCounterF = 0;
1665             }
1666             switch (LParam)
1667             {
1668             case 0x01:
1669                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
1670
1671                 lastLParam = LParam;
1672                 curTaskState = 'B';
1673                 break;
1674             case 0x02:
1675                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
1676                 m_InputCell.bLeftLineUp = true;
1677                 m_InputCell.brightLineUp = true;
1678                 lastLParam = LParam;
1679                 curTaskState = 'B';
1680                 break;
1681             case 0x03:
1682                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
1683
1684                 lastLParam = LParam;
1685                 curTaskState = 'B';
1686                 break;
1687                 /*case 4:
1688                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
1689                 case 5:
1690                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
1691             case 0x06:
1692                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
1693             case 0x07:
1694                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
1695             case 0x08:
1696                 m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
1697
1698                 lastLParam = LParam;
1699                 curTaskState = 'A';
1700                 break;
1701             case 0x9:
1702                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
1703
1704                 lastLParam = LParam;
1705                 curTaskState = 'A';
1706                 break;
1707             case 0x0a:
1708                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
1709             case 0x0b:
1710                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
1711
1712                 lastLParam = LParam;
1713                 curTaskState = 'B';
1714                 break;
1715             case 0x10:
1716                 m_InputCell.bpp = true;
1717                 m_InputCell.bpn = false;
1718                 lastLParam = LParam;
1719                 break;
1720             case 0x11:
1721                 m_InputCell.bpp = false;
1722                 m_InputCell.bpn = true;
1723                 lastLParam = LParam;
1724                 break;
1725             case 0x12:
1726                 m_InputCell.bpp = false;
1727                 m_InputCell.bpn = false;
1728                 lastLParam = LParam;
1729                 break;
1730             case 0x13:
1731                 switch (lastLParam)
1732                 {
1733                 case 0x03:
1734                 case 0x06:
1735                 case 0x07:
1736                 case 0x15:
1737                 case 0x17:
1738                 case 0x16:
1739                 case 0x18:
1740                 case 0x20:
1741                 case 0x21:
1742                 case 0x22:
1743                     m_InputCell.OP = CMTerm1View::typeNOT;
1744                     clickCounterNot = 0;
1745                     curTaskState = 'A';
1746                 default:
1747                     break;
1748                 }
1749
1750                 switch (lastLParam)
1751                 {
1752                 case 0x01:
1753                     m_InputCell.OP = CMTerm1View::typeNC; break;
1754                 case 0x02:
1755                     m_InputCell.OP = CMTerm1View::typeNC;
1756                     m_InputCell.bLeftLineUp = true;
1757                     m_InputCell.brightLineUp = true;
1758                     break;
1759                 default:
1760                     break;
1761                 }
1762
1763                 lastLParam = LParam;
1764                 m_InputCell.bnot = true;
1765                 break;
1766             case 0x14:
1767                 m_InputCell.bnot = false;
1768                 break;
1769             case 0x15:
1770                 m_InputCell.bDouble = true;
1771                 m_InputCell.bDouble1 = false;
1772                 m_InputCell.bFloat = false;
1773                 m_InputCell.bFloat1 = false;
1774                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
1775                 break;
1776             case 0x17:
1777                 m_InputCell.bDouble = false;
1778                 m_InputCell.bDouble1 = true;
1779                 m_InputCell.bFloat = false;
1780                 m_InputCell.bFloat1 = false;
1781                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
1782                 break;
1783             case 0x16:
1784                 m_InputCell.bDouble = false;
1785                 m_InputCell.bDouble1 = false;
1786                 m_InputCell.bFloat = true;
1787                 m_InputCell.bFloat1 = false;
1788                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1789                 break;
1790             case 0x18:
1791                 m_InputCell.bDouble = false;
1792                 m_InputCell.bDouble1 = false;
1793                 m_InputCell.bFloat = false;
1794                 m_InputCell.bFloat1 = true;
1795                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1796                 break;
1797             default:
1798                 break;
1799             }
1800         }
1801         else if (HParam == 0x2)
1802         {
1803             switch (LParam)
1804             {
1805             case 1:
1806                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
1807             case 2:
1808                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
1809             case 3:
1810                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
1811             case 4:
1812                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
1813             case 5:
1814                 strParam = _T(" P"); curTaskState = 'C'; break;
1815             case 6:
1816                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
1817             case 7:
1818                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
1819             case 8:
1820                 strParam = _T(" E"); curTaskState = 'C'; break;
1821             case 9:
1822                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
1823             case 0x0a:
1824                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
1825             case 0x0b:
1826                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
1827             case 0x0c:
1828                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
1829             case 0x0d:
1830                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1831                 {
1832                     m_InputCell.OP = CMTerm1View::typeNO;
1833                     m_InputCell.bnot = false;
1834                     m_InputCell.bpp = false;
1835                     m_InputCell.bpn = false;
1836                     clickCounter = 0;
1837                     clickCounterNot = 0;
1838                     clickCounterDF = 0;
1839                     clickCounterD = 0;
1840                     clickCounterF = 0;
1841                 }
1842                 lastLParam = 0x20;
1843                 m_InputCell.bcmpEq = true;
1844                 if (lastCMP != LParam)
1845                 {
1846                     clickCounterCMP++;
1847                 }
1848                 else
1849                 {
1850                     clickCounterCMP = 1;
1851                     m_InputCell.bcmpGt = false;
1852                     m_InputCell.bcmpLt = false;
1853                 }
1854
1855                 if (clickCounterCMP > 2)
1856                 {
1857                     clickCounterCMP = 1;
1858                     m_InputCell.bcmpGt = false;
1859                     m_InputCell.bcmpLt = false;
1860                 }
1861                 lastCMP = LParam;
1862                 curTaskState = 'B'; break;
1863             case 0x0e:
1864                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1865                 {
1866                     m_InputCell.OP = CMTerm1View::typeNO;
1867                     m_InputCell.bnot = false;
1868                     m_InputCell.bpp = false;
1869                     m_InputCell.bpn = false;
1870                     clickCounter = 0;
1871                     clickCounterNot = 0;
1872                     clickCounterDF = 0;
1873                     clickCounterD = 0;
1874                     clickCounterF = 0;
1875                 }
1876                 lastLParam = 0x21;
1877                 m_InputCell.bcmpGt = true;
1878                 if (lastCMP != LParam)
1879                 {
1880                     clickCounterCMP++;
1881                 }
1882                 else
1883                 {
1884                     clickCounterCMP = 1;
1885                     m_InputCell.bcmpEq = false;
1886                     m_InputCell.bcmpLt = false;
1887                 }
1888
1889                 if (clickCounterCMP > 2)
1890                 {
1891                     clickCounterCMP = 1;
1892                     m_InputCell.bcmpEq = false;
1893                     m_InputCell.bcmpLt = false;
1894                 }
1895                 lastCMP = LParam;
1896                 curTaskState = 'B'; break;
1897             case 0x0f:
1898                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1899                 {
1900                     m_InputCell.OP = CMTerm1View::typeNO;
1901                     m_InputCell.bnot = false;
1902                     m_InputCell.bpp = false;
1903                     m_InputCell.bpn = false;
1904                     clickCounter = 0;
1905                     clickCounterNot = 0;
1906                     clickCounterDF = 0;
1907                     clickCounterD = 0;
1908                     clickCounterF = 0;
1909                 }
1910                 lastLParam = 0x22;                //  define op para; for translate to -/-
1911                 m_InputCell.bcmpLt = true;
1912                 if (lastCMP != LParam)
1913                 {
1914                     clickCounterCMP++;
1915                 }
1916                 else
1917                 {
1918                     clickCounterCMP = 1;
1919                     m_InputCell.bcmpEq = false;
1920                     m_InputCell.bcmpGt = false;
1921                 }
1922
1923                 if (clickCounterCMP > 2)
1924                 {
1925                     clickCounterCMP = 1;
1926                     m_InputCell.bcmpEq = false;
1927                     m_InputCell.bcmpGt = false;
1928                 }
1929                 lastCMP = LParam;             //record key num = > <
1930                 curTaskState = 'B'; break;
1931             default:
1932                 break;
1933             }
1934         }
1935
1936         break;
1937     case 'C':
1938         //    str = strOp + _T(" ") + strParam;
1939         if (HParam == 0x01)                      //operator 1
1940         {
1941             m_InputCell.bnot = false;
1942             m_InputCell.bpp = false;
1943             m_InputCell.bpn = false;
1944             m_InputCell.bcmpEq = false;
1945             m_InputCell.bcmpLt = false;
1946             m_InputCell.bcmpGt = false;
1947             m_InputCell.bDouble = false;
1948             m_InputCell.bFloat1 = false;
1949             m_InputCell.bFloat = false;
1950             m_InputCell.bFloat1 = false;
1951             m_InputCell.bLeftLineUp = false;
1952             m_InputCell.brightLineUp = false;
1953
1954             if ((LParam >= 0x01) && (LParam <= 0x0f))
1955             {
1956
1957                 if ((LParam == 0x08) || (LParam == 0x09))
1958                 {
1959                     clickCounter = 0;
1960                     clickCounterNot = 0;
1961                     clickCounterCMP = 0;
1962                     clickCounterD = 0;
1963                     clickCounterF = 0;
1964                 }
1965                 else
1966                 {
1967                     if (lastLParam != LParam)
1968                     {
1969                         clickCounter = 0;
1970                         clickCounterNot = 0;
1971                         clickCounterDF = 0;
1972                         clickCounterCMP = 0;
1973                         clickCounterD = 0;
1974                         clickCounterF = 0;
1975                     }
1976                 }
1977
1978             }
1979             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1980             {
1981                 clickCounter = 1;
1982                 clickCounterNot = 0;
1983                 clickCounterDF = 0;
1984                 clickCounterCMP = 0;
1985                 clickCounterD = 0;
1986                 clickCounterF = 0;
1987
1988             }
1989             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1990             {
1991                 clickCounter = 0;
1992                 clickCounterNot = 1;
1993                 clickCounterDF = 0;
1994                 clickCounterCMP = 0;
1995                 clickCounterD = 0;
1996                 clickCounterF = 0;
1997
1998             }
1999             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
2000             {
2001                 clickCounter = 0;
2002                 clickCounterNot = 1;
2003                 clickCounterDF = 0;
2004                 clickCounterCMP = 0;
2005                 clickCounterD = 0;
2006                 clickCounterF = 0;
2007             }
2008             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
2009             {
2010                 clickCounter = 0;
2011                 clickCounterNot = 0;
2012                 clickCounterDF = 0;
2013                 clickCounterCMP = 0;
2014                 clickCounterD = 0;
2015                 clickCounterF = 0;
2016
2017             }
2018             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2019             {
2020                 clickCounter = 0;
2021                 clickCounterNot = 0;
2022                 clickCounterDF = 0;
2023                 clickCounterCMP = 0;
2024                 clickCounterD = 0;
2025                 clickCounterF = 0;
2026
2027             }
2028             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2029             {
2030                 clickCounter = 0;
2031                 clickCounterNot = 0;
2032                 clickCounterDF = 0;
2033                 clickCounterCMP = 0;
2034                 clickCounterD = 0;
2035                 clickCounterF = 0;
2036             }
2037             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
2038             {
2039                 clickCounter = 0;
2040                 clickCounterNot = 0;
2041                 clickCounterDF = 0;
2042                 clickCounterCMP = 0;
2043                 clickCounterD = 0;
2044                 clickCounterF = 1;
2045             }
2046             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
2047             {
2048                 clickCounter = 0;
2049                 clickCounterNot = 0;
2050                 clickCounterDF = 0;
2051                 clickCounterCMP = 0;
2052                 clickCounterD = 0;
2053                 clickCounterF = 1;
2054             }
2055             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
2056             {
2057                 clickCounter = 0;
2058                 clickCounterNot = 0;
2059                 clickCounterDF = 0;
2060                 clickCounterCMP = 0;
2061                 clickCounterD = 1;
2062                 clickCounterF = 0;
2063             }
2064             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
2065             {
2066                 clickCounter = 0;
2067                 clickCounterNot = 0;
2068                 clickCounterDF = 0;
2069                 clickCounterCMP = 0;
2070                 clickCounterD = 1;
2071                 clickCounterF = 0;
2072             }
2073             switch (LParam)
2074             {
2075             case 0x01:
2076                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
2077
2078                 lastLParam = LParam;
2079                 curTaskState = 'B';
2080                 break;
2081             case 0x02:
2082                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
2083                 m_InputCell.bLeftLineUp = true;
2084                 m_InputCell.brightLineUp = true;
2085                 lastLParam = LParam;
2086                 curTaskState = 'B';
2087                 break;
2088             case 0x03:
2089                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
2090                 lastLParam = LParam;
2091                 curTaskState = 'B';
2092                 break;
2093                 /*case 4:
2094                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
2095                 case 5:
2096                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
2097             case 0x06:
2098                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2099             case 0x07:
2100                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2101             case 0x08:
2102                 m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
2103                 lastLParam = LParam;
2104                 curTaskState = 'A';
2105                 break;
2106             case 0x09:
2107                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
2108
2109                 lastLParam = LParam;
2110                 curTaskState = 'A';
2111                 break;
2112             case 0x0a:
2113                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
2114             case 0x0b:
2115                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
2116
2117                 lastLParam = LParam;
2118                 curTaskState = 'B';
2119                 break;
2120             case 0x10:
2121                 m_InputCell.bpp = true;
2122                 m_InputCell.bpn = false;
2123                 break;
2124             case 0x11:
2125                 m_InputCell.bpp = false;
2126                 m_InputCell.bpn = true;
2127                 break;
2128             case 0x12:
2129                 m_InputCell.bpp = false;
2130                 m_InputCell.bpn = false;
2131                 break;
2132             case 0x13:
2133                 switch (lastLParam)
2134                 {
2135                 case 0x03:
2136                 case 0x06:
2137                 case 0x07:
2138                 case 0x15:
2139                 case 0x17:
2140                 case 0x16:
2141                 case 0x18:
2142                 case 0x20:
2143                 case 0x21:
2144                 case 0x22:
2145                     m_InputCell.OP = CMTerm1View::typeNOT;
2146                     clickCounterNot = 0;
2147
2148                     curTaskState = 'A';
2149                 default:
2150                     break;
2151                 }
2152                 switch (lastLParam)
2153                 {
2154                 case 0x01:
2155                     m_InputCell.OP = CMTerm1View::typeNC; break;
2156                 case 0x02:
2157                     m_InputCell.OP = CMTerm1View::typeNC;
2158                     m_InputCell.bLeftLineUp = true;
2159                     m_InputCell.brightLineUp = true;
2160                     break;
2161                 default:
2162                     break;
2163                 }
2164                 lastLParam = LParam;
2165                 m_InputCell.bnot = true;
2166
2167                 break;
2168             case 0x14:
2169                 m_InputCell.bnot = false;
2170                 break;
2171             case 0x15:
2172                 m_InputCell.bDouble = true;
2173                 m_InputCell.bDouble1 = false;
2174                 m_InputCell.bFloat = false;
2175                 m_InputCell.bFloat1 = false;
2176                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2177                 break;
2178             case 0x17:
2179                 m_InputCell.bDouble = false;
2180                 m_InputCell.bDouble1 = true;
2181                 m_InputCell.bFloat = false;
2182                 m_InputCell.bFloat1 = false;
2183                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2184                 break;
2185             case 0x16:
2186                 m_InputCell.bDouble = false;
2187                 m_InputCell.bDouble1 = false;
2188                 m_InputCell.bFloat = true;
2189                 m_InputCell.bFloat1 = false;
2190                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2191                 break;
2192             case 0x18:
2193                 m_InputCell.bDouble = false;
2194                 m_InputCell.bDouble1 = false;
2195                 m_InputCell.bFloat = false;
2196                 m_InputCell.bFloat1 = true;
2197                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2198                 break;
2199             default:
2200                 break;
2201             }
2202         }
2203         else if (HParam == 0x2)
2204         {
2205             switch (LParam)
2206             {
2207             case 1:
2208                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
2209             case 2:
2210                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
2211             case 3:
2212                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
2213             case 4:
2214                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
2215             case 5:
2216                 strParam = _T(" P"); curTaskState = 'C'; break;
2217             case 6:
2218                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
2219             case 7:
2220                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
2221             case 8:
2222                 strParam = _T(" E"); curTaskState = 'C'; break;
2223             case 9:
2224                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
2225             case 0x0a:
2226                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
2227             case 0x0b:
2228                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
2229             case 0x0c:
2230                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
2231             case 0x0d:
2232                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2233                 {
2234                     m_InputCell.OP = CMTerm1View::typeNO;
2235                     m_InputCell.bnot = false;
2236                     m_InputCell.bpp = false;
2237                     m_InputCell.bpn = false;
2238                     clickCounter = 0;
2239                     clickCounterNot = 0;
2240                     clickCounterDF = 0;
2241                     clickCounterD = 0;
2242                     clickCounterF = 0;
2243                 }
2244                 lastLParam = 0x20;
2245                 m_InputCell.bcmpEq = true;
2246                 if (lastCMP != LParam)
2247                 {
2248                     clickCounterCMP++;
2249                 }
2250                 else
2251                 {
2252                     clickCounterCMP = 1;
2253                     m_InputCell.bcmpGt = false;
2254                     m_InputCell.bcmpLt = false;
2255                 }
2256                 if (clickCounterCMP > 2)
2257                 {
2258                     clickCounterCMP = 1;
2259                     m_InputCell.bcmpGt = false;
2260                     m_InputCell.bcmpLt = false;
2261                 }
2262                 lastCMP = LParam;
2263                 curTaskState = 'B'; break;
2264             case 0x0e:
2265                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2266                 {
2267                     m_InputCell.OP = CMTerm1View::typeNO;
2268                     m_InputCell.bnot = false;
2269                     m_InputCell.bpp = false;
2270                     m_InputCell.bpn = false;
2271                     clickCounter = 0;
2272                     clickCounterNot = 0;
2273                     clickCounterDF = 0;
2274                     clickCounterD = 0;
2275                     clickCounterF = 0;
2276                 }
2277                 lastLParam = 0x21;
2278                 m_InputCell.bcmpGt = true;
2279                 if (lastCMP != LParam)
2280                 {
2281                     clickCounterCMP = 1;
2282                     clickCounterCMP++;
2283                 }
2284                 else
2285                 {
2286                     m_InputCell.bcmpEq = false;
2287                     m_InputCell.bcmpLt = false;
2288                 }
2289                 if (clickCounterCMP > 2)
2290                 {
2291                     clickCounterCMP = 1;
2292                     m_InputCell.bcmpEq = false;
2293                     m_InputCell.bcmpLt = false;
2294                 }
2295                 lastCMP = LParam;
2296                 curTaskState = 'B'; break;
2297             case 0x0f:
2298                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2299                 {
2300                     m_InputCell.OP = CMTerm1View::typeNO;
2301                     m_InputCell.bnot = false;
2302                     m_InputCell.bpp = false;
2303                     m_InputCell.bpn = false;
2304                     clickCounter = 0;
2305                     clickCounterNot = 0;
2306                     clickCounterDF = 0;
2307                     clickCounterD = 0;
2308                     clickCounterF = 0;
2309                 }
2310                 lastLParam = 0x22;
2311                 m_InputCell.bcmpLt = true;
2312                 if (lastCMP != LParam)
2313                 {
2314                     clickCounterCMP++;
2315                 }
2316                 else
2317                 {
2318                     clickCounterCMP = 1;
2319                     m_InputCell.bcmpEq = false;
2320                     m_InputCell.bcmpGt = false;
2321                 }
2322                 if (clickCounterCMP > 2)
2323                 {
2324                     clickCounterCMP = 1;
2325                     m_InputCell.bcmpEq = false;
2326                     m_InputCell.bcmpGt = false;
2327                 }
2328                 lastCMP = LParam;
2329                 curTaskState = 'B'; break;
2330             default:
2331                 break;
2332             }
2333         }
2334         else if (HParam == 0x3)
2335         {
2336             switch (LParam)
2337             {
2338             case 0:
2339                 strNumTemp = _T("0"); curTaskState = 'D'; break;
2340             case 1:
2341                 strNumTemp = _T("1"); curTaskState = 'D'; break;
2342             case 2:
2343                 strNumTemp = _T("2"); curTaskState = 'D'; break;
2344             case 3:
2345                 strNumTemp = _T("3"); curTaskState = 'D'; break;
2346             case 4:
2347                 strNumTemp = _T("4"); curTaskState = 'D'; break;
2348             case 5:
2349                 strNumTemp = _T("5"); curTaskState = 'D'; break;
2350             case 6:
2351                 strNumTemp = _T("6"); curTaskState = 'D'; break;
2352             case 7:
2353                 strNumTemp = _T("7"); curTaskState = 'D'; break;
2354             case 8:
2355                 strNumTemp = _T("8"); curTaskState = 'D'; break;
2356             case 9:
2357                 strNumTemp = _T("9"); curTaskState = 'D'; break;
2358             case 0x0A:
2359                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2360                     ;                        //state not change
2361                 else
2362                 {
2363                     strNumTemp = _T("A"); curTaskState = 'D';
2364                 }
2365                 break;
2366             case 0x0B:
2367                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2368                     ;
2369                 else
2370                 {
2371                     strNumTemp = _T("B"); curTaskState = 'D';
2372                 }
2373                 break;
2374             case 0x0C:
2375                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2376                     ;
2377                 else
2378                 {
2379                     strNumTemp = _T("C"); curTaskState = 'D';
2380                 }
2381                 break;
2382             case 0x0D:
2383                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2384                     ;
2385                 else
2386                 {
2387                     strNumTemp = _T("D"); curTaskState = 'D';
2388                 }
2389                 break;
2390
2391             case 0x0E:
2392                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2393                     ;
2394                 else
2395                 {
2396                     strNumTemp = _T("E"); curTaskState = 'D';
2397                 }
2398                 break;
2399             case 0x0F:
2400                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2401                     ;
2402                 else
2403                 {
2404                     strNumTemp = _T("F"); curTaskState = 'D';
2405                 }
2406                 break;
2407             default:
2408                 break;
2409             }
2410
2411             if (m_InputCell.num.GetLength() < 4)
2412             {
2413                 m_InputCell.num.Append(strNumTemp);
2414             }
2415             else
2416             {
2417                 m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2418                 m_InputCell.num.Append(strNumTemp);
2419             }
2420         }
2421
2422         break;
2423     case 'D':
2424         if (HParam == 0x1)                      //operator 1
2425         {
2426             m_InputCell.bnot = false;
2427             m_InputCell.bpp = false;
2428             m_InputCell.bpn = false;
2429             m_InputCell.bcmpEq = false;
2430             m_InputCell.bcmpLt = false;
2431             m_InputCell.bcmpGt = false;
2432             m_InputCell.bDouble = false;
2433             m_InputCell.bDouble1 = false;
2434             m_InputCell.bFloat = false;
2435             m_InputCell.bFloat1 = false;
2436             m_InputCell.bLeftLineUp = false;
2437             m_InputCell.brightLineUp = false;
2438
2439
2440             if ((LParam >= 0x01) && (LParam <= 0x0f))
2441             {
2442
2443                 m_InputCell.num.Empty();
2444                 if ((LParam == 0x08) || (LParam == 0x09))
2445                 {
2446                     clickCounter = 0;
2447                     clickCounterNot = 0;
2448                     clickCounterCMP = 0;
2449                     clickCounterD = 0;
2450                     clickCounterF = 0;
2451                 }
2452                 else
2453                 {
2454                     if (lastLParam != LParam)
2455                     {
2456                         clickCounter = 0;
2457                         clickCounterNot = 0;
2458                         clickCounterDF = 0;
2459                         clickCounterCMP = 0;
2460                         clickCounterD = 0;
2461                         clickCounterF = 0;
2462                     }
2463                 }
2464             }
2465             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
2466             {
2467                 clickCounter = 1;
2468                 clickCounterNot = 0;
2469                 clickCounterDF = 0;
2470                 clickCounterCMP = 0;
2471                 clickCounterD = 0;
2472                 clickCounterF = 0;
2473
2474             }
2475             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
2476             {
2477                 clickCounter = 0;
2478                 clickCounterNot = 1;
2479                 clickCounterDF = 0;
2480                 clickCounterCMP = 0;
2481                 clickCounterD = 0;
2482                 clickCounterF = 0;
2483
2484             }
2485             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
2486             {
2487                 clickCounter = 0;
2488                 clickCounterNot = 1;
2489                 clickCounterDF = 0;
2490                 clickCounterCMP = 0;
2491                 clickCounterD = 0;
2492                 clickCounterF = 0;
2493             }
2494
2495             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
2496             {
2497                 clickCounter = 0;
2498                 clickCounterNot = 0;
2499                 clickCounterDF = 0;
2500                 clickCounterCMP = 0;
2501                 clickCounterD = 0;
2502                 clickCounterF = 0;
2503
2504             }
2505             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2506             {
2507                 clickCounter = 0;
2508                 clickCounterNot = 0;
2509                 clickCounterDF = 0;
2510                 clickCounterCMP = 0;
2511                 clickCounterD = 0;
2512                 clickCounterF = 0;
2513
2514             }
2515             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2516             {
2517                 clickCounter = 0;
2518                 clickCounterNot = 0;
2519                 clickCounterDF = 0;
2520                 clickCounterCMP = 0;
2521                 clickCounterD = 0;
2522                 clickCounterF = 0;
2523             }
2524             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
2525             {
2526                 clickCounter = 0;
2527                 clickCounterNot = 0;
2528                 clickCounterDF = 0;
2529                 clickCounterCMP = 0;
2530                 clickCounterD = 0;
2531                 clickCounterF = 1;
2532             }
2533             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
2534             {
2535                 clickCounter = 0;
2536                 clickCounterNot = 0;
2537                 clickCounterDF = 0;
2538                 clickCounterCMP = 0;
2539                 clickCounterD = 0;
2540                 clickCounterF = 1;
2541             }
2542             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
2543             {
2544                 clickCounter = 0;
2545                 clickCounterNot = 0;
2546                 clickCounterDF = 0;
2547                 clickCounterCMP = 0;
2548                 clickCounterD = 1;
2549                 clickCounterF = 0;
2550             }
2551             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
2552             {
2553                 clickCounter = 0;
2554                 clickCounterNot = 0;
2555                 clickCounterDF = 0;
2556                 clickCounterCMP = 0;
2557                 clickCounterD = 1;
2558                 clickCounterF = 0;
2559             }
2560             switch (LParam)
2561             {
2562             case 0x01:
2563                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
2564
2565                 lastLParam = LParam;
2566                 curTaskState = 'B';
2567                 break;
2568             case 0x02:
2569                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
2570                 m_InputCell.bLeftLineUp = true;
2571                 m_InputCell.brightLineUp = true;
2572                 lastLParam = LParam;
2573                 curTaskState = 'B';
2574                 break;
2575             case 0x03:
2576                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
2577
2578                 lastLParam = LParam;
2579                 curTaskState = 'B';
2580                 break;
2581                 /*case 4:
2582                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
2583                 case 5:
2584                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
2585             case 0x06:
2586                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2587             case 0x07:
2588                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2589             case 0x08:
2590                 m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
2591
2592                 lastLParam = LParam;
2593                 curTaskState = 'A';
2594                 break;
2595             case 0x09:
2596                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
2597
2598                 lastLParam = LParam;
2599                 curTaskState = 'A';
2600                 break;
2601             case 0x0a:
2602                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
2603             case 0x0b:
2604                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
2605
2606                 lastLParam = LParam;
2607                 curTaskState = 'B';
2608                 break;
2609             case 0x10:
2610                 m_InputCell.bpp = true;
2611                 m_InputCell.bpn = false;
2612                 break;
2613             case 0x11:
2614                 m_InputCell.bpp = false;
2615                 m_InputCell.bpn = true;
2616                 break;
2617             case 0x12:
2618                 m_InputCell.bpp = false;
2619                 m_InputCell.bpn = false;
2620                 break;
2621             case 0x13:
2622                 switch (lastLParam)
2623                 {
2624                 case 3:
2625                 case 6:
2626                 case 7:
2627                 case 0x15:
2628                 case 0x17:
2629                 case 0x16:
2630                 case 0x18:
2631                 case 0x20:
2632                 case 0x21:
2633                 case 0x22:
2634                     m_InputCell.OP = CMTerm1View::typeNOT;
2635                     clickCounterNot = 0;
2636                     curTaskState = 'A';
2637                 default:
2638                     break;
2639                 }
2640                 switch (lastLParam)
2641                 {
2642                 case 0x01:
2643                     m_InputCell.OP = CMTerm1View::typeNC; break;
2644                 case 0x02:
2645                     m_InputCell.OP = CMTerm1View::typeNC;
2646                     m_InputCell.bLeftLineUp = true;
2647                     m_InputCell.brightLineUp = true;
2648                     break;
2649                 default:
2650                     break;
2651                 }
2652                 lastLParam = LParam;
2653                 m_InputCell.bnot = true;
2654
2655                 break;
2656             case 0x14:
2657                 m_InputCell.bnot = false;
2658                 break;
2659             case 0x15:
2660                 m_InputCell.bDouble = true;
2661                 m_InputCell.bDouble1 = false;
2662                 m_InputCell.bFloat = false;
2663                 m_InputCell.bFloat1 = false;
2664                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2665                 break;
2666             case 0x17:
2667                 m_InputCell.bDouble = false;
2668                 m_InputCell.bDouble1 = true;
2669                 m_InputCell.bFloat = false;
2670                 m_InputCell.bFloat1 = false;
2671                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2672                 break;
2673             case 0x16:
2674                 m_InputCell.bDouble = false;
2675                 m_InputCell.bDouble1 = false;
2676                 m_InputCell.bFloat = true;
2677                 m_InputCell.bFloat1 = false;
2678                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2679                 break;
2680             case 0x18:
2681                 m_InputCell.bDouble = false;
2682                 m_InputCell.bDouble1 = false;
2683                 m_InputCell.bFloat = false;
2684                 m_InputCell.bFloat1 = true;
2685                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2686                 break;
2687             default:
2688                 break;
2689             }
2690             if (curTaskState != 'D')
2691             {
2692                 m_InputCell.num.Empty();
2693             }
2694         }
2695         else if (HParam == 0x2)
2696         {
2697             switch (LParam)
2698             {
2699             case 1:
2700                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
2701             case 2:
2702                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
2703             case 3:
2704                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
2705             case 4:
2706                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
2707             case 5:
2708                 strParam = _T(" P"); curTaskState = 'C'; break;
2709             case 6:
2710                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
2711             case 7:
2712                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
2713             case 8:
2714                 strParam = _T(" E"); curTaskState = 'C'; break;
2715             case 9:
2716                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
2717             case 0x0a:
2718                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
2719             case 0x0b:
2720                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
2721             case 0x0c:
2722                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
2723             case 0x0d:
2724                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2725                 {
2726                     m_InputCell.OP = CMTerm1View::typeNO;
2727                     m_InputCell.bnot = false;
2728                     m_InputCell.bpp = false;
2729                     m_InputCell.bpn = false;
2730                     clickCounter = 0;
2731                     clickCounterNot = 0;
2732                     clickCounterDF = 0;
2733                     clickCounterD = 0;
2734                     clickCounterF = 0;
2735                 }
2736                 lastLParam = 0x20;
2737                 m_InputCell.bcmpEq = true;
2738                 if (lastCMP != LParam)
2739                 {
2740                     clickCounterCMP++;
2741                 }
2742                 else
2743                 {
2744                     clickCounterCMP = 1;
2745                     m_InputCell.bcmpGt = false;
2746                     m_InputCell.bcmpLt = false;
2747                 }
2748
2749                 if (clickCounterCMP > 2)
2750                 {
2751                     clickCounterCMP = 1;
2752                     m_InputCell.bcmpGt = false;
2753                     m_InputCell.bcmpLt = false;
2754                 }
2755                 lastCMP = LParam;
2756                 curTaskState = 'B'; break;
2757             case 0x0e:
2758                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2759                 {
2760                     m_InputCell.OP = CMTerm1View::typeNO;
2761                     m_InputCell.bnot = false;
2762                     m_InputCell.bpp = false;
2763                     m_InputCell.bpn = false;
2764                     clickCounter = 0;
2765                     clickCounterNot = 0;
2766                     clickCounterDF = 0;
2767                     clickCounterD = 0;
2768                     clickCounterF = 0;
2769                 }
2770                 lastLParam = 0x21;
2771                 m_InputCell.bcmpGt = true;
2772                 if (lastCMP != LParam)
2773                 {
2774                     clickCounterCMP++;
2775                 }
2776                 else
2777                 {
2778                     clickCounterCMP = 1;
2779                     m_InputCell.bcmpEq = false;
2780                     m_InputCell.bcmpLt = false;
2781                 }
2782                 if (clickCounterCMP > 2)
2783                 {
2784                     clickCounterCMP = 1;
2785                     m_InputCell.bcmpEq = false;
2786                     m_InputCell.bcmpLt = false;
2787                 }
2788                 lastCMP = LParam;
2789                 curTaskState = 'B'; break;
2790             case 0x0f:
2791                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2792                 {
2793                     m_InputCell.OP = CMTerm1View::typeNO;
2794                     m_InputCell.bnot = false;
2795                     m_InputCell.bpp = false;
2796                     m_InputCell.bpn = false;
2797                     clickCounter = 0;
2798                     clickCounterNot = 0;
2799                     clickCounterDF = 0;
2800                     clickCounterD = 0;
2801                     clickCounterF = 0;
2802                 }
2803                 lastLParam = 0x22;
2804                 m_InputCell.bcmpLt = true;
2805                 if (lastCMP != LParam)
2806                 {
2807                     clickCounterCMP++;
2808                 }
2809                 else
2810                 {
2811                     clickCounterCMP = 1;
2812                     m_InputCell.bcmpEq = false;
2813                     m_InputCell.bcmpGt = false;
2814                 }
2815                 if (clickCounterCMP > 2)
2816                 {
2817                     clickCounterCMP = 1;
2818                     m_InputCell.bcmpEq = false;
2819                     m_InputCell.bcmpGt = false;
2820                 }
2821                 lastCMP = LParam;
2822                 curTaskState = 'B'; break;
2823             default:
2824                 break;
2825             }
2826             if (curTaskState != 'D')
2827             {
2828                 m_InputCell.num.Empty();
2829             }
2830         }
2831         else if (HParam == 0x3)
2832         {
2833             switch (LParam)
2834             {
2835             case 0:
2836                 strNumTemp = _T("0"); curTaskState = 'D'; break;
2837             case 1:
2838                 strNumTemp = _T("1"); curTaskState = 'D'; break;
2839             case 2:
2840                 strNumTemp = _T("2"); curTaskState = 'D'; break;
2841             case 3:
2842                 strNumTemp = _T("3"); curTaskState = 'D'; break;
2843             case 4:
2844                 strNumTemp = _T("4"); curTaskState = 'D'; break;
2845             case 5:
2846                 strNumTemp = _T("5"); curTaskState = 'D'; break;
2847             case 6:
2848                 strNumTemp = _T("6"); curTaskState = 'D'; break;
2849             case 7:
2850                 strNumTemp = _T("7"); curTaskState = 'D'; break;
2851             case 8:
2852                 strNumTemp = _T("8"); curTaskState = 'D'; break;
2853             case 9:
2854                 strNumTemp = _T("9"); curTaskState = 'D'; break;
2855             case 0x0A:
2856                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2857                     ;                        //state not change
2858                 else
2859                 {
2860                     strNumTemp = _T("A"); curTaskState = 'D';
2861                 }
2862                 break;
2863             case 0x0B:
2864                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2865                     ;
2866                 else
2867                 {
2868                     strNumTemp = _T("B"); curTaskState = 'D';
2869                 }
2870                 break;
2871             case 0x0C:
2872                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2873                     ;
2874                 else
2875                 {
2876                     strNumTemp = _T("C"); curTaskState = 'D';
2877                 }
2878                 break;
2879             case 0x0D:
2880                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2881                     ;
2882                 else
2883                 {
2884                     strNumTemp = _T("D"); curTaskState = 'D';
2885                 }
2886                 break;
2887
2888             case 0x0E:
2889                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2890                     ;
2891                 else
2892                 {
2893                     strNumTemp = _T("E"); curTaskState = 'D';
2894                 }
2895                 break;
2896             case 0x0F:
2897                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2898                     ;
2899                 else
2900                 {
2901                     strNumTemp = _T("F"); curTaskState = 'D';
2902                 }
2903                 break;
2904             default:
2905                 break;
2906             }
2907
2908             if (m_InputCell.num.GetLength() < 4)
2909             {
2910                 m_InputCell.num.Append(strNumTemp);
2911             }
2912             else
2913             {
2914                 m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2915                 m_InputCell.num.Append(strNumTemp);
2916
2917                 for (int i = 0; i < m_InputCell.num.GetLength(); i++)
2918                 {
2919                     if (m_InputCell.num[i] == _T('0'))
2920                     {
2921                         ;
2922                     }
2923                     else
2924                     {
2925                         flag = 1; break;
2926                     }
2927
2928                 }
2929                 if (flag == 0)
2930                 {
2931                     m_InputCell.num.Empty();
2932                     m_InputCell.num.Append(_T("0"));
2933                 }
2934             }
2935             int num = m_InputCell.num.GetLength();
2936             for (int i = 0; i < num; i++)
2937             {
2938                 int len1 = m_InputCell.num.GetLength();
2939                 if (len1 > 1 && m_InputCell.num[0] == _T('0')) m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2940             }
2941
2942         }
2943
2944
2945         break;
2946     }    //end switch
2947     if (HParam == 0x14)
2948     {
2949         bool editEndFlag = false;                                              //********************************************************************************************************
2950
2951         switch (m_InputCell.OP)
2952         {
2953         case CMTerm1View::typeNO:
2954         case CMTerm1View::typeNC:
2955         case CMTerm1View::typeOUT:
2956         case CMTerm1View::typeSET:
2957         case CMTerm1View::typeRESET:
2958         case CMTerm1View::typeTM:
2959             if (curTaskState == 'D')
2960             {
2961                 editEndFlag = true;
2962             }
2963         case CMTerm1View::typeDF:
2964         case CMTerm1View::typeDF_:
2965             if (curTaskState == 'A')
2966             {
2967                 editEndFlag = true;
2968             }
2969         default:
2970             break;
2971         }
2972
2973         if ((m_InputCell.bcmpEq) || (m_InputCell.bcmpGt) || (m_InputCell.bcmpLt))
2974         {
2975             editEndFlag = true;
2976         }
2977
2978         if (editEndFlag)
2979         {
2980             CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2981             p1->GetInputCell(m_InputCell);
2982         }
2983         else
2984         {
2985             CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2986             CString str = _T("无法确定指令输入");
2987             //p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0)); 
2988             p1->m_wndStatusBar.SetPaneText(0, str);
2989         }
2990
2991     }
2992
2993     display(m_InputCell);
2994     return 0;
2995 }
2996
2997 int CMyFormInputShow::SetDisplay1(int inputInfo)
2998 {
2999     // TODO: 在此处添加实现代码.
3000
3001     return 0;
3002 }
3003
3004
3005 void CMyFormInputShow::OnBnClickedBtnAnd()
3006 {
3007
3008     SetDisplay(0x00010001);
3009
3010     SetBtnDisplay(1);
3011 }
3012
3013 void CMyFormInputShow::OnBnClickedBtnOr()
3014 {
3015
3016     //    CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3017     //    p1->GetInputInfo(0x00010002);
3018
3019     SetDisplay(0x00010002);
3020     SetBtnDisplay(1);
3021 }
3022
3023 void CMyFormInputShow::OnBnClickedBtnVline()
3024 {
3025
3026     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3027     //p1->GetInputInfo(_T("|"));
3028 }
3029
3030 void CMyFormInputShow::OnBnClickedBtnOut()
3031 {
3032
3033     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3034     p1->GetInputInfo(0x00010003);
3035
3036     SetDisplay(0x00010003);
3037     SetBtnDisplay(1);
3038 }
3039 void CMyFormInputShow::OnBnClickedBtnTmCt()
3040 {
3041
3042     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3043     p1->GetInputInfo(0x0001000b);
3044
3045     SetDisplay(0x0001000b);
3046
3047     SetBtnDisplay(5);
3048 }
3049 void CMyFormInputShow::OnBnClickedBtnFun()
3050 {
3051
3052     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3053     //p1->GetInputInfo(_T("Fun "));
3054 }
3055 void CMyFormInputShow::OnBnClickedBtnHLine()
3056 {
3057
3058     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3059     //p1->GetInputInfo(_T("——"));
3060 }
3061 void CMyFormInputShow::OnBnClickedBtnNot()                  /****************************************************************************/
3062 {
3063
3064     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3065     p1->GetInputInfo(0x00010013);
3066
3067     SetDisplay(0x00010013);
3068
3069     SetBtnDisplay(1);
3070 }
3071 void CMyFormInputShow::OnBnClickedBtnIndex()
3072 {
3073
3074     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3075     //p1->GetInputInfo(_T("Index "));
3076     SetBtnDisplay(4);
3077 }
3078 void CMyFormInputShow::OnBnClickedBtnMc()
3079 {
3080
3081     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3082     p1->GetInputInfo(0x00010004);
3083
3084     SetDisplay(0x00010004);
3085 }
3086 void CMyFormInputShow::OnBnClickedBtnMce()
3087 {
3088
3089     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3090     p1->GetInputInfo(0x00010005);
3091
3092     SetDisplay(0x00010005);
3093 }
3094 void CMyFormInputShow::OnBnClickedBtnSet()
3095 {
3096
3097     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3098     p1->GetInputInfo(0x00010006);
3099
3100     SetDisplay(0x00010006);
3101     SetBtnDisplay(1);
3102 }
3103 void CMyFormInputShow::OnBnClickedBtnReset()
3104 {
3105
3106     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3107     p1->GetInputInfo(0x00010007);
3108
3109     SetDisplay(0x00010007);
3110
3111     SetBtnDisplay(1);
3112 }
3113 void CMyFormInputShow::OnBnClickedBtnDf()
3114 {
3115
3116
3117     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3118     p1->GetInputInfo(0x00010008);
3119
3120     SetDisplay(0x00010008);
3121
3122
3123     //p1->GetInputInfo(_T("(DF)"));
3124 }
3125 void CMyFormInputShow::OnBnClickedBtnEnd()
3126 {
3127
3128     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3129     p1->GetInputInfo(0x0001000A);
3130
3131     SetDisplay(0x0001000A);
3132 }
3133 void CMyFormInputShow::OnBnClickedBtnCompare()
3134 {
3135
3136     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3137     //p1->GetInputInfo(_T("Compare"));
3138     SetBtnDisplay(2);
3139 }
3140 void CMyFormInputShow::OnBnClickedBtnPFun()
3141 {
3142
3143     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3144     //p1->GetInputInfo(_T("PFun"));
3145 }
3146 void CMyFormInputShow::OnBnClickedBtnUpDown()
3147 {
3148
3149     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3150     p1->GetInputInfo(0x00010010);
3151
3152     SetDisplay(0x00010010);
3153
3154     SetBtnDisplay(1);
3155 }
3156 void CMyFormInputShow::OnBnClickedBtnBit()
3157 {
3158
3159     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3160     //p1->GetInputInfo(_T("Bit"));
3161     SetBtnDisplay(1);
3162 }
3163 void CMyFormInputShow::OnBnClickedBtnWord()
3164 {
3165
3166     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3167     //p1->GetInputInfo(_T("Word"));
3168     SetBtnDisplay(3);
3169 }
3170 void CMyFormInputShow::OnBnClickedBtnInc1()
3171 {
3172
3173     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3174     //p1->GetInputInfo(_T("Inc1"));
3175 }
3176 void CMyFormInputShow::OnBnClickedBtnInc2()
3177 {
3178
3179     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3180     //p1->GetInputInfo(_T("Inc2"));
3181 }
3182
3183
3184 void CMyFormInputShow::OnBnClickedBtnPgConvert()
3185 {
3186
3187     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3188     //p1->GetInputInfo(_T("PgConvert"));
3189 }
3190 void CMyFormInputShow::OnBnClickedBtnOnline()
3191 {
3192
3193     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3194     //p1->GetInputInfo(_T("Online"));
3195 }
3196 void CMyFormInputShow::OnBnClickedBtnOffline()
3197 {
3198
3199     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3200     //p1->GetInputInfo(_T("Offline"));
3201 }
3202 void CMyFormInputShow::OnBnClickedBtnClose()
3203 {
3204
3205     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3206     //p1->GetInputInfo(_T("Close"));
3207 }
3208 void CMyFormInputShow::OnBnClickedBtnFind()
3209 {
3210
3211     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3212     //p1->GetInputInfo(_T("Find"));
3213 }
3214 void CMyFormInputShow::OnBnClickedBtnNextWin()
3215 {
3216
3217     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3218     //p1->GetInputInfo(_T("NextWin"));
3219 }
3220 void CMyFormInputShow::OnBnClickedBtnMonitor()
3221 {
3222
3223     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3224     //p1->GetInputInfo(_T("Monitor"));
3225 }
3226 void CMyFormInputShow::OnBnClickedBtnStatus()
3227 {
3228
3229     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3230     //p1->GetInputInfo(_T("Status"));
3231 }
3232 void CMyFormInputShow::OnBnClickedBtnRunProg()
3233 {
3234
3235     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3236     //p1->GetInputInfo(_T("RunProg"));
3237 }
3238 void CMyFormInputShow::OnBnClickedBtnPlcRead()
3239 {
3240
3241     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3242     //p1->GetInputInfo(_T("PlcRead"));
3243 }
3244 void CMyFormInputShow::OnBnClickedBtnPlcWrite()
3245 {
3246
3247     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3248     //p1->GetInputInfo(_T("PlcWrite"));
3249 }
3250
3251
3252 void CMyFormInputShow::OnBnClickedBtnX()
3253 {
3254
3255     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3256     p1->GetInputInfo(0x00020001);
3257
3258     SetDisplay(0x00020001);
3259 }
3260 void CMyFormInputShow::OnBnClickedBtnY()
3261 {
3262
3263     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3264     p1->GetInputInfo(0x00020002);
3265
3266     SetDisplay(0x00020002);
3267 }
3268 void CMyFormInputShow::OnBnClickedBtnR()
3269 {
3270
3271     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3272     p1->GetInputInfo(0x00020003);
3273
3274     SetDisplay(0x00020003);
3275 }
3276 void CMyFormInputShow::OnBnClickedBtnL()
3277 {
3278
3279     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3280     p1->GetInputInfo(0x00020004);
3281
3282     SetDisplay(0x00020004);
3283 }
3284 void CMyFormInputShow::OnBnClickedBtnP()
3285 {
3286
3287     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3288     p1->GetInputInfo(0x00020005);
3289
3290     SetDisplay(0x00020005);
3291 }
3292
3293 void CMyFormInputShow::OnBnClickedBtnCompare1()
3294 {
3295     SetBtnDisplay(2);
3296 }
3297 void CMyFormInputShow::OnBnClickedBtnT()
3298 {
3299
3300     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3301     p1->GetInputInfo(0x00020006);
3302
3303     SetDisplay(0x00020006);
3304 }
3305 void CMyFormInputShow::OnBnClickedBtnC()
3306 {
3307
3308     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3309     p1->GetInputInfo(0x00020007);
3310
3311     SetDisplay(0x00020007);
3312 }
3313 void CMyFormInputShow::OnBnClickedBtnE()
3314 {
3315
3316     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3317     p1->GetInputInfo(0x00020008);
3318
3319     SetDisplay(0x00020008);
3320 }
3321
3322
3323 void CMyFormInputShow::OnBnClickedBtnTmx()
3324 {
3325     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3326     p1->GetInputInfo(0x00020009);
3327
3328     SetDisplay(0x00020009);
3329     SetBtnDisplay(0);
3330 }
3331 void CMyFormInputShow::OnBnClickedBtnTmy()
3332 {
3333     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3334     p1->GetInputInfo(0x0002000A);
3335
3336     SetDisplay(0x0002000A);
3337     SetBtnDisplay(1);
3338 }
3339 void CMyFormInputShow::OnBnClickedBtnTmr()
3340 {
3341     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3342     p1->GetInputInfo(0x0002000B);
3343
3344     SetDisplay(0x0002000B);
3345     SetBtnDisplay(0);
3346 }
3347 void CMyFormInputShow::OnBnClickedBtnTml()
3348 {
3349     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3350     p1->GetInputInfo(0x0002000C);
3351
3352     SetDisplay(0x0002000C);
3353     SetBtnDisplay(0);
3354 }
3355 void CMyFormInputShow::OnBnClickedBtnCt()
3356 {
3357     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3358     p1->GetInputInfo(0x0002000D);
3359
3360     SetDisplay(0x0002000D);
3361
3362     SetBtnDisplay(0);
3363 }
3364
3365
3366 void CMyFormInputShow::OnBnClickedBtnD()
3367 {
3368     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3369     p1->GetInputInfo(0x00010015);
3370
3371     SetDisplay(0x00010015);
3372
3373 }
3374 void CMyFormInputShow::OnBnClickedBtnF()
3375 {
3376     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3377     p1->GetInputInfo(0x00010016);
3378
3379     SetDisplay(0x00010016);
3380
3381 }
3382 void CMyFormInputShow::OnBnClickedBtnNEQ()
3383 {
3384     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3385     p1->GetInputInfo(0x0002000D);
3386
3387     SetDisplay(0x0002000D);
3388 }
3389
3390 void CMyFormInputShow::OnBnClickedBtnGT()
3391 {
3392     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3393     p1->GetInputInfo(0x0002000E);
3394
3395     SetDisplay(0x0002000E);
3396 }
3397 void CMyFormInputShow::OnBnClickedBtnLT()
3398 {
3399     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3400     p1->GetInputInfo(0x0002000F);
3401
3402     SetDisplay(0x0002000F);
3403 }
3404
3405
3406 void CMyFormInputShow::OnBtn0()
3407 {
3408     // TODO: 在此添加命令处理程序代码
3409     SetDisplay(0x00030000);
3410 }
3411 void CMyFormInputShow::OnBtn1()
3412 {
3413     // TODO: 在此添加命令处理程序代码
3414     SetDisplay(0x00030001);
3415 }
3416 void CMyFormInputShow::OnBtn2()
3417 {
3418     // TODO: 在此添加命令处理程序代码
3419     SetDisplay(0x00030002);
3420 }
3421 void CMyFormInputShow::OnBtn3()
3422 {
3423     // TODO: 在此添加命令处理程序代码
3424     SetDisplay(0x00030003);
3425 }
3426 void CMyFormInputShow::OnBtn4()
3427 {
3428     // TODO: 在此添加命令处理程序代码
3429     SetDisplay(0x00030004);
3430 }
3431 void CMyFormInputShow::OnBtn5()
3432 {
3433     // TODO: 在此添加命令处理程序代码
3434     SetDisplay(0x00030005);
3435 }
3436 void CMyFormInputShow::OnBtn6()
3437 {
3438     // TODO: 在此添加命令处理程序代码
3439     SetDisplay(0x00030006);
3440 }
3441 void CMyFormInputShow::OnBtn7()
3442 {
3443     // TODO: 在此添加命令处理程序代码
3444     SetDisplay(0x00030007);
3445 }
3446 void CMyFormInputShow::OnBtn8()
3447 {
3448     // TODO: 在此添加命令处理程序代码
3449     SetDisplay(0x00030008);
3450 }
3451 void CMyFormInputShow::OnBtn9()
3452 {
3453     // TODO: 在此添加命令处理程序代码
3454     SetDisplay(0x00030009);
3455 }
3456 void CMyFormInputShow::OnBtnA()
3457 {
3458     // TODO: 在此添加命令处理程序代码
3459     SetDisplay(0x0003000A);
3460 }
3461 void CMyFormInputShow::OnBtnB()
3462 {
3463     // TODO: 在此添加命令处理程序代码
3464     SetDisplay(0x0003000B);
3465 }
3466 void CMyFormInputShow::OnBtnC()
3467 {
3468     // TODO: 在此添加命令处理程序代码
3469     SetDisplay(0x0003000C);
3470 }
3471
3472 void CMyFormInputShow::OnBtnD()
3473 {
3474     // TODO: 在此添加命令处理程序代码
3475     SetDisplay(0x0003000D);
3476 }
3477 void CMyFormInputShow::OnBtnE()
3478 {
3479     // TODO: 在此添加命令处理程序代码
3480     SetDisplay(0x0003000E);
3481 }
3482 void CMyFormInputShow::OnBtnF()
3483 {
3484     // TODO: 在此添加命令处理程序代码
3485
3486     SetDisplay(0x0003000F);
3487 }
3488 void CMyFormInputShow::OnBtnMinus()
3489 {
3490     // TODO: 在此添加命令处理程序代码
3491     //m_wndDlgBar_InputShow.SetDisplay(_T("-"));
3492 }
3493 void CMyFormInputShow::OnBtnDot()
3494 {
3495     // TODO: 在此添加命令处理程序代码
3496     //m_wndDlgBar_InputShow.SetDisplay(_T("."));
3497 }
3498
3499
3500 void CMyFormInputShow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
3501 {
3502     // TODO: 在此添加消息处理程序代码和/或调用默认值
3503     if (nChar == 13) { OnBtnRet(); }
3504     CFormView::OnChar(nChar, nRepCnt, nFlags);
3505 }