添加项目文件。

This commit is contained in:
FPCLinkYZT114 2025-06-01 17:46:29 +08:00
parent c2f948e8d2
commit 35c8e63f00
55 changed files with 3108 additions and 0 deletions

57
ChildFrm.cpp Normal file
View File

@ -0,0 +1,57 @@

// ChildFrm.cpp: CChildFrame 类的实现
//
#include "pch.h"
#include "framework.h"
#include "ProcessManager.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
END_MESSAGE_MAP()
// CChildFrame 构造/析构
CChildFrame::CChildFrame() noexcept
{
// TODO: 在此添加成员初始化代码
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式
if( !CMDIChildWndEx::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
// CChildFrame 诊断
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWndEx::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWndEx::Dump(dc);
}
#endif //_DEBUG
// CChildFrame 消息处理程序

35
ChildFrm.h Normal file
View File

@ -0,0 +1,35 @@

// ChildFrm.h: CChildFrame 类的接口
//
#pragma once
class CChildFrame : public CMDIChildWndEx
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame() noexcept;
// 特性
protected:
CSplitterWndEx m_wndSplitter;
public:
// 操作
public:
// 重写
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
};

323
ClassView.cpp Normal file
View File

@ -0,0 +1,323 @@

#include "pch.h"
#include "framework.h"
#include "MainFrm.h"
#include "ClassView.h"
#include "Resource.h"
#include "ProcessManager.h"
class CClassViewMenuButton : public CMFCToolBarMenuButton
{
friend class CClassView;
DECLARE_SERIAL(CClassViewMenuButton)
public:
CClassViewMenuButton(HMENU hMenu = nullptr) noexcept : CMFCToolBarMenuButton((UINT)-1, hMenu, -1)
{
}
virtual void OnDraw(CDC* pDC, const CRect& rect, CMFCToolBarImages* pImages, BOOL bHorz = TRUE,
BOOL bCustomizeMode = FALSE, BOOL bHighlight = FALSE, BOOL bDrawBorder = TRUE, BOOL bGrayDisabledButtons = TRUE)
{
pImages = CMFCToolBar::GetImages();
CAfxDrawState ds;
pImages->PrepareDrawImage(ds);
CMFCToolBarMenuButton::OnDraw(pDC, rect, pImages, bHorz, bCustomizeMode, bHighlight, bDrawBorder, bGrayDisabledButtons);
pImages->EndDrawImage(ds);
}
};
IMPLEMENT_SERIAL(CClassViewMenuButton, CMFCToolBarMenuButton, 1)
//////////////////////////////////////////////////////////////////////
// 构造/析构
//////////////////////////////////////////////////////////////////////
CClassView::CClassView() noexcept
{
m_nCurrSort = ID_SORTING_GROUPBYTYPE;
}
CClassView::~CClassView()
{
}
BEGIN_MESSAGE_MAP(CClassView, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_CONTEXTMENU()
ON_COMMAND(ID_CLASS_ADD_MEMBER_FUNCTION, OnClassAddMemberFunction)
ON_COMMAND(ID_CLASS_ADD_MEMBER_VARIABLE, OnClassAddMemberVariable)
ON_COMMAND(ID_CLASS_DEFINITION, OnClassDefinition)
ON_COMMAND(ID_CLASS_PROPERTIES, OnClassProperties)
ON_COMMAND(ID_NEW_FOLDER, OnNewFolder)
ON_WM_PAINT()
ON_WM_SETFOCUS()
ON_COMMAND_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnSort)
ON_UPDATE_COMMAND_UI_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnUpdateSort)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CClassView 消息处理程序
int CClassView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建视图:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if (!m_wndClassView.Create(dwViewStyle, rectDummy, this, 2))
{
TRACE0("未能创建类视图\n");
return -1; // 未能创建
}
// 加载图像:
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_SORT);
m_wndToolBar.LoadToolBar(IDR_SORT, 0, 0, TRUE /* 已锁定*/);
OnChangeVisualStyle();
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
// 所有命令将通过此控件路由,而不是通过主框架路由:
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
CMenu menuSort;
menuSort.LoadMenu(IDR_POPUP_SORT);
m_wndToolBar.ReplaceButton(ID_SORT_MENU, CClassViewMenuButton(menuSort.GetSubMenu(0)->GetSafeHmenu()));
CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0));
if (pButton != nullptr)
{
pButton->m_bText = FALSE;
pButton->m_bImage = TRUE;
pButton->SetImage(GetCmdMgr()->GetCmdImage(m_nCurrSort));
pButton->SetMessageWnd(this);
}
// 填入一些静态树视图数据(此处只需填入虚拟代码,而不是复杂的数据)
FillClassView();
return 0;
}
void CClassView::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
AdjustLayout();
}
void CClassView::FillClassView()
{
HTREEITEM hRoot = m_wndClassView.InsertItem(_T("FakeApp 类"), 0, 0);
m_wndClassView.SetItemState(hRoot, TVIS_BOLD, TVIS_BOLD);
HTREEITEM hClass = m_wndClassView.InsertItem(_T("CFakeAboutDlg"), 1, 1, hRoot);
m_wndClassView.InsertItem(_T("CFakeAboutDlg()"), 3, 3, hClass);
m_wndClassView.Expand(hRoot, TVE_EXPAND);
hClass = m_wndClassView.InsertItem(_T("CFakeApp"), 1, 1, hRoot);
m_wndClassView.InsertItem(_T("CFakeApp()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("InitInstance()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("OnAppAbout()"), 3, 3, hClass);
hClass = m_wndClassView.InsertItem(_T("CFakeAppDoc"), 1, 1, hRoot);
m_wndClassView.InsertItem(_T("CFakeAppDoc()"), 4, 4, hClass);
m_wndClassView.InsertItem(_T("~CFakeAppDoc()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("OnNewDocument()"), 3, 3, hClass);
hClass = m_wndClassView.InsertItem(_T("CFakeAppView"), 1, 1, hRoot);
m_wndClassView.InsertItem(_T("CFakeAppView()"), 4, 4, hClass);
m_wndClassView.InsertItem(_T("~CFakeAppView()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("GetDocument()"), 3, 3, hClass);
m_wndClassView.Expand(hClass, TVE_EXPAND);
hClass = m_wndClassView.InsertItem(_T("CFakeAppFrame"), 1, 1, hRoot);
m_wndClassView.InsertItem(_T("CFakeAppFrame()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("~CFakeAppFrame()"), 3, 3, hClass);
m_wndClassView.InsertItem(_T("m_wndMenuBar"), 6, 6, hClass);
m_wndClassView.InsertItem(_T("m_wndToolBar"), 6, 6, hClass);
m_wndClassView.InsertItem(_T("m_wndStatusBar"), 6, 6, hClass);
hClass = m_wndClassView.InsertItem(_T("Globals"), 2, 2, hRoot);
m_wndClassView.InsertItem(_T("theFakeApp"), 5, 5, hClass);
m_wndClassView.Expand(hClass, TVE_EXPAND);
}
void CClassView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndClassView;
ASSERT_VALID(pWndTree);
if (pWnd != pWndTree)
{
CDockablePane::OnContextMenu(pWnd, point);
return;
}
if (point != CPoint(-1, -1))
{
// 选择已单击的项:
CPoint ptTree = point;
pWndTree->ScreenToClient(&ptTree);
UINT flags = 0;
HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
if (hTreeItem != nullptr)
{
pWndTree->SelectItem(hTreeItem);
}
}
pWndTree->SetFocus();
CMenu menu;
menu.LoadMenu(IDR_POPUP_SORT);
CMenu* pSumMenu = menu.GetSubMenu(0);
if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
{
CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
return;
((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
UpdateDialogControls(this, FALSE);
}
}
void CClassView::AdjustLayout()
{
if (GetSafeHwnd() == nullptr)
{
return;
}
CRect rectClient;
GetClientRect(rectClient);
int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy;
m_wndToolBar.SetWindowPos(nullptr, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndClassView.SetWindowPos(nullptr, rectClient.left + 1, rectClient.top + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER);
}
BOOL CClassView::PreTranslateMessage(MSG* pMsg)
{
return CDockablePane::PreTranslateMessage(pMsg);
}
void CClassView::OnSort(UINT id)
{
if (m_nCurrSort == id)
{
return;
}
m_nCurrSort = id;
CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0));
if (pButton != nullptr)
{
pButton->SetImage(GetCmdMgr()->GetCmdImage(id));
m_wndToolBar.Invalidate();
m_wndToolBar.UpdateWindow();
}
}
void CClassView::OnUpdateSort(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(pCmdUI->m_nID == m_nCurrSort);
}
void CClassView::OnClassAddMemberFunction()
{
AfxMessageBox(_T("添加成员函数..."));
}
void CClassView::OnClassAddMemberVariable()
{
// TODO: 在此处添加命令处理程序代码
}
void CClassView::OnClassDefinition()
{
// TODO: 在此处添加命令处理程序代码
}
void CClassView::OnClassProperties()
{
// TODO: 在此处添加命令处理程序代码
}
void CClassView::OnNewFolder()
{
AfxMessageBox(_T("新建文件夹..."));
}
void CClassView::OnPaint()
{
CPaintDC dc(this); // 用于绘制的设备上下文
CRect rectTree;
m_wndClassView.GetWindowRect(rectTree);
ScreenToClient(rectTree);
rectTree.InflateRect(1, 1);
dc.Draw3dRect(rectTree, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DSHADOW));
}
void CClassView::OnSetFocus(CWnd* pOldWnd)
{
CDockablePane::OnSetFocus(pOldWnd);
m_wndClassView.SetFocus();
}
void CClassView::OnChangeVisualStyle()
{
m_ClassViewImages.DeleteImageList();
UINT uiBmpId = theApp.m_bHiColorIcons ? IDB_CLASS_VIEW_24 : IDB_CLASS_VIEW;
CBitmap bmp;
if (!bmp.LoadBitmap(uiBmpId))
{
TRACE(_T("无法加载位图: %x\n"), uiBmpId);
ASSERT(FALSE);
return;
}
BITMAP bmpObj;
bmp.GetBitmap(&bmpObj);
UINT nFlags = ILC_MASK;
nFlags |= (theApp.m_bHiColorIcons) ? ILC_COLOR24 : ILC_COLOR4;
m_ClassViewImages.Create(16, bmpObj.bmHeight, nFlags, 0, 0);
m_ClassViewImages.Add(&bmp, RGB(255, 0, 0));
m_wndClassView.SetImageList(&m_ClassViewImages, TVSIL_NORMAL);
m_wndToolBar.CleanUpLockedImages();
m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_SORT_24 : IDR_SORT, 0, 0, TRUE /* 锁定*/);
}

54
ClassView.h Normal file
View File

@ -0,0 +1,54 @@

#pragma once
#include "ViewTree.h"
class CClassToolBar : public CMFCToolBar
{
virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
{
CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
}
virtual BOOL AllowShowOnList() const { return FALSE; }
};
class CClassView : public CDockablePane
{
public:
CClassView() noexcept;
virtual ~CClassView();
void AdjustLayout();
void OnChangeVisualStyle();
protected:
CClassToolBar m_wndToolBar;
CViewTree m_wndClassView;
CImageList m_ClassViewImages;
UINT m_nCurrSort;
void FillClassView();
// 重写
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnClassAddMemberFunction();
afx_msg void OnClassAddMemberVariable();
afx_msg void OnClassDefinition();
afx_msg void OnClassProperties();
afx_msg void OnNewFolder();
afx_msg void OnPaint();
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg LRESULT OnChangeActiveTab(WPARAM, LPARAM);
afx_msg void OnSort(UINT id);
afx_msg void OnUpdateSort(CCmdUI* pCmdUI);
DECLARE_MESSAGE_MAP()
};

257
FileView.cpp Normal file
View File

@ -0,0 +1,257 @@

#include "pch.h"
#include "framework.h"
#include "mainfrm.h"
#include "FileView.h"
#include "Resource.h"
#include "ProcessManager.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileView
CFileView::CFileView() noexcept
{
}
CFileView::~CFileView()
{
}
BEGIN_MESSAGE_MAP(CFileView, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_CONTEXTMENU()
ON_COMMAND(ID_PROPERTIES, OnProperties)
ON_COMMAND(ID_OPEN, OnFileOpen)
ON_COMMAND(ID_OPEN_WITH, OnFileOpenWith)
ON_COMMAND(ID_DUMMY_COMPILE, OnDummyCompile)
ON_COMMAND(ID_EDIT_CUT, OnEditCut)
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
ON_WM_PAINT()
ON_WM_SETFOCUS()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar 消息处理程序
int CFileView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建视图:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
if (!m_wndFileView.Create(dwViewStyle, rectDummy, this, 4))
{
TRACE0("未能创建文件视图\n");
return -1; // 未能创建
}
// 加载视图图像:
m_FileViewImages.Create(IDB_FILE_VIEW, 16, 0, RGB(255, 0, 255));
m_wndFileView.SetImageList(&m_FileViewImages, TVSIL_NORMAL);
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_EXPLORER);
m_wndToolBar.LoadToolBar(IDR_EXPLORER, 0, 0, TRUE /* 已锁定*/);
OnChangeVisualStyle();
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
// 所有命令将通过此控件路由,而不是通过主框架路由:
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
// 填入一些静态树视图数据(此处只需填入虚拟代码,而不是复杂的数据)
FillFileView();
AdjustLayout();
return 0;
}
void CFileView::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
AdjustLayout();
}
void CFileView::FillFileView()
{
HTREEITEM hRoot = m_wndFileView.InsertItem(_T("FakeApp 文件"), 0, 0);
m_wndFileView.SetItemState(hRoot, TVIS_BOLD, TVIS_BOLD);
HTREEITEM hSrc = m_wndFileView.InsertItem(_T("FakeApp 源文件"), 0, 0, hRoot);
m_wndFileView.InsertItem(_T("FakeApp.cpp"), 1, 1, hSrc);
m_wndFileView.InsertItem(_T("FakeApp.rc"), 1, 1, hSrc);
m_wndFileView.InsertItem(_T("FakeAppDoc.cpp"), 1, 1, hSrc);
m_wndFileView.InsertItem(_T("FakeAppView.cpp"), 1, 1, hSrc);
m_wndFileView.InsertItem(_T("MainFrm.cpp"), 1, 1, hSrc);
m_wndFileView.InsertItem(_T("pch.cpp"), 1, 1, hSrc);
HTREEITEM hInc = m_wndFileView.InsertItem(_T("FakeApp 头文件"), 0, 0, hRoot);
m_wndFileView.InsertItem(_T("FakeApp.h"), 2, 2, hInc);
m_wndFileView.InsertItem(_T("FakeAppDoc.h"), 2, 2, hInc);
m_wndFileView.InsertItem(_T("FakeAppView.h"), 2, 2, hInc);
m_wndFileView.InsertItem(_T("Resource.h"), 2, 2, hInc);
m_wndFileView.InsertItem(_T("MainFrm.h"), 2, 2, hInc);
m_wndFileView.InsertItem(_T("pch.h"), 2, 2, hInc);
HTREEITEM hRes = m_wndFileView.InsertItem(_T("FakeApp 资源文件"), 0, 0, hRoot);
m_wndFileView.InsertItem(_T("FakeApp.ico"), 2, 2, hRes);
m_wndFileView.InsertItem(_T("FakeApp.rc2"), 2, 2, hRes);
m_wndFileView.InsertItem(_T("FakeAppDoc.ico"), 2, 2, hRes);
m_wndFileView.InsertItem(_T("FakeToolbar.bmp"), 2, 2, hRes);
m_wndFileView.Expand(hRoot, TVE_EXPAND);
m_wndFileView.Expand(hSrc, TVE_EXPAND);
m_wndFileView.Expand(hInc, TVE_EXPAND);
}
void CFileView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CTreeCtrl* pWndTree = (CTreeCtrl*) &m_wndFileView;
ASSERT_VALID(pWndTree);
if (pWnd != pWndTree)
{
CDockablePane::OnContextMenu(pWnd, point);
return;
}
if (point != CPoint(-1, -1))
{
// 选择已单击的项:
CPoint ptTree = point;
pWndTree->ScreenToClient(&ptTree);
UINT flags = 0;
HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags);
if (hTreeItem != nullptr)
{
pWndTree->SelectItem(hTreeItem);
}
}
pWndTree->SetFocus();
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EXPLORER, point.x, point.y, this, TRUE);
}
void CFileView::AdjustLayout()
{
if (GetSafeHwnd() == nullptr)
{
return;
}
CRect rectClient;
GetClientRect(rectClient);
int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy;
m_wndToolBar.SetWindowPos(nullptr, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndFileView.SetWindowPos(nullptr, rectClient.left + 1, rectClient.top + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER);
}
void CFileView::OnProperties()
{
AfxMessageBox(_T("属性...."));
}
void CFileView::OnFileOpen()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnFileOpenWith()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnDummyCompile()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnEditCut()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnEditCopy()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnEditClear()
{
// TODO: 在此处添加命令处理程序代码
}
void CFileView::OnPaint()
{
CPaintDC dc(this); // 用于绘制的设备上下文
CRect rectTree;
m_wndFileView.GetWindowRect(rectTree);
ScreenToClient(rectTree);
rectTree.InflateRect(1, 1);
dc.Draw3dRect(rectTree, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DSHADOW));
}
void CFileView::OnSetFocus(CWnd* pOldWnd)
{
CDockablePane::OnSetFocus(pOldWnd);
m_wndFileView.SetFocus();
}
void CFileView::OnChangeVisualStyle()
{
m_wndToolBar.CleanUpLockedImages();
m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_EXPLORER_24 : IDR_EXPLORER, 0, 0, TRUE /* 锁定*/);
m_FileViewImages.DeleteImageList();
UINT uiBmpId = theApp.m_bHiColorIcons ? IDB_FILE_VIEW_24 : IDB_FILE_VIEW;
CBitmap bmp;
if (!bmp.LoadBitmap(uiBmpId))
{
TRACE(_T("无法加载位图: %x\n"), uiBmpId);
ASSERT(FALSE);
return;
}
BITMAP bmpObj;
bmp.GetBitmap(&bmpObj);
UINT nFlags = ILC_MASK;
nFlags |= (theApp.m_bHiColorIcons) ? ILC_COLOR24 : ILC_COLOR4;
m_FileViewImages.Create(16, bmpObj.bmHeight, nFlags, 0, 0);
m_FileViewImages.Add(&bmp, RGB(255, 0, 255));
m_wndFileView.SetImageList(&m_FileViewImages, TVSIL_NORMAL);
}

55
FileView.h Normal file
View File

@ -0,0 +1,55 @@

#pragma once
#include "ViewTree.h"
class CFileViewToolBar : public CMFCToolBar
{
virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
{
CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
}
virtual BOOL AllowShowOnList() const { return FALSE; }
};
class CFileView : public CDockablePane
{
// 构造
public:
CFileView() noexcept;
void AdjustLayout();
void OnChangeVisualStyle();
// 特性
protected:
CViewTree m_wndFileView;
CImageList m_FileViewImages;
CFileViewToolBar m_wndToolBar;
protected:
void FillFileView();
// 实现
public:
virtual ~CFileView();
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnProperties();
afx_msg void OnFileOpen();
afx_msg void OnFileOpenWith();
afx_msg void OnDummyCompile();
afx_msg void OnEditCut();
afx_msg void OnEditCopy();
afx_msg void OnEditClear();
afx_msg void OnPaint();
afx_msg void OnSetFocus(CWnd* pOldWnd);
DECLARE_MESSAGE_MAP()
};

348
MainFrm.cpp Normal file
View File

@ -0,0 +1,348 @@

// MainFrm.cpp: CMainFrame 类的实现
//
#include "pch.h"
#include "framework.h"
#include "ProcessManager.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx)
const int iMaxUserToolbars = 10;
const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;
const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
ON_WM_CREATE()
ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager)
ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize)
ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew)
ON_WM_SETTINGCHANGE()
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 (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bNameValid;
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式...
mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧
mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标
mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色
mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单
EnableMDITabbedGroups(TRUE, mdiTabParams);
if (!m_wndMenuBar.Create(this))
{
TRACE0("未能创建菜单栏\n");
return -1; // 未能创建
}
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);
// 防止菜单栏在激活时获得焦点
CMFCPopupMenu::SetForceMenuFocus(FALSE);
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(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
{
TRACE0("未能创建工具栏\n");
return -1; // 未能创建
}
CString strToolBarName;
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
ASSERT(bNameValid);
m_wndToolBar.SetWindowText(strToolBarName);
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
// 允许用户定义的工具栏操作:
InitUserToolbars(nullptr, uiFirstUserToolBarId, uiLastUserToolBarId);
if (!m_wndStatusBar.Create(this))
{
TRACE0("未能创建状态栏\n");
return -1; // 未能创建
}
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
// TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
// 启用 Visual Studio 2005 样式停靠窗口行为
CDockingManager::SetDockingMode(DT_SMART);
// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// 加载菜单项图像(不在任何标准工具栏上):
CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);
// 创建停靠窗口
if (!CreateDockingWindows())
{
TRACE0("未能创建停靠窗口\n");
return -1;
}
m_wndFileView.EnableDocking(CBRS_ALIGN_ANY);
m_wndClassView.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndFileView);
CDockablePane* pTabbedBar = nullptr;
m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndOutput);
m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndProperties);
// 设置用于绘制所有用户界面元素的视觉管理器
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 启用增强的窗口管理对话框
EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE);
// 启用工具栏和停靠窗口菜单替换
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
// 启用快速(按住 Alt 拖动)工具栏自定义
CMFCToolBar::EnableQuickCustomization();
if (CMFCToolBar::GetUserImages() == nullptr)
{
// 加载用户定义的工具栏图像
if (m_UserImages.Load(_T(".\\UserImages.bmp")))
{
CMFCToolBar::SetUserImages(&m_UserImages);
}
}
// 启用菜单个性化(最近使用的命令)
// TODO: 定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。
CList<UINT, UINT> lstBasicCommands;
lstBasicCommands.AddTail(ID_FILE_NEW);
lstBasicCommands.AddTail(ID_FILE_OPEN);
lstBasicCommands.AddTail(ID_FILE_SAVE);
lstBasicCommands.AddTail(ID_FILE_PRINT);
lstBasicCommands.AddTail(ID_APP_EXIT);
lstBasicCommands.AddTail(ID_EDIT_CUT);
lstBasicCommands.AddTail(ID_EDIT_PASTE);
lstBasicCommands.AddTail(ID_EDIT_UNDO);
lstBasicCommands.AddTail(ID_APP_ABOUT);
lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
lstBasicCommands.AddTail(ID_VIEW_TOOLBAR);
lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC);
lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE);
lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS);
lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);
CMFCToolBar::SetBasicCommands(lstBasicCommands);
// 将文档名和应用程序名称在窗口标题栏上的顺序进行交换。这
// 将改进任务栏的可用性,因为显示的文档名带有缩略图。
ModifyStyle(0, FWS_PREFIXTITLE);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU;
return TRUE;
}
BOOL CMainFrame::CreateDockingWindows()
{
BOOL bNameValid;
// 创建类视图
CString strClassView;
bNameValid = strClassView.LoadString(IDS_CLASS_VIEW);
ASSERT(bNameValid);
if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("未能创建“类视图”窗口\n");
return FALSE; // 未能创建
}
// 创建文件视图
CString strFileView;
bNameValid = strFileView.LoadString(IDS_FILE_VIEW);
ASSERT(bNameValid);
if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("未能创建“文件视图”窗口\n");
return FALSE; // 未能创建
}
// 创建输出窗口
CString strOutputWnd;
bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND);
ASSERT(bNameValid);
if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
TRACE0("未能创建输出窗口\n");
return FALSE; // 未能创建
}
// 创建属性窗口
CString strPropertiesWnd;
bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND);
ASSERT(bNameValid);
if (!m_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIESWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
{
TRACE0("未能创建“属性”窗口\n");
return FALSE; // 未能创建
}
SetDockingWindowIcons(theApp.m_bHiColorIcons);
return TRUE;
}
void CMainFrame::SetDockingWindowIcons(BOOL bHiColorIcons)
{
HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndFileView.SetIcon(hFileViewIcon, FALSE);
HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndClassView.SetIcon(hClassViewIcon, FALSE);
HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndOutput.SetIcon(hOutputBarIcon, FALSE);
HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndProperties.SetIcon(hPropertiesBarIcon, FALSE);
UpdateMDITabbedBarsIcons();
}
// CMainFrame 诊断
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWndEx::Dump(dc);
}
#endif //_DEBUG
// CMainFrame 消息处理程序
void CMainFrame::OnWindowManager()
{
ShowWindowsDialog();
}
void CMainFrame::OnViewCustomize()
{
CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* 扫描菜单*/);
pDlgCust->EnableUserDefinedToolbars();
pDlgCust->Create();
}
LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp)
{
LRESULT lres = CMDIFrameWndEx::OnToolbarCreateNew(wp,lp);
if (lres == 0)
{
return 0;
}
CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres;
ASSERT_VALID(pUserToolbar);
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
return lres;
}
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
// 基类将执行真正的工作
if (!CMDIFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
{
return FALSE;
}
// 为所有用户工具栏启用自定义按钮
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
for (int i = 0; i < iMaxUserToolbars; i ++)
{
CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
if (pUserToolbar != nullptr)
{
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
}
}
return TRUE;
}
void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
CMDIFrameWndEx::OnSettingChange(uFlags, lpszSection);
m_wndOutput.UpdateFonts();
}

59
MainFrm.h Normal file
View File

@ -0,0 +1,59 @@

// MainFrm.h: CMainFrame 类的接口
//
#pragma once
#include "FileView.h"
#include "ClassView.h"
#include "OutputWnd.h"
#include "PropertiesWnd.h"
class CMainFrame : public CMDIFrameWndEx
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame() noexcept;
// 特性
public:
// 操作
public:
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = nullptr, CCreateContext* pContext = nullptr);
// 实现
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // 控件条嵌入成员
CMFCMenuBar m_wndMenuBar;
CMFCToolBar m_wndToolBar;
CMFCStatusBar m_wndStatusBar;
CMFCToolBarImages m_UserImages;
CFileView m_wndFileView;
CClassView m_wndClassView;
COutputWnd m_wndOutput;
CPropertiesWnd m_wndProperties;
// 生成的消息映射函数
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnWindowManager();
afx_msg void OnViewCustomize();
afx_msg LRESULT OnToolbarCreateNew(WPARAM wp, LPARAM lp);
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
DECLARE_MESSAGE_MAP()
BOOL CreateDockingWindows();
void SetDockingWindowIcons(BOOL bHiColorIcons);
};

200
OutputWnd.cpp Normal file
View File

@ -0,0 +1,200 @@

#include "pch.h"
#include "framework.h"
#include "OutputWnd.h"
#include "Resource.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COutputBar
COutputWnd::COutputWnd() noexcept
{
}
COutputWnd::~COutputWnd()
{
}
BEGIN_MESSAGE_MAP(COutputWnd, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
END_MESSAGE_MAP()
int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建选项卡窗口:
if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
{
TRACE0("未能创建输出选项卡窗口\n");
return -1; // 未能创建
}
// 创建输出窗格:
const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
!m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) ||
!m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4))
{
TRACE0("未能创建输出窗口\n");
return -1; // 未能创建
}
UpdateFonts();
CString strTabName;
BOOL bNameValid;
// 将列表窗口附加到选项卡:
bNameValid = strTabName.LoadString(IDS_BUILD_TAB);
ASSERT(bNameValid);
m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0);
bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
ASSERT(bNameValid);
m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
bNameValid = strTabName.LoadString(IDS_FIND_TAB);
ASSERT(bNameValid);
m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);
// 使用一些虚拟文本填写输出选项卡(无需复杂数据)
FillBuildWindow();
FillDebugWindow();
FillFindWindow();
return 0;
}
void COutputWnd::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
// 选项卡控件应覆盖整个工作区:
m_wndTabs.SetWindowPos (nullptr, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
}
void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
{
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(&afxGlobalData.fontRegular);
int cxExtentMax = 0;
for (int i = 0; i < wndListBox.GetCount(); i ++)
{
CString strItem;
wndListBox.GetText(i, strItem);
cxExtentMax = max(cxExtentMax, (int)dc.GetTextExtent(strItem).cx);
}
wndListBox.SetHorizontalExtent(cxExtentMax);
dc.SelectObject(pOldFont);
}
void COutputWnd::FillBuildWindow()
{
m_wndOutputBuild.AddString(_T("生成输出正显示在此处。"));
m_wndOutputBuild.AddString(_T("输出正显示在列表视图的行中"));
m_wndOutputBuild.AddString(_T("但您可以根据需要更改其显示方式..."));
}
void COutputWnd::FillDebugWindow()
{
m_wndOutputDebug.AddString(_T("调试输出正显示在此处。"));
m_wndOutputDebug.AddString(_T("输出正显示在列表视图的行中"));
m_wndOutputDebug.AddString(_T("但您可以根据需要更改其显示方式..."));
}
void COutputWnd::FillFindWindow()
{
m_wndOutputFind.AddString(_T("查找输出正显示在此处。"));
m_wndOutputFind.AddString(_T("输出正显示在列表视图的行中"));
m_wndOutputFind.AddString(_T("但您可以根据需要更改其显示方式..."));
}
void COutputWnd::UpdateFonts()
{
m_wndOutputBuild.SetFont(&afxGlobalData.fontRegular);
m_wndOutputDebug.SetFont(&afxGlobalData.fontRegular);
m_wndOutputFind.SetFont(&afxGlobalData.fontRegular);
}
/////////////////////////////////////////////////////////////////////////////
// COutputList1
COutputList::COutputList() noexcept
{
}
COutputList::~COutputList()
{
}
BEGIN_MESSAGE_MAP(COutputList, CListBox)
ON_WM_CONTEXTMENU()
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
ON_COMMAND(ID_VIEW_OUTPUTWND, OnViewOutput)
ON_WM_WINDOWPOSCHANGING()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COutputList 消息处理程序
void COutputList::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
CMenu menu;
menu.LoadMenu(IDR_OUTPUT_POPUP);
CMenu* pSumMenu = menu.GetSubMenu(0);
if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
{
CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
return;
((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
UpdateDialogControls(this, FALSE);
}
SetFocus();
}
void COutputList::OnEditCopy()
{
MessageBox(_T("复制输出"));
}
void COutputList::OnEditClear()
{
MessageBox(_T("清除输出"));
}
void COutputList::OnViewOutput()
{
CDockablePane* pParentBar = DYNAMIC_DOWNCAST(CDockablePane, GetOwner());
CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame());
if (pMainFrame != nullptr && pParentBar != nullptr)
{
pMainFrame->SetFocus();
pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE);
pMainFrame->RecalcLayout();
}
}

59
OutputWnd.h Normal file
View File

@ -0,0 +1,59 @@

#pragma once
/////////////////////////////////////////////////////////////////////////////
// COutputList 窗口
class COutputList : public CListBox
{
// 构造
public:
COutputList() noexcept;
// 实现
public:
virtual ~COutputList();
protected:
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnEditCopy();
afx_msg void OnEditClear();
afx_msg void OnViewOutput();
DECLARE_MESSAGE_MAP()
};
class COutputWnd : public CDockablePane
{
// 构造
public:
COutputWnd() noexcept;
void UpdateFonts();
// 特性
protected:
CMFCTabCtrl m_wndTabs;
COutputList m_wndOutputBuild;
COutputList m_wndOutputDebug;
COutputList m_wndOutputFind;
protected:
void FillBuildWindow();
void FillDebugWindow();
void FillFindWindow();
void AdjustHorzScroll(CListBox& wndListBox);
// 实现
public:
virtual ~COutputWnd();
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE_MAP()
};

227
ProcessManager.cpp Normal file
View File

@ -0,0 +1,227 @@

// ProcessManager.cpp: 定义应用程序的类行为。
//
#include "pch.h"
#include "framework.h"
#include "afxwinappex.h"
#include "afxdialogex.h"
#include "ProcessManager.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "ProcessManagerDoc.h"
#include "ProcessManagerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CProcessManagerApp
BEGIN_MESSAGE_MAP(CProcessManagerApp, CWinAppEx)
ON_COMMAND(ID_APP_ABOUT, &CProcessManagerApp::OnAppAbout)
// 基于文件的标准文档命令
ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)
// 标准打印设置命令
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup)
END_MESSAGE_MAP()
// CProcessManagerApp 构造
CProcessManagerApp::CProcessManagerApp() noexcept
{
m_bHiColorIcons = TRUE;
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;
#ifdef _MANAGED
// 如果应用程序是利用公共语言运行时支持(/clr)构建的,则:
// 1) 必须有此附加设置,“重新启动管理器”支持才能正常工作。
// 2) 在您的项目中,您必须按照生成顺序向 System.Windows.Forms 添加引用。
System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException);
#endif
// TODO: 将以下应用程序 ID 字符串替换为唯一的 ID 字符串;建议的字符串格式
//为 CompanyName.ProductName.SubProduct.VersionInformation
SetAppID(_T("ProcessManager.AppID.NoVersion"));
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的 CProcessManagerApp 对象
CProcessManagerApp theApp;
// CProcessManagerApp 初始化
BOOL CProcessManagerApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction();
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// 注册应用程序的文档模板。 文档模板
// 将用作文档、框架窗口和视图之间的连接
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_ProcessManagerTYPE,
RUNTIME_CLASS(CProcessManagerDoc),
RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架
RUNTIME_CLASS(CProcessManagerView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 创建主 MDI 框架窗口
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
{
delete pMainFrame;
return FALSE;
}
m_pMainWnd = pMainFrame;
// 分析标准 shell 命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。 如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 主窗口已初始化,因此显示它并对其进行更新
pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
pMainFrame->UpdateWindow();
return TRUE;
}
int CProcessManagerApp::ExitInstance()
{
//TODO: 处理可能已添加的附加资源
AfxOleTerm(FALSE);
return CWinAppEx::ExitInstance();
}
// CProcessManagerApp 消息处理程序
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg() noexcept;
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// 用于运行对话框的应用程序命令
void CProcessManagerApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CProcessManagerApp 自定义加载/保存方法
void CProcessManagerApp::PreLoadState()
{
BOOL bNameValid;
CString strName;
bNameValid = strName.LoadString(IDS_EDIT_MENU);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
bNameValid = strName.LoadString(IDS_EXPLORER);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EXPLORER);
}
void CProcessManagerApp::LoadCustomState()
{
}
void CProcessManagerApp::SaveCustomState()
{
}
// CProcessManagerApp 消息处理程序

39
ProcessManager.h Normal file
View File

@ -0,0 +1,39 @@

// ProcessManager.h: ProcessManager 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
#endif
#include "resource.h" // 主符号
// CProcessManagerApp:
// 有关此类的实现,请参阅 ProcessManager.cpp
//
class CProcessManagerApp : public CWinAppEx
{
public:
CProcessManagerApp() noexcept;
// 重写
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
// 实现
BOOL m_bHiColorIcons;
virtual void PreLoadState();
virtual void LoadCustomState();
virtual void SaveCustomState();
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP()
};
extern CProcessManagerApp theApp;

BIN
ProcessManager.rc Normal file

Binary file not shown.

31
ProcessManager.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33829.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProcessManager", "ProcessManager.vcxproj", "{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Debug|x64.ActiveCfg = Debug|x64
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Debug|x64.Build.0 = Debug|x64
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Debug|x86.ActiveCfg = Debug|Win32
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Debug|x86.Build.0 = Debug|Win32
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Release|x64.ActiveCfg = Release|x64
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Release|x64.Build.0 = Release|x64
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Release|x86.ActiveCfg = Release|Win32
{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BEC603B-9187-4A9F-AF7A-AE7899596766}
EndGlobalSection
EndGlobal

255
ProcessManager.vcxproj Normal file
View File

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{8ECA8E4B-DC1F-4D90-8B1F-20A7AE37E549}</ProjectGuid>
<Keyword>MFCProj</Keyword>
<RootNamespace>ProcessManager</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="ChildFrm.h" />
<ClInclude Include="ClassView.h" />
<ClInclude Include="FileView.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="MainFrm.h" />
<ClInclude Include="OutputWnd.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="ProcessManager.h" />
<ClInclude Include="ProcessManagerDoc.h" />
<ClInclude Include="ProcessManagerView.h" />
<ClInclude Include="PropertiesWnd.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="ViewTree.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ChildFrm.cpp" />
<ClCompile Include="ClassView.cpp" />
<ClCompile Include="FileView.cpp" />
<ClCompile Include="MainFrm.cpp" />
<ClCompile Include="OutputWnd.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ProcessManager.cpp" />
<ClCompile Include="ProcessManagerDoc.cpp" />
<ClCompile Include="ProcessManagerView.cpp" />
<ClCompile Include="PropertiesWnd.cpp" />
<ClCompile Include="ViewTree.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ProcessManager.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="res\classview.bmp" />
<Image Include="res\classview_hc.bmp" />
<Image Include="res\class_view.ico" />
<Image Include="res\class_view_hc.ico" />
<Image Include="res\explorer.bmp" />
<Image Include="res\explorer_hc.bmp" />
<Image Include="res\fileview.bmp" />
<Image Include="res\fileview_hc.bmp" />
<Image Include="res\file_view.ico" />
<Image Include="res\file_view_hc.ico" />
<Image Include="res\menuimages.bmp" />
<Image Include="res\menuimages_hc.bmp" />
<Image Include="res\output_wnd.ico" />
<Image Include="res\output_wnd_hc.ico" />
<Image Include="res\ProcessManager.ico" />
<Image Include="res\ProcessManagerDoc.ico" />
<Image Include="res\properties.bmp" />
<Image Include="res\properties_hc.bmp" />
<Image Include="res\properties_wnd.ico" />
<Image Include="res\properties_wnd_hc.ico" />
<Image Include="res\sort.bmp" />
<Image Include="res\sort_hc.bmp" />
<Image Include="res\Toolbar.bmp" />
<Image Include="res\Toolbar256.bmp" />
<Image Include="res\userimages.bmp" />
</ItemGroup>
<ItemGroup>
<None Include="res\ProcessManager.rc2" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ProcessManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MainFrm.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ChildFrm.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessManagerDoc.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessManagerView.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileView.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ClassView.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ViewTree.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="OutputWnd.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PropertiesWnd.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ProcessManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MainFrm.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ChildFrm.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessManagerDoc.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessManagerView.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileView.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ClassView.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ViewTree.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="OutputWnd.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PropertiesWnd.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ProcessManager.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\file_view.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\file_view_hc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\class_view.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\class_view_hc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\fileview.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\fileview_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\classview.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\classview_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\explorer.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\explorer_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\sort.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\sort_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\menuimages.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\menuimages_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\output_wnd.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\output_wnd_hc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\properties_wnd.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\properties_wnd_hc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\properties.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\properties_hc.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\userimages.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\ProcessManagerDoc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\ProcessManager.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Toolbar.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Toolbar256.bmp">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="res\ProcessManager.rc2">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
</Project>

138
ProcessManagerDoc.cpp Normal file
View File

@ -0,0 +1,138 @@

// ProcessManagerDoc.cpp: CProcessManagerDoc 类的实现
//
#include "pch.h"
#include "framework.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "ProcessManager.h"
#endif
#include "ProcessManagerDoc.h"
#include <propkey.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CProcessManagerDoc
IMPLEMENT_DYNCREATE(CProcessManagerDoc, CDocument)
BEGIN_MESSAGE_MAP(CProcessManagerDoc, CDocument)
END_MESSAGE_MAP()
// CProcessManagerDoc 构造/析构
CProcessManagerDoc::CProcessManagerDoc() noexcept
{
// TODO: 在此添加一次性构造代码
}
CProcessManagerDoc::~CProcessManagerDoc()
{
}
BOOL CProcessManagerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: 在此添加重新初始化代码
// (SDI 文档将重用该文档)
return TRUE;
}
// CProcessManagerDoc 序列化
void CProcessManagerDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: 在此添加存储代码
}
else
{
// TODO: 在此添加加载代码
}
}
#ifdef SHARED_HANDLERS
// 缩略图的支持
void CProcessManagerDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
// 修改此代码以绘制文档数据
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
CString strText = _T("TODO: implement thumbnail drawing here");
LOGFONT lf;
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
pDefaultGUIFont->GetLogFont(&lf);
lf.lfHeight = 36;
CFont fontDraw;
fontDraw.CreateFontIndirect(&lf);
CFont* pOldFont = dc.SelectObject(&fontDraw);
dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
dc.SelectObject(pOldFont);
}
// 搜索处理程序的支持
void CProcessManagerDoc::InitializeSearchContent()
{
CString strSearchContent;
// 从文档数据设置搜索内容。
// 内容部分应由“;”分隔
// 例如: strSearchContent = _T("point;rectangle;circle;ole object;")
SetSearchContent(strSearchContent);
}
void CProcessManagerDoc::SetSearchContent(const CString& value)
{
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
}
else
{
CMFCFilterChunkValueImpl *pChunk = nullptr;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != nullptr)
{
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}
#endif // SHARED_HANDLERS
// CProcessManagerDoc 诊断
#ifdef _DEBUG
void CProcessManagerDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CProcessManagerDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// CProcessManagerDoc 命令

48
ProcessManagerDoc.h Normal file
View File

@ -0,0 +1,48 @@

// ProcessManagerDoc.h: CProcessManagerDoc 类的接口
//
#pragma once
class CProcessManagerDoc : public CDocument
{
protected: // 仅从序列化创建
CProcessManagerDoc() noexcept;
DECLARE_DYNCREATE(CProcessManagerDoc)
// 特性
public:
// 操作
public:
// 重写
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
#ifdef SHARED_HANDLERS
virtual void InitializeSearchContent();
virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);
#endif // SHARED_HANDLERS
// 实现
public:
virtual ~CProcessManagerDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
#ifdef SHARED_HANDLERS
// 用于为搜索处理程序设置搜索内容的 Helper 函数
void SetSearchContent(const CString& value);
#endif // SHARED_HANDLERS
};

128
ProcessManagerView.cpp Normal file
View File

@ -0,0 +1,128 @@

// ProcessManagerView.cpp: CProcessManagerView 类的实现
//
#include "pch.h"
#include "framework.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "ProcessManager.h"
#endif
#include "ProcessManagerDoc.h"
#include "ProcessManagerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CProcessManagerView
IMPLEMENT_DYNCREATE(CProcessManagerView, CView)
BEGIN_MESSAGE_MAP(CProcessManagerView, CView)
// 标准打印命令
ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CProcessManagerView::OnFilePrintPreview)
ON_WM_CONTEXTMENU()
ON_WM_RBUTTONUP()
END_MESSAGE_MAP()
// CProcessManagerView 构造/析构
CProcessManagerView::CProcessManagerView() noexcept
{
// TODO: 在此处添加构造代码
}
CProcessManagerView::~CProcessManagerView()
{
}
BOOL CProcessManagerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CView::PreCreateWindow(cs);
}
// CProcessManagerView 绘图
void CProcessManagerView::OnDraw(CDC* /*pDC*/)
{
CProcessManagerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此处为本机数据添加绘制代码
}
// CProcessManagerView 打印
void CProcessManagerView::OnFilePrintPreview()
{
#ifndef SHARED_HANDLERS
AFXPrintPreview(this);
#endif
}
BOOL CProcessManagerView::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void CProcessManagerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加额外的打印前进行的初始化过程
}
void CProcessManagerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加打印后进行的清理过程
}
void CProcessManagerView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
ClientToScreen(&point);
OnContextMenu(this, point);
}
void CProcessManagerView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}
// CProcessManagerView 诊断
#ifdef _DEBUG
void CProcessManagerView::AssertValid() const
{
CView::AssertValid();
}
void CProcessManagerView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CProcessManagerDoc* CProcessManagerView::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CProcessManagerDoc)));
return (CProcessManagerDoc*)m_pDocument;
}
#endif //_DEBUG
// CProcessManagerView 消息处理程序

52
ProcessManagerView.h Normal file
View File

@ -0,0 +1,52 @@

// ProcessManagerView.h: CProcessManagerView 类的接口
//
#pragma once
class CProcessManagerView : public CView
{
protected: // 仅从序列化创建
CProcessManagerView() noexcept;
DECLARE_DYNCREATE(CProcessManagerView)
// 特性
public:
CProcessManagerDoc* GetDocument() const;
// 操作
public:
// 重写
public:
virtual void OnDraw(CDC* pDC); // 重写以绘制该视图
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
// 实现
public:
virtual ~CProcessManagerView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
afx_msg void OnFilePrintPreview();
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // ProcessManagerView.cpp 中的调试版本
inline CProcessManagerDoc* CProcessManagerView::GetDocument() const
{ return reinterpret_cast<CProcessManagerDoc*>(m_pDocument); }
#endif

273
PropertiesWnd.cpp Normal file
View File

@ -0,0 +1,273 @@

#include "pch.h"
#include "framework.h"
#include "PropertiesWnd.h"
#include "Resource.h"
#include "MainFrm.h"
#include "ProcessManager.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// CResourceViewBar
CPropertiesWnd::CPropertiesWnd() noexcept
{
m_nComboHeight = 0;
}
CPropertiesWnd::~CPropertiesWnd()
{
}
BEGIN_MESSAGE_MAP(CPropertiesWnd, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties)
ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties)
ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties)
ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties)
ON_COMMAND(ID_PROPERTIES1, OnProperties1)
ON_UPDATE_COMMAND_UI(ID_PROPERTIES1, OnUpdateProperties1)
ON_COMMAND(ID_PROPERTIES2, OnProperties2)
ON_UPDATE_COMMAND_UI(ID_PROPERTIES2, OnUpdateProperties2)
ON_WM_SETFOCUS()
ON_WM_SETTINGCHANGE()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResourceViewBar 消息处理程序
void CPropertiesWnd::AdjustLayout()
{
if (GetSafeHwnd () == nullptr || (AfxGetMainWnd() != nullptr && AfxGetMainWnd()->IsIconic()))
{
return;
}
CRect rectClient;
GetClientRect(rectClient);
int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy;
m_wndObjectCombo.SetWindowPos(nullptr, rectClient.left, rectClient.top, rectClient.Width(), m_nComboHeight, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndToolBar.SetWindowPos(nullptr, rectClient.left, rectClient.top + m_nComboHeight, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndPropList.SetWindowPos(nullptr, rectClient.left, rectClient.top + m_nComboHeight + cyTlb, rectClient.Width(), rectClient.Height() -(m_nComboHeight+cyTlb), SWP_NOACTIVATE | SWP_NOZORDER);
}
int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建组合:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, 1))
{
TRACE0("未能创建属性组合 \n");
return -1; // 未能创建
}
m_wndObjectCombo.AddString(_T("应用程序"));
m_wndObjectCombo.AddString(_T("属性窗口"));
m_wndObjectCombo.SetCurSel(0);
CRect rectCombo;
m_wndObjectCombo.GetClientRect (&rectCombo);
m_nComboHeight = rectCombo.Height();
if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2))
{
TRACE0("未能创建属性网格\n");
return -1; // 未能创建
}
InitPropList();
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES);
m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* 已锁定*/);
m_wndToolBar.CleanUpLockedImages();
m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* 锁定*/);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
// 所有命令将通过此控件路由,而不是通过主框架路由:
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
AdjustLayout();
return 0;
}
void CPropertiesWnd::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
AdjustLayout();
}
void CPropertiesWnd::OnExpandAllProperties()
{
m_wndPropList.ExpandAll();
}
void CPropertiesWnd::OnUpdateExpandAllProperties(CCmdUI* /* pCmdUI */)
{
}
void CPropertiesWnd::OnSortProperties()
{
m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode());
}
void CPropertiesWnd::OnUpdateSortProperties(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode());
}
void CPropertiesWnd::OnProperties1()
{
// TODO: 在此处添加命令处理程序代码
}
void CPropertiesWnd::OnUpdateProperties1(CCmdUI* /*pCmdUI*/)
{
// TODO: 在此处添加命令更新 UI 处理程序代码
}
void CPropertiesWnd::OnProperties2()
{
// TODO: 在此处添加命令处理程序代码
}
void CPropertiesWnd::OnUpdateProperties2(CCmdUI* /*pCmdUI*/)
{
// TODO: 在此处添加命令更新 UI 处理程序代码
}
void CPropertiesWnd::InitPropList()
{
SetPropListFont();
m_wndPropList.EnableHeaderCtrl(FALSE);
m_wndPropList.EnableDescriptionArea();
m_wndPropList.SetVSDotNetLook();
m_wndPropList.MarkModifiedProperties();
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("外观"));
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("三维外观"), (_variant_t) false, _T("指定窗口的字体不使用粗体,并且控件将使用三维边框")));
CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("边框"), _T("对话框外框"), _T("其中之一: “无”、“细”、“可调整大小”或“对话框外框”"));
pProp->AddOption(_T(""));
pProp->AddOption(_T(""));
pProp->AddOption(_T("可调整大小"));
pProp->AddOption(_T("对话框外框"));
pProp->AllowEdit(FALSE);
pGroup1->AddSubItem(pProp);
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("标题"), (_variant_t) _T("关于"), _T("指定窗口标题栏中显示的文本")));
m_wndPropList.AddProperty(pGroup1);
CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("窗口大小"), 0, TRUE);
pProp = new CMFCPropertyGridProperty(_T("高度"), (_variant_t) 250l, _T("指定窗口的高度"));
pProp->EnableSpinControl(TRUE, 50, 300);
pSize->AddSubItem(pProp);
pProp = new CMFCPropertyGridProperty( _T("宽度"), (_variant_t) 150l, _T("指定窗口的宽度"));
pProp->EnableSpinControl(TRUE, 50, 200);
pSize->AddSubItem(pProp);
m_wndPropList.AddProperty(pSize);
CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("字体"));
LOGFONT lf;
CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
font->GetLogFont(&lf);
_tcscpy_s(lf.lfFaceName, _T("宋体, Arial"));
pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("字体"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("指定窗口的默认字体")));
pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("使用系统字体"), (_variant_t) true, _T("指定窗口使用“MS Shell Dlg”字体")));
m_wndPropList.AddProperty(pGroup2);
CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("杂项"));
pProp = new CMFCPropertyGridProperty(_T("(名称)"), _T("应用程序"));
pProp->Enable(FALSE);
pGroup3->AddSubItem(pProp);
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("窗口颜色"), RGB(210, 192, 254), nullptr, _T("指定默认的窗口颜色"));
pColorProp->EnableOtherButton(_T("其他..."));
pColorProp->EnableAutomaticButton(_T("默认"), ::GetSysColor(COLOR_3DFACE));
pGroup3->AddSubItem(pColorProp);
static const TCHAR szFilter[] = _T("图标文件(*.ico)|*.ico|所有文件(*.*)|*.*||");
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("图标"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("指定窗口图标")));
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("文件夹"), _T("c:\\")));
m_wndPropList.AddProperty(pGroup3);
CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("层次结构"));
CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("第一个子级"));
pGroup4->AddSubItem(pGroup41);
CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("第二个子级"));
pGroup41->AddSubItem(pGroup411);
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 1"), (_variant_t) _T("值 1"), _T("此为说明")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 2"), (_variant_t) _T("值 2"), _T("此为说明")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 3"), (_variant_t) _T("值 3"), _T("此为说明")));
pGroup4->Expand(FALSE);
m_wndPropList.AddProperty(pGroup4);
}
void CPropertiesWnd::OnSetFocus(CWnd* pOldWnd)
{
CDockablePane::OnSetFocus(pOldWnd);
m_wndPropList.SetFocus();
}
void CPropertiesWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
CDockablePane::OnSettingChange(uFlags, lpszSection);
SetPropListFont();
}
void CPropertiesWnd::SetPropListFont()
{
::DeleteObject(m_fntPropList.Detach());
LOGFONT lf;
afxGlobalData.fontRegular.GetLogFont(&lf);
NONCLIENTMETRICS info;
info.cbSize = sizeof(info);
afxGlobalData.GetNonClientMetrics(info);
lf.lfHeight = info.lfMenuFont.lfHeight;
lf.lfWeight = info.lfMenuFont.lfWeight;
lf.lfItalic = info.lfMenuFont.lfItalic;
m_fntPropList.CreateFontIndirect(&lf);
m_wndPropList.SetFont(&m_fntPropList);
m_wndObjectCombo.SetFont(&m_fntPropList);
}

62
PropertiesWnd.h Normal file
View File

@ -0,0 +1,62 @@

#pragma once
class CPropertiesToolBar : public CMFCToolBar
{
public:
virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
{
CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
}
virtual BOOL AllowShowOnList() const { return FALSE; }
};
class CPropertiesWnd : public CDockablePane
{
// 构造
public:
CPropertiesWnd() noexcept;
void AdjustLayout();
// 特性
public:
void SetVSDotNetLook(BOOL bSet)
{
m_wndPropList.SetVSDotNetLook(bSet);
m_wndPropList.SetGroupNameFullWidth(bSet);
}
protected:
CFont m_fntPropList;
CComboBox m_wndObjectCombo;
CPropertiesToolBar m_wndToolBar;
CMFCPropertyGridCtrl m_wndPropList;
// 实现
public:
virtual ~CPropertiesWnd();
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnExpandAllProperties();
afx_msg void OnUpdateExpandAllProperties(CCmdUI* pCmdUI);
afx_msg void OnSortProperties();
afx_msg void OnUpdateSortProperties(CCmdUI* pCmdUI);
afx_msg void OnProperties1();
afx_msg void OnUpdateProperties1(CCmdUI* pCmdUI);
afx_msg void OnProperties2();
afx_msg void OnUpdateProperties2(CCmdUI* pCmdUI);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
DECLARE_MESSAGE_MAP()
void InitPropList();
void SetPropListFont();
int m_nComboHeight;
};

84
Resource.h Normal file
View File

@ -0,0 +1,84 @@
//{{NO_DEPENDENCIES}}
// 生成的 Microsoft Visual C++ 包含文件。
// 由 ProcessManager.rc 使用
//
#define IDD_ABOUTBOX 100
#define IDP_OLE_INIT_FAILED 100
#define IDR_POPUP_EDIT 119
#define ID_STATUSBAR_PANE1 120
#define ID_STATUSBAR_PANE2 121
#define IDS_STATUS_PANE1 122
#define IDS_STATUS_PANE2 123
#define IDS_TOOLBAR_STANDARD 124
#define IDS_TOOLBAR_CUSTOMIZE 125
#define ID_VIEW_CUSTOMIZE 126
#define IDR_MAINFRAME 128
#define IDR_MAINFRAME_256 129
#define IDR_ProcessManagerTYPE 130
#define ID_WINDOW_MANAGER 131
#define ID_VIEW_FILEVIEW 133
#define ID_VIEW_CLASSVIEW 134
#define ID_PROPERTIES 135
#define ID_OPEN 136
#define ID_OPEN_WITH 137
#define ID_DUMMY_COMPILE 138
#define ID_CLASS_ADD_MEMBER_FUNCTION 139
#define ID_CLASS_ADD_MEMBER_VARIABLE 140
#define ID_CLASS_DEFINITION 141
#define ID_CLASS_PROPERTIES 142
#define ID_NEW_FOLDER 143
#define ID_SORT_MENU 144
#define ID_SORTING_GROUPBYTYPE 145
#define ID_SORTING_SORTALPHABETIC 146
#define ID_SORTING_SORTBYTYPE 147
#define ID_SORTING_SORTBYACCESS 148
#define ID_VIEW_OUTPUTWND 149
#define ID_VIEW_PROPERTIESWND 150
#define ID_SORTPROPERTIES 151
#define ID_PROPERTIES1 152
#define ID_PROPERTIES2 153
#define ID_EXPAND_ALL 154
#define IDS_FILE_VIEW 155
#define IDS_CLASS_VIEW 156
#define IDS_OUTPUT_WND 157
#define IDS_PROPERTIES_WND 158
#define IDI_FILE_VIEW 161
#define IDI_FILE_VIEW_HC 162
#define IDI_CLASS_VIEW 163
#define IDI_CLASS_VIEW_HC 164
#define IDI_OUTPUT_WND 165
#define IDI_OUTPUT_WND_HC 166
#define IDI_PROPERTIES_WND 167
#define IDI_PROPERTIES_WND_HC 168
#define IDR_EXPLORER 169
#define IDB_EXPLORER_24 170
#define IDR_SORT 171
#define IDB_SORT_24 172
#define IDR_POPUP_SORT 173
#define IDR_POPUP_EXPLORER 174
#define IDB_FILE_VIEW 175
#define IDB_FILE_VIEW_24 176
#define IDB_CLASS_VIEW 177
#define IDB_CLASS_VIEW_24 178
#define IDR_MENU_IMAGES 179
#define IDB_MENU_IMAGES_24 180
#define ID_TOOLS_MACRO 181
#define IDR_OUTPUT_POPUP 182
#define IDR_PROPERTIES 183
#define IDB_PROPERTIES_HC 184
#define IDS_BUILD_TAB 300
#define IDS_DEBUG_TAB 301
#define IDS_FIND_TAB 302
#define IDS_EXPLORER 305
#define IDS_EDIT_MENU 306
// 新对象的下一组默认值
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 310
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 310
#define _APS_NEXT_COMMAND_VALUE 32771
#endif
#endif

43
ViewTree.cpp Normal file
View File

@ -0,0 +1,43 @@

#include "pch.h"
#include "framework.h"
#include "ViewTree.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CViewTree
CViewTree::CViewTree() noexcept
{
}
CViewTree::~CViewTree()
{
}
BEGIN_MESSAGE_MAP(CViewTree, CTreeCtrl)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CViewTree 消息处理程序
BOOL CViewTree::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
BOOL bRes = CTreeCtrl::OnNotify(wParam, lParam, pResult);
NMHDR* pNMHDR = (NMHDR*)lParam;
ASSERT(pNMHDR != nullptr);
#pragma warning(suppress : 26454)
if (pNMHDR && pNMHDR->code == TTN_SHOW && GetToolTips() != nullptr)
{
GetToolTips()->SetWindowPos(&wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSIZE);
}
return bRes;
}

23
ViewTree.h Normal file
View File

@ -0,0 +1,23 @@

#pragma once
/////////////////////////////////////////////////////////////////////////////
// CViewTree 窗口
class CViewTree : public CTreeCtrl
{
// 构造
public:
CViewTree() noexcept;
// 重写
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
// 实现
public:
virtual ~CViewTree();
protected:
DECLARE_MESSAGE_MAP()
};

49
framework.h Normal file
View File

@ -0,0 +1,49 @@
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#include <afxdisp.h> // MFC 自动化类
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // MFC 支持功能区和控制条
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

5
pch.cpp Normal file
View File

@ -0,0 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

13
pch.h Normal file
View File

@ -0,0 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H

BIN
res/ProcessManager.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
res/ProcessManager.rc2 Normal file

Binary file not shown.

BIN
res/ProcessManagerDoc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
res/Toolbar.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/Toolbar256.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
res/class_view.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/class_view_hc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
res/classview.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

BIN
res/classview_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
res/explorer.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

BIN
res/explorer_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

BIN
res/file_view.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/file_view_hc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
res/fileview.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
res/fileview_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
res/menuimages.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/menuimages_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
res/output_wnd.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/output_wnd_hc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
res/properties.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

BIN
res/properties_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
res/properties_wnd.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
res/properties_wnd_hc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
res/sort.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

BIN
res/sort_hc.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
res/userimages.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

8
targetver.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>