QuakeGod
2024-12-24 61deef5cdf96cbfdd6ad45be49e80d597c00ca65
MTerm1/MainFrm.cpp
@@ -14,6 +14,8 @@
#include "MTerm1TestView.h"
#include "MTerm1ProgTxt.h"
#include <windows.h>
#include "MyChildFrm.h"
#include "MyChildFrmConfig.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -42,9 +44,12 @@
//   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)
ON_COMMAND(ID_MENU_SHOWNAV, &CMainFrame::OnMenuShownav)
   ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog)
   ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev)
   ON_COMMAND(ID_MENU_SHOWNAV, &CMainFrame::OnMenuShownav)
   ON_COMMAND(ID_COMMTEST, &CMainFrame::OnCommtest)
   ON_COMMAND(ID_DEVICE_CONFIG, &CMainFrame::OnDeviceConfig)
END_MESSAGE_MAP()
static UINT indicators[] =
@@ -83,7 +88,7 @@
//   m_dlgMyLog.ShowWindow(SW_SHOW);
//   BOOL bNameValid;
   CMainFrame::EnableLoadDockState(FALSE);
   // 创建类视图
   CString strNavView;
//   bNameValid = strNavView.LoadString(IDS_CLASS_VIEW);
@@ -237,9 +242,16 @@
//   DockControlBar(&m_wndToolBar);
//   EnableDocking(CBRS_ALIGN_ANY);
   m_wndNavView.SetMinSize(CSize(300, 300));
   DockPane(&m_wndNavView);
   CDockablePane* pTabbedBar = nullptr;
//   m_wndMyPaneLog.AttachToTabWnd(&m_wndNavView, DM_SHOW, TRUE,&pTabbedBar);
//   m_wndNavView.AttachToTabWnd(&m_wndMyPaneLog, DM_SHOW, TRUE, &pTabbedBar);
   m_wndMyPaneLog.SetMinSize(CSize(300, 300));
   m_wndMyPaneLog.DockToWindow(&m_wndNavView, CBRS_BOTTOM);
//   DockPane(&m_wndMyPaneLog);
//   CDockablePane* pTabbedBar = nullptr;
//   m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
@@ -262,9 +274,9 @@
//   DockPane(&m_wndDlgBar_Func_Key);
//   DockControlBar(&m_wndDlgBar_Func_Key);
   DockPane(&m_wndMyPaneInputShow);
   DockPane(&m_wndNavView);
   DockPane(&m_wndMyPaneLog);
   m_wndNavView.SetMinSize(CSize(0, 0));
   m_wndMyPaneLog.SetMinSize(CSize(0, 0));
//   DockPane(pTabbedBar);
//   m_wndMyPaneInputShow.m_pMyFormInputShow->SetBtnDisplayESC(1);
//*/
@@ -477,3 +489,86 @@
   // TODO: 在此添加命令处理程序代码
   m_wndNavView.ShowWindow(SW_SHOW);
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
   // TODO: 在此添加专用代码和/或调用基类
   UINT  nCode = pMsg->wParam;
   if (pMsg->message == WM_KEYDOWN)
   {
      if ((nCode == _T('A') || nCode == _T('C') || nCode == _T('X') || nCode == _T('V')|| nCode == _T('Z') || nCode == _T('Y'))
         && (::GetKeyState(VK_CONTROL) & 0x8000))
      {
         ::TranslateMessage(pMsg);
         ::DispatchMessage(pMsg);
         return TRUE;
      }
   }
   return CMDIFrameWndEx::PreTranslateMessage(pMsg);
}
void CMainFrame::OnCommtest()
{
   // TODO: 在此添加命令处理程序代码
//   this->LockWindowUpdate();
   if (m_pCommDevView == nullptr) {
/*
      CRect rectWndClient;
      GetClientRect(&rectWndClient);
      rectWndClient.left = 200;
      rectWndClient.right = 500;
      rectWndClient.top = 200;
      rectWndClient.bottom = 500;
      CFrameWnd* pFrameWnd = new CFrameWnd();
      pFrameWnd->Create(_T("333"), _T("444"), WS_VISIBLE, rectWndClient, this);
      CRuntimeClass* pViewRuntimeClass = RUNTIME_CLASS(CMTerm1CommDevView);
      m_pCommDevView = (CMTerm1CommDevView*)pViewRuntimeClass->CreateObject();
      m_pCommDevView->Create(_T("1111"), _T("2222"), WS_VISIBLE | WS_CHILD | WS_MAXIMIZE, rectWndClient, pFrameWnd, 123, NULL);
      m_pCommDevView->OnInitialUpdate();
// */
      CMDIChildWnd * pChildWnd = this->CreateNewChild(RUNTIME_CLASS(CMyChildFrame), IDR_MTerm1TYPE);
/*
      CCreateContext cx;
      cx.m_pCurrentFrame = this;
      cx.m_pNewViewClass = RUNTIME_CLASS(CMTerm1CommDevView);
      cx.m_pCurrentDoc = NULL;
      cx.m_pLastView = NULL;
      cx.m_pNewDocTemplate = NULL;
      m_pCommDevView = DYNAMIC_DOWNCAST(CMTerm1CommDevView, pChildWnd->CreateView(&cx, 23456));
      if (!m_pCommDevView) {
      }
      else {
         RecalcLayout();
         m_pCommDevView->ShowWindow(SW_SHOW);
         m_pCommDevView->UpdateWindow();
      }
*/
      //   pChildWnd->LoadFrame(IDD_MTerm1CommDevView2, WS_VISIBLE | WS_CHILD, this,&cx);
//      pChildWnd->CreateView(&cx, 23456);
   }
//   this->UnlockWindowUpdate();
}
void CMainFrame::OnDeviceConfig()
{
   // TODO: 在此添加命令处理程序代码
//   this->LockWindowUpdate();
   if (m_pConfigToolView == nullptr) {
      CMDIChildWnd* pChildWnd = this->CreateNewChild(RUNTIME_CLASS(CMyChildFrameConfig), IDR_MTerm1TYPE);
   }
   //   this->UnlockWindowUpdate();
}