📄 monitor.cpp
字号:
// Monitor.cpp: implementation of the CMonitor class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "propDoc.h"
#include "propview.h"
#include "slstDoc.h"
#include "slstView.h"
#include "ptreeDoc.h"
#include "ptreeView.h"
#include "prop.h"
#include "Monitor.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMonitor::CMonitor()
{
}
CMonitor::~CMonitor()
{
}
void CMonitor::display(CString str)
{
extern CPropApp theApp;
POSITION propDocPos=theApp.m_pDocTemplate->GetFirstDocPosition();
if (!propDocPos)
return;
CPropDoc *pDoc=(CPropDoc *)theApp.m_pDocTemplate->GetNextDoc(propDocPos);
POSITION propViewPos=pDoc->GetFirstViewPosition();
if (!propViewPos)
return;
CPropView *pView = (CPropView *) pDoc->GetNextView(propViewPos);
/*
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
// Get the active view attached to the active MDI child
// window.
CPropView *pView = (CPropView *) pChild->GetActiveView();
*/
CRichEditCtrl &pREC= pView->GetRichEditCtrl();
pREC.ReplaceSel((LPCTSTR) str, FALSE);
pView->UpdateWindow();
}
CMonitor theMonitor;
void CMonitor::list(CString str)
{
extern CPropApp theApp;
POSITION slstDocPos=theApp.m_sDocTemplate->GetFirstDocPosition();
if (!slstDocPos)
return;
CSlstDoc *pDoc=(CSlstDoc *)theApp.m_sDocTemplate->GetNextDoc(slstDocPos);
POSITION slstViewPos=pDoc->GetFirstViewPosition();
if (!slstViewPos)
return;
CSlstView *pView = (CSlstView *)pDoc->GetNextView(slstViewPos);
// Gain a reference to the list control itself
CTreeCtrl& pLSC = pView->GetTreeCtrl();
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText=str.GetBuffer(1);
pLSC.InsertItem(&tvInsert);
pView->UpdateWindow();
}
void CMonitor::show(int id, CString str)
{
extern CPropApp theApp;
POSITION ptreeDocPos=theApp.m_qDocTemplate->GetFirstDocPosition();
if (!ptreeDocPos)
return;
CPtreeDoc *pDoc=(CPtreeDoc *)theApp.m_qDocTemplate->GetNextDoc(ptreeDocPos);
POSITION ptreeViewPos=pDoc->GetFirstViewPosition();
if (!ptreeViewPos)
return;
CPtreeView *pView = (CPtreeView *)pDoc->GetNextView(ptreeViewPos);
pView->UpdateTree(id, str);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -