DragonNest/Server/ServiceManagerEx/FileLogView.cpp

109 lines
4.5 KiB
C++
Raw Normal View History

2024-12-20 16:56:44 +08:00
<EFBFBD><EFBFBD>// FileLogView.cpp : l<EFBFBD><EFBFBD> <EFBFBD>|Dž<EFBFBD>Ȳ<EFBFBD><EFBFBD>.
//
#include "stdafx.h"
#include "ServiceManagerEx.h"
#include "FileLogView.h"
#include "LogList.h"
// CFileLogView
IMPLEMENT_DYNCREATE(CFileLogView, CScrollView)
CFileLogView::CFileLogView()
: m_pList(NULL)
{
}
CFileLogView::~CFileLogView()
{
delete m_pList;
}
BEGIN_MESSAGE_MAP(CFileLogView, CScrollView)
ON_WM_SIZE()
END_MESSAGE_MAP()
// CFileLogView <EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD>.
void CFileLogView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: t<EFBFBD> <EFBFBD><EFBFBD>X<EFBFBD> ȴ<EFBFBD> l<EFBFBD>0<EFBFBD>|<EFBFBD> Ĭ<EFBFBD><EFBFBD>i<EFBFBD>Ȳ<EFBFBD><EFBFBD>.
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
RECT rect;
GetClientRect(&rect);
m_pList = new CLogList(MENU_FILE_LOG);
m_pList->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT, CRect(0, 0, rect.right, rect.bottom), this, IDC_LIST_FILELOG);
m_pList->SetExtendedStyle(LVS_EX_FULLROWSELECT);
const ViewConfig* pViewConfig = ((CServiceManagerExApp*)::AfxGetApp())->GetConfigEx().GetViewConfig(L"Log");
if (pViewConfig)
m_pList->SetBkColor(pViewConfig->GetBgColor());
else
m_pList->SetBkColor(RGB(0, 0, 0));
#if defined (USE_FONT_BOLD)
CFont* pFont = m_pList->GetFont();
LOGFONT lf;
pFont->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
m_pList->SetFont(pFont);
#endif //#if defined (USE_FONT_BOLD)
m_pList->InsertColumn(0, L"Date", LVCFMT_LEFT, 200);
m_pList->InsertColumn(1, L"Type", LVCFMT_LEFT, 150);
m_pList->InsertColumn(2, L"Log", LVCFMT_LEFT, rect.right - 200 - 150 - 20);
}
void CFileLogView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: <EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD> T<EFBFBD>ܴ|<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>i<EFBFBD>Ȳ<EFBFBD><EFBFBD>.
UNUSED_ALWAYS(pDoc);
}
// CFileLogView <EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD>.
#ifdef _DEBUG
void CFileLogView::AssertValid() const
{
CScrollView::AssertValid();
}
#ifndef _WIN32_WCE
void CFileLogView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif
#endif //_DEBUG
// CFileLogView T<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̬<EFBFBD>0<EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD>.
void CFileLogView::OnSize(UINT nType, int cx, int cy)
{
CScrollView::OnSize(nType, cx, cy);
// TODO: <EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD> T<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̬<EFBFBD>0<EFBFBD> T<EFBFBD>ܴ|<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>i<EFBFBD>Ȳ<EFBFBD><EFBFBD>.
if (m_pList)
m_pList->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE);
}
bool CFileLogView::OpenFile()
{
return (m_pList) ? m_pList->OpenFile() : false;
}
void CFileLogView::InsertLog(LogInfo& log)
{
if (m_pList)
m_pList->InsertLog(log);
}