2022-03-19 20:43:29 +08:00
|
|
|
|
|
|
|
|
|
// MainFrm.cpp: CMainFrame 类的实现
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
#include "framework.h"
|
|
|
|
|
|
2022-03-20 15:14:44 +08:00
|
|
|
|
#include "MCA.h"
|
2022-03-19 20:43:29 +08:00
|
|
|
|
#include "MainFrm.h"
|
2022-03-20 15:14:44 +08:00
|
|
|
|
#include "TotalView.h"
|
2022-06-02 10:08:38 +08:00
|
|
|
|
#include "DetailView.h"
|
|
|
|
|
#include "ControlView.h"
|
2022-03-20 15:14:44 +08:00
|
|
|
|
|
2022-03-19 20:43:29 +08:00
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// CMainFrame
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
|
|
|
|
ON_WM_CREATE()
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
static UINT indicators[] =
|
|
|
|
|
{
|
|
|
|
|
ID_SEPARATOR, // 状态行指示器
|
|
|
|
|
ID_INDICATOR_CAPS,
|
|
|
|
|
ID_INDICATOR_NUM,
|
|
|
|
|
ID_INDICATOR_SCRL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// CMainFrame 构造/析构
|
|
|
|
|
|
|
|
|
|
CMainFrame::CMainFrame() noexcept
|
|
|
|
|
{
|
|
|
|
|
// TODO: 在此添加成员初始化代码
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMainFrame::~CMainFrame()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
|
|
{
|
|
|
|
|
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
|
|
|
|
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
|
|
|
|
{
|
|
|
|
|
TRACE0("未能创建工具栏\n");
|
|
|
|
|
return -1; // 未能创建
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_wndStatusBar.Create(this))
|
|
|
|
|
{
|
|
|
|
|
TRACE0("未能创建状态栏\n");
|
|
|
|
|
return -1; // 未能创建
|
|
|
|
|
}
|
|
|
|
|
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
|
|
|
|
|
|
|
|
|
|
// TODO: 如果不需要可停靠工具栏,则删除这三行
|
|
|
|
|
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
|
|
|
EnableDocking(CBRS_ALIGN_ANY);
|
|
|
|
|
DockControlBar(&m_wndToolBar);
|
|
|
|
|
|
2022-05-31 22:21:20 +08:00
|
|
|
|
MoveWindow(0, 0, 2386, 1200);
|
|
|
|
|
CenterWindow();
|
2022-03-19 20:43:29 +08:00
|
|
|
|
|
2022-05-31 22:21:20 +08:00
|
|
|
|
OnLoadToolBarIcon();
|
2022-03-19 20:43:29 +08:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
|
|
|
|
|
CCreateContext* pContext)
|
|
|
|
|
{
|
2022-03-20 15:14:44 +08:00
|
|
|
|
// 左右拆分窗口,1行2列
|
|
|
|
|
VERIFY(m_wndSplitter.CreateStatic(this, 1, 2,
|
|
|
|
|
WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST));
|
|
|
|
|
// 左侧窗口创建视图,第0行第0列
|
|
|
|
|
VERIFY(m_wndSplitter.CreateView(0, 0,
|
2022-05-31 22:21:20 +08:00
|
|
|
|
RUNTIME_CLASS(CControlView), CSize(300, 0), pContext));
|
2022-03-20 15:14:44 +08:00
|
|
|
|
// 右侧窗口上下拆分,2行1列
|
2022-05-31 22:21:20 +08:00
|
|
|
|
VERIFY(m_wndSplitter2.CreateStatic(&m_wndSplitter, 2, 1,
|
2022-03-20 15:14:44 +08:00
|
|
|
|
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 1)));
|
|
|
|
|
// 右上窗口创建视图,第0行第0列
|
2022-05-31 22:21:20 +08:00
|
|
|
|
VERIFY(m_wndSplitter2.CreateView(0, 0,
|
|
|
|
|
RUNTIME_CLASS(CTotalView), CSize(2086, 400), pContext));
|
2022-03-20 15:14:44 +08:00
|
|
|
|
// 右下窗口创建视图,第1行第0列
|
2022-05-31 22:21:20 +08:00
|
|
|
|
VERIFY(m_wndSplitter2.CreateView(1, 0,
|
|
|
|
|
RUNTIME_CLASS(CDetailView), CSize(2086, 0), pContext));
|
|
|
|
|
|
2022-03-20 15:14:44 +08:00
|
|
|
|
return TRUE;
|
2022-03-19 20:43:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
|
|
|
{
|
|
|
|
|
if( !CFrameWnd::PreCreateWindow(cs) )
|
|
|
|
|
return FALSE;
|
2022-05-31 22:21:20 +08:00
|
|
|
|
cs.style &= ~WS_THICKFRAME;
|
|
|
|
|
cs.style &= ~WS_MAXIMIZEBOX;
|
2022-03-19 20:43:29 +08:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CMainFrame 诊断
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
void CMainFrame::AssertValid() const
|
|
|
|
|
{
|
|
|
|
|
CFrameWnd::AssertValid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMainFrame::Dump(CDumpContext& dc) const
|
|
|
|
|
{
|
|
|
|
|
CFrameWnd::Dump(dc);
|
|
|
|
|
}
|
|
|
|
|
#endif //_DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CMainFrame 消息处理程序
|
2022-05-31 22:21:20 +08:00
|
|
|
|
void CMainFrame::OnLoadToolBarIcon()
|
|
|
|
|
{
|
|
|
|
|
HICON icon;
|
|
|
|
|
m_imgList.Create(50, 50, TRUE | ILC_COLOR32, 10, 0);
|
|
|
|
|
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_START);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_STOP);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_CLEAR);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_FOLDER);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_SAVE);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_LEFT);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_RIGHT);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_UP);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_DOWN);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
icon = AfxGetApp()->LoadIconW(IDI_CLOSE);
|
|
|
|
|
m_imgList.Add(icon);
|
|
|
|
|
|
|
|
|
|
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_imgList);
|
|
|
|
|
}
|