|
// LogFrame.cpp : implementation file
//
#include "stdafx.h"
#include "log.h"
#include "LogFrame.h"
#include "TraceEvent.h"
#include "Trace.h"
#include "LogWindowView.h" // *** JMN
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLogFrame
IMPLEMENT_DYNCREATE(CLogFrame, CMDIChildWnd)
CLogFrame::CLogFrame()
{
}
CLogFrame::~CLogFrame()
{
}
BEGIN_MESSAGE_MAP(CLogFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CLogFrame)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLogFrame message handlers
/****************************************************************************
* CLogFrame::AddString
* Inputs:
* TraceEvent * event: Event to add to logging window
* Result: int
* Position at which it was added
* Effect:
* Adds the event to the trace log
****************************************************************************/
int CLogFrame::AddString(TraceEvent * event) // *** JMN
{ // *** JMN
CLogWindowView * child = (CLogWindowView *)GetWindow(GW_CHILD); // *** JMN
return child->AddString(event); // *** JMN
} // CLogFrame::AddString // *** JMN
/****************************************************************************
* CLogFrame::OnSize
* Inputs:
* UINT nType: Sizing type
* int cx: Width
* int cy: Height
* Result: void
*
* Effect:
* Computes the new client area and resizes the child window, the
* CFormView, to fit in that area.
****************************************************************************/
void CLogFrame::OnSize(UINT nType, int cx, int cy) // *** JMN
{ // *** JMN
CMDIChildWnd::OnSize(nType, cx, cy); // *** JMN
// *** JMN
CWnd * child = GetWindow(GW_CHILD); // *** JMN
CRect r; // *** JMN
GetClientRect(&r); // *** JMN
child->SetWindowPos(NULL, 0, 0, r.Width(), r.Height(), // *** JMN
SWP_NOMOVE | SWP_NOZORDER); // *** JMN
} // *** JMN
/****************************************************************************
* CLogFrame::PreCreateWindow
* Inputs:
* CREATESTRUCT & cs: Creation structure
* Result: BOOL
* Result of CMDIChildWnd::PreCreateWindow
* Effect:
* Removes the automatic-titling flag from the styles so the
* title remains fixed (it is not associated with any file)
****************************************************************************/
BOOL CLogFrame::PreCreateWindow(CREATESTRUCT& cs) // *** JMN
{ // *** JMN
cs.style &= ~FWS_ADDTOTITLE; // *** JMN
// *** JMN
return CMDIChildWnd::PreCreateWindow(cs); // *** JMN
} // *** JMN
/****************************************************************************
* CLogger::AddString
* Inputs:
* TraceEvent * event
* Result: int
* Position of insertio
* Effect:
* Adds the element to the list. If the list does not exist, delets the
* event.
****************************************************************************/
int CLogger::AddString(TraceEvent * event)
{
if(IsValid())
return frame->AddString(event);
else
{ /* no window */
delete event;
return LB_ERR;
} /* no window */
} // CLogger::AddString
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.