QuakeGod
2023-10-20 0200a36062386b937567265e3ea01f93eaa8f1f5
MTerm2/MainFrm.cpp
@@ -13,6 +13,7 @@
#include "MTerm2CtrlView.h"
#include "MTerm2TestView.h"
#include "MTerm2ProgTxt.h"
#include <windows.h>
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -20,11 +21,11 @@
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
   ON_WM_CREATE()
   ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc)
   ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar)
   ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar)
@@ -36,12 +37,34 @@
   ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar)
   ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar)
   ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar)
   ON_COMMAND(ID_BUTTON_0, &CMainFrame::OnBtn0)
   ON_COMMAND(ID_BUTTON_1, &CMainFrame::OnBtn1)
   ON_COMMAND(ID_BUTTON_2, &CMainFrame::OnBtn2)
   ON_COMMAND(ID_BUTTON_3, &CMainFrame::OnBtn3)
   ON_COMMAND(ID_BUTTON_4, &CMainFrame::OnBtn4)
   ON_COMMAND(ID_BUTTON_5, &CMainFrame::OnBtn5)
   ON_COMMAND(ID_BUTTON_6, &CMainFrame::OnBtn6)
   ON_COMMAND(ID_BUTTON_7, &CMainFrame::OnBtn7)
   ON_COMMAND(ID_BUTTON_8, &CMainFrame::OnBtn8)
   ON_COMMAND(ID_BUTTON_9, &CMainFrame::OnBtn9)
   ON_COMMAND(ID_BUTTON_A, &CMainFrame::OnBtnA)
   ON_COMMAND(ID_BUTTON_B, &CMainFrame::OnBtnB)
   ON_COMMAND(ID_BUTTON_C, &CMainFrame::OnBtnC)
   ON_COMMAND(ID_BUTTON_D, &CMainFrame::OnBtnD)
   ON_COMMAND(ID_BUTTON_E, &CMainFrame::OnBtnE)
   ON_COMMAND(ID_BUTTON_F, &CMainFrame::OnBtnF)
   ON_COMMAND(ID_BUTTON_MINUS, &CMainFrame::OnBtnMinus)
   ON_COMMAND(ID_BUTTON_DOT, &CMainFrame::OnBtnDot)
   ON_COMMAND(ID_BUTTON_RET, &CMainFrame::OnBtnRet)
   ON_COMMAND(ID_BUTTON_INSERT, &CMainFrame::OnBtnInsert)
   ON_COMMAND(ID_BUTTON_DELETE, &CMainFrame::OnBtnDelete)
   ON_COMMAND(ID_BUTTON_ESC, &CMainFrame::OnBtnEsc)
//   ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds)
//   ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld)
//   ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl)
ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog)
ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev)
END_MESSAGE_MAP()
static UINT indicators[] =
@@ -202,6 +225,7 @@
   }
   m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
   m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH);
   //m_wndStatusBar.OnCtlColor();
/*
   if (!m_wndMyPaneLog.Create(_T("日志窗口"), this->GetParent(), CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
      | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
@@ -253,6 +277,7 @@
//*/
   return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
@@ -316,7 +341,7 @@
   m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE);
   m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW);
   ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE);
}
@@ -399,3 +424,219 @@
}
*/
int CMainFrame::GetInputInfo(int inputInfo)
{
   // TODO: 在此处添加实现代码.
   CString        m_InputInfo;
   CString s1;
   s1.Format(_T("From MainFrame , input %s"), m_InputInfo);
   SysLog(s1);
   m_wndDlgBar_InputShow.SetDisplay(inputInfo);
   return 0;
}
void CMainFrame::OnBtn0()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030000);
}
void CMainFrame::OnBtn1()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030001);
}
void CMainFrame::OnBtn2()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030002);
}
void CMainFrame::OnBtn3()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030003);
}
void CMainFrame::OnBtn4()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030004);
}
void CMainFrame::OnBtn5()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030005);
}
void CMainFrame::OnBtn6()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030006);
}
void CMainFrame::OnBtn7()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030007);
}
void CMainFrame::OnBtn8()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030008);
}
void CMainFrame::OnBtn9()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00030009);
}
void CMainFrame::OnBtnA()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000A);
}
void CMainFrame::OnBtnB()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000B);
}
void CMainFrame::OnBtnC()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000C);
}
void CMainFrame::OnBtnD()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000D);
}
void CMainFrame::OnBtnE()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000E);
}
void CMainFrame::OnBtnF()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x0003000F);
}
void CMainFrame::OnBtnMinus()
{
   // TODO: 在此添加命令处理程序代码
   //m_wndDlgBar_InputShow.SetDisplay(_T("-"));
}
void CMainFrame::OnBtnDot()
{
   // TODO: 在此添加命令处理程序代码
   //m_wndDlgBar_InputShow.SetDisplay(_T("."));
}
int CMainFrame::GetInputCell(CMyDlgBarInputShow::tagInputCell inputCell)
{
   localInputCell = inputCell;
   return 0;
}
void CMainFrame::OnBtnRet()
{
   // TODO: 在此添加命令处理程序代码
   CString strName;
    CMTerm2View::stCell cell1;
   CMDIChildWnd  *pChild = (CMDIChildWnd   *)GetActiveFrame();
   CView   *p1 = (CView*)pChild->GetActiveView();
   if (p1 == NULL) return;
   CMTerm2View * p2 = (CMTerm2View *)p1;
   m_wndDlgBar_InputShow.SetDisplay(0x00140000);
   switch (localInputCell.OP)
   {
   case CMTerm2View::typeNO:
   case CMTerm2View::typeNC:
   case CMTerm2View::typeOUT:
   case CMTerm2View::typeSET:
   case CMTerm2View::typeRESET:
   case CMTerm2View::typeTM:
      switch (localInputCell.param)
      {
      case KLCoilTypeX:
         strName = "X";
         break;
      case KLCoilTypeY:
         strName = "Y";
         break;
      case KLCoilTypeR:
         strName = "R";
         break;
      case KLCoilTypeLR:
         strName = "L";
         break;
      case KLCoilTypeT:
         strName = "T";
         break;
      case KLCoilTypeC:
         strName = "C";
         break;
      case OP_TMX:
         strName = "TMX   ";
      case OP_TMY:
         strName = "TMY   ";
      case OP_TMR:
         strName = "TMR   ";
      case OP_TML:
         strName = "TML   ";
      default:
         break;
      }
   default:
      break;
   }
   cell1.sCoilName = strName + localInputCell.num;
   cell1.nType = localInputCell.OP;
   //cell1.sCoilName = "R555";
   cell1.nProgStep = 0;
   cell1.bEditing = 1;
   cell1.sParam = "D88";
   cell1.bLeftLineUp = 0;
   cell1.nDataType = CMTerm2View::typeCoil;
   p2->GetIncToView(cell1);
   m_wndDlgBar_Func_Key.SetBtnDisplayESC();
}
void CMainFrame::OnBtnInsert()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00240000);
   m_wndDlgBar_Func_Key.SetBtnDisplayESC();
}
void CMainFrame::OnBtnDelete()
{
   // TODO: 在此添加命令处理程序代码
   m_wndDlgBar_InputShow.SetDisplay(0x00340000);
   m_wndDlgBar_Func_Key.SetBtnDisplayESC();
}
void CMainFrame::OnBtnEsc()
{
   // TODO: 在此添加命令处理程序代码
   //m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
   m_wndDlgBar_Func_Key.SetBtnDisplayESC();
}
void CMainFrame::OnMenuShowDev()
{
   // TODO: 在此添加命令处理程序代码
}