From 4656e074123feced4aa1691c53a4aff85514cffa Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 09 一月 2025 11:00:26 +0800
Subject: [PATCH] 1.日志窗口的显示和隐藏(菜单操作);
---
SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp | 33 ++++++++++++++++++++++++++++++++-
SourceCode/Bond/BoounionPLC/BoounionPLCDlg.h | 3 +++
2 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
index 4930c5f..d8fc12f 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
+++ b/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 对话框
@@ -63,6 +66,7 @@
m_hbrBkgnd = nullptr;
m_pActiveView = nullptr;
m_pPageLogcat = nullptr;
+ m_bShowLogWnd = TRUE;
}
void CBoounionPLCDlg::DoDataExchange(CDataExchange* pDX)
@@ -81,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)
@@ -199,7 +205,7 @@
m_pPageLogcat = new CPageLogcat();
m_pPageLogcat->Create(IDD_PAGE_LOGCAT, m_pMainContainer);
m_pPageLogcat->ShowWindow(SW_SHOW);
- m_pMainContainer->SetBottomWnd(m_pPageLogcat, 220);
+ m_pMainContainer->SetBottomWnd(m_pPageLogcat, LOG_WND_HEIGHT);
// 菜单
@@ -436,6 +442,31 @@
pCmdUI->Enable(TRUE);
}
+void CBoounionPLCDlg::OnMenuWndLog()
+{
+ m_bShowLogWnd = !m_bShowLogWnd;
+
+ if (m_bShowLogWnd) {
+ LOGD("显示日志窗口");
+ m_pPageLogcat->ShowWindow(SW_SHOW);
+ m_pPageLogcat->SetParent(m_pMainContainer);
+ m_pMainContainer->SetBottomWnd(m_pPageLogcat, LOG_WND_HEIGHT);
+ m_pMainContainer->Resize();
+ }
+ else {
+ LOGD("隐藏日志窗口");
+ 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;
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.h b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.h
index 60b7a7b..b159c87 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.h
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.h
@@ -50,6 +50,7 @@
// 实现
protected:
HICON m_hIcon;
+ BOOL m_bShowLogWnd;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
@@ -64,6 +65,8 @@
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnMenuFileSettings();
afx_msg void OnUpdateMenuFileSettings(CCmdUI* pCmdUI);
+ afx_msg void OnMenuWndLog();
+ afx_msg void OnUpdateMenuWndLog(CCmdUI* pCmdUI);
afx_msg void OnMenuFileExit();
afx_msg void OnUpdateMenuFileExit(CCmdUI* pCmdUI);
afx_msg void OnMenuHelpAbout();
--
Gitblit v1.9.3