DragonNest/Server/ServiceManagerEx/FileLogView.cpp

109 lines
2.2 KiB
C++
Raw Normal View History

2024-12-19 09:48:26 +08:00
// FileLogView.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
//
#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 <20>׸<EFBFBD><D7B8><EFBFBD><EFBFBD>Դϴ<D4B4>.
void CFileLogView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: <20><> <20><><EFBFBD><EFBFBD> <20><>ü ũ<><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
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: <20><><EFBFBD><20>׸<EFBFBD><D7B8><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
UNUSED_ALWAYS(pDoc);
}
// CFileLogView <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
#ifdef _DEBUG
void CFileLogView::AssertValid() const
{
CScrollView::AssertValid();
}
#ifndef _WIN32_WCE
void CFileLogView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif
#endif //_DEBUG
// CFileLogView <20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
void CFileLogView::OnSize(UINT nType, int cx, int cy)
{
CScrollView::OnSize(nType, cx, cy);
// TODO: <20><><EFBFBD><20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
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);
}