LAPTOP-T815PCOQ\25526
2025-01-09 009eda749899fc85d3a75ad2016371f27436bf36
SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -9,12 +9,15 @@
#include "Common.h"
#include "PlcView.h"
#include "AlarmMonitor.h"
#include "Log.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define LOG_WND_HEIGHT      258
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
@@ -62,6 +65,8 @@
   m_crBkgnd = APP_MAIN_DLG_BACKGROUND;
   m_hbrBkgnd = nullptr;
   m_pActiveView = nullptr;
   m_pPageLogcat = nullptr;
   m_bShowLogWnd = TRUE;
}
void CBoounionPLCDlg::DoDataExchange(CDataExchange* pDX)
@@ -80,6 +85,8 @@
   ON_UPDATE_COMMAND_UI(ID_MENU_FILE_EXIT, &CBoounionPLCDlg::OnUpdateMenuFileExit)
   ON_COMMAND(ID_MENU_FILE_SETTINGS, &CBoounionPLCDlg::OnMenuFileSettings)
   ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SETTINGS, &CBoounionPLCDlg::OnUpdateMenuFileSettings)
   ON_COMMAND(ID_MENU_WND_LOG, &CBoounionPLCDlg::OnMenuWndLog)
   ON_UPDATE_COMMAND_UI(ID_MENU_WND_LOG, &CBoounionPLCDlg::OnUpdateMenuWndLog)
   ON_COMMAND(ID_MENU_HELP_ABOUT, &CBoounionPLCDlg::OnMenuHelpAbout)
   ON_WM_INITMENUPOPUP()
   ON_MESSAGE(ID_MSG_TOOLBAR_BTN_CLICKED, &CBoounionPLCDlg::OnToolbarBtnClicked)
@@ -114,6 +121,7 @@
               if (m_pActiveView->GetContext() != (void*)pPlc) {
                  m_pActiveView->SetWindowText(pPlc->getName().c_str());
                  m_pActiveView->SetContext(pPlc);
                  m_pActiveView->SendMessage(WM_NCPAINT, 0, 0);
               }
            }
         }
@@ -191,6 +199,13 @@
   m_pMainContainer = new CMainContainer();
   m_pMainContainer->Create(IDD_MAIN_CONTAINER, this);
   m_pMainContainer->ShowWindow(SW_SHOW);
   // 日志
   m_pPageLogcat = new CPageLogcat();
   m_pPageLogcat->Create(IDD_PAGE_LOGCAT, m_pMainContainer);
   m_pPageLogcat->ShowWindow(SW_SHOW);
   m_pMainContainer->SetBottomWnd(m_pPageLogcat, LOG_WND_HEIGHT);
   // 菜单
@@ -343,6 +358,12 @@
      m_pPagePlcList = nullptr;
   }
   
   if (m_pPageLogcat != nullptr) {
      m_pPageLogcat->DestroyWindow();
      delete m_pPageLogcat;
      m_pPageLogcat = nullptr;
   }
   if (m_pMainContainer != nullptr) {
      m_pMainContainer->DestroyWindow();
      delete m_pMainContainer;
@@ -427,6 +448,29 @@
   pCmdUI->Enable(TRUE);
}
void CBoounionPLCDlg::OnMenuWndLog()
{
   m_bShowLogWnd = !m_bShowLogWnd;
   if (m_bShowLogWnd) {
      m_pPageLogcat->ShowWindow(SW_SHOW);
      m_pPageLogcat->SetParent(m_pMainContainer);
      m_pMainContainer->SetBottomWnd(m_pPageLogcat, LOG_WND_HEIGHT);
      m_pMainContainer->Resize();
   }
   else {
      m_pPageLogcat->ShowWindow(SW_HIDE);
      m_pPageLogcat->SetParent(this);
      m_pMainContainer->SetBottomWnd(nullptr, 0);
      m_pMainContainer->Resize();
   }
}
void CBoounionPLCDlg::OnUpdateMenuWndLog(CCmdUI* pCmdUI)
{
   pCmdUI->SetCheck(m_bShowLogWnd);
}
void CBoounionPLCDlg::OnMenuHelpAbout()
{
   CAboutDlg dlgAbout;