145 lines
3.8 KiB
C++
145 lines
3.8 KiB
C++
// EDACDgMg.cpp : implementation file
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
#include "StdAfx.h"
|
|
|
|
#include "EDACDgMg.hpp"
|
|
|
|
#include "_AInterf.hpp"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#define C_EDAC_MESSAGE_TIMER_ID 70
|
|
#define C_EDAC_MESSAGE_TIMER_DELAY 200
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EdActors_Dialog_Message dialog
|
|
|
|
BEGIN_MESSAGE_MAP(EdActors_Dialog_Message, CDialog)
|
|
//{{AFX_MSG_MAP(EdActors_Dialog_Message)
|
|
ON_WM_TIMER()
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
//***************************************************************************
|
|
EdActors_Dialog_Message::EdActors_Dialog_Message(CString _csMessage,
|
|
CWnd* pParent /*=NULL*/)
|
|
: CDialog(EdActors_Dialog_Message::IDD, &g_oBaseFrame)
|
|
{
|
|
hOldInstance = AfxGetResourceHandle();
|
|
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
|
|
|
|
//{{AFX_DATA_INIT(EdActors_Dialog_Message)
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_csMessage = _csMessage;
|
|
}
|
|
|
|
//***************************************************************************
|
|
EdActors_Dialog_Message::~EdActors_Dialog_Message()
|
|
{
|
|
AfxSetResourceHandle(hOldInstance);
|
|
}
|
|
|
|
//***************************************************************************
|
|
void EdActors_Dialog_Message::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(EdActors_Dialog_Message)
|
|
DDX_Text(pDX, IDC_STATIC_TEXT_OF_MESSAGE, m_csMessage);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
//***************************************************************************
|
|
BOOL EdActors_Dialog_Message::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
//Computes Message size
|
|
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_STATIC_TEXT_OF_MESSAGE);
|
|
CClientDC dc(pclStatic);
|
|
CSize csMessageSize = dc.GetTextExtent(m_csMessage);
|
|
|
|
//Computes the max number of 'Spaces' to be inserted
|
|
CSize csSpaceSize = dc.GetTextExtent(" ", 1);
|
|
CRect crStaticRect;
|
|
pclStatic->GetClientRect(crStaticRect);
|
|
m_pri_uwMaxNumberOfSpaces = (unsigned short)(( crStaticRect.Width() - csMessageSize.cx ) / csSpaceSize.cx);
|
|
|
|
m_pri_uwCurrentNumberOfSpaces = 0;
|
|
m_pri_cDelta = 1;
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EdActors_Dialog_Message message handlers
|
|
|
|
//***************************************************************************
|
|
BOOL EdActors_Dialog_Message::m_pub_fn_bCreate()
|
|
{
|
|
BOOL bCreationOK = Create(EdActors_Dialog_Message::IDD, NULL);
|
|
|
|
// if ( bCreationOK )
|
|
// SetTimer(C_EDAC_MESSAGE_TIMER_ID, C_EDAC_MESSAGE_TIMER_DELAY, NULL);
|
|
|
|
return bCreationOK;
|
|
}
|
|
|
|
//***************************************************************************
|
|
void EdActors_Dialog_Message::m_pub_fn_vDestroy()
|
|
{
|
|
// KillTimer(C_EDAC_MESSAGE_TIMER_ID);
|
|
}
|
|
|
|
//***************************************************************************
|
|
void EdActors_Dialog_Message::OnTimer(UINT nIDEvent)
|
|
{
|
|
if ( nIDEvent == C_EDAC_MESSAGE_TIMER_ID )
|
|
{
|
|
if ( m_pri_cDelta == 1 )
|
|
{
|
|
if ( m_pri_uwCurrentNumberOfSpaces < m_pri_uwMaxNumberOfSpaces )
|
|
{
|
|
m_csMessage = " " + m_csMessage;
|
|
|
|
m_pri_uwCurrentNumberOfSpaces += 1;
|
|
}
|
|
else
|
|
m_pri_cDelta = -1;
|
|
}
|
|
else
|
|
{
|
|
if ( m_pri_uwCurrentNumberOfSpaces > 0 )
|
|
{
|
|
m_csMessage = m_csMessage.Right(m_csMessage.GetLength() - 1);
|
|
|
|
m_pri_uwCurrentNumberOfSpaces -= 1;
|
|
}
|
|
else
|
|
m_pri_cDelta = 1;
|
|
}
|
|
}
|
|
|
|
|
|
//Displays Text
|
|
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_STATIC_TEXT_OF_MESSAGE);
|
|
pclStatic->SetWindowText(m_csMessage);
|
|
|
|
CDialog::OnTimer(nIDEvent);
|
|
}
|
|
|
|
//***************************************************************************
|
|
void EdActors_Dialog_Message::OnDestroy()
|
|
{
|
|
CDialog::OnDestroy();
|
|
|
|
m_pub_fn_vDestroy();
|
|
}
|