📄 parsecprojview.cpp
字号:
// ParseCProjView.cpp : implementation of the CParseCProjView class
//
#include "stdafx.h"
#include "ParseCProj.h"
#include "ParseCProjDoc.h"
#include "ParseCProjView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CParseCProjView
IMPLEMENT_DYNCREATE(CParseCProjView, CView)
BEGIN_MESSAGE_MAP(CParseCProjView, CView)
//{{AFX_MSG_MAP(CParseCProjView)
ON_COMMAND(ID_VCFILE_OPEN, OnVcfileOpen)
ON_COMMAND(ID_VIEW_SYSTREE, OnViewSystree)
ON_UPDATE_COMMAND_UI(ID_VIEW_SYSTREE, OnUpdateViewSystree)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CParseCProjView construction/destruction
CParseCProjView::CParseCProjView()
{
// TODO: add construction code here
}
CParseCProjView::~CParseCProjView()
{
}
BOOL CParseCProjView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CParseCProjView drawing
void CParseCProjView::OnDraw(CDC* pDC)
{
CParseCProjDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CParseCProjView diagnostics
#ifdef _DEBUG
void CParseCProjView::AssertValid() const
{
CView::AssertValid();
}
void CParseCProjView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CParseCProjDoc* CParseCProjView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CParseCProjDoc)));
return (CParseCProjDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CParseCProjView message handlers
//也可以用ON_UPDATE_COMMAND_RANGE和ON_UPDATE_COMMAND_UI_RANGE实现
//批量命令处理和界面更新操作(消息影射法)
/*********************打开一个VC工程文件(允许多选)*******************/
void CParseCProjView::OnVcfileOpen()
{
static char szFilter[] = "VC Project File (*.dsp)|*.dsp";
CFileDialog ofdVCFileDlg(TRUE, "dsp", NULL,
OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT | OFN_OVERWRITEPROMPT,
(LPCTSTR)szFilter, this);
if(ofdVCFileDlg.DoModal() == IDOK)
{
CString szProjFileName = "";
CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
//处理多选情况
POSITION pos = ofdVCFileDlg.GetStartPosition();
if(pos != NULL)
{
while(pos)
{
CString str = ofdVCFileDlg.GetNextPathName(pos);
str = str + szProjFileName;
//加入主框架的全局变量工程列表中
if(pMainFrame->m_lstProjFile.IsEmpty())
pMainFrame->m_lstProjFile.AddHead(str);
else
pMainFrame->m_lstProjFile.AddTail(str);
}
//[更新树型目录节点]
pMainFrame->UpdateSysTrees();
}
}
}
void CParseCProjView::OnViewSystree()
{
CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
BOOL bFlag = ::IsWindowVisible(pMainFrame->m_wndLeftBar.m_hWnd);
pMainFrame->m_wndLeftBar.ShowWindow(bFlag ? SW_HIDE : SW_SHOW);
pMainFrame->RecalcLayout();
}
void CParseCProjView::OnUpdateViewSystree(CCmdUI* pCmdUI)
{
CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
BOOL bFlag = ::IsWindowVisible(pMainFrame->m_wndLeftBar.m_hWnd);
pCmdUI->SetCheck(bFlag);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -