DragonNest/Client/EtActionTool/ModifyEventDlg.cpp

240 lines
6.4 KiB
C++
Raw Normal View History

2024-12-19 09:48:26 +08:00
// ModifyEventDlg.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
//
#include "stdafx.h"
#include "EtActionTool.h"
#include "ModifyEventDlg.h"
#include "WizardCommon.h"
#include "UnionValueProperty.h"
// CModifyEventDlg <20><>ȭ <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
IMPLEMENT_DYNAMIC(CModifyEventDlg, CDialog)
CModifyEventDlg::CModifyEventDlg(CWnd* pParent /*=NULL*/)
: CDialog(CModifyEventDlg::IDD, pParent)
{
m_pCurrentView = NULL;
m_CurrentViewType = CWizardCommon::UNKNOWN_TYPE;
}
CModifyEventDlg::~CModifyEventDlg()
{
}
void CModifyEventDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_BACK, m_BackButton);
DDX_Control(pDX, IDC_NEXT, m_NextButton);
DDX_Control(pDX, IDOK, m_FinishButton);
}
BEGIN_MESSAGE_MAP(CModifyEventDlg, CDialog)
ON_WM_CREATE()
ON_WM_SIZE()
ON_BN_CLICKED(IDC_NEXT, &CModifyEventDlg::OnBnClickedNext)
ON_BN_CLICKED(IDC_BACK, &CModifyEventDlg::OnBnClickedBack)
ON_BN_CLICKED(IDOK, &CModifyEventDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &CModifyEventDlg::OnBnClickedCancel)
ON_WM_DESTROY()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
// CModifyEventDlg <20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
BOOL CModifyEventDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CWizardCommon::s_nStartType = -1;
// TODO: <20><><EFBFBD><20>߰<EFBFBD> <20>ʱ<EFBFBD>ȭ <20>۾<EFBFBD><DBBE><EFBFBD> <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
// int nCount = sizeof(g_SignalWizardStructDefine) / sizeof(SignalWizardStruct);
for( int i=0; ; i++ ) {
if( g_SignalWizardStructDefine[i].pRuntimeClass == NULL ) break;
CFrameWnd * pFrame = new CFrameWnd;
CCreateContext context;
context.m_pNewViewClass = g_SignalWizardStructDefine[i].pRuntimeClass;
context.m_pCurrentDoc = NULL;
DWORD dwStyle;
dwStyle = WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
pFrame->Create( NULL, NULL, dwStyle, CRect(0, 0, 0, 0), this, 0, 0, &context );
pFrame->ModifyStyleEx( WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_OVERLAPPEDWINDOW, 0 );
pFrame->ModifyStyle( WS_BORDER | WS_THICKFRAME, 0 );
pFrame->SendMessageToDescendants( WM_INITIALUPDATE, 0, 0, TRUE, TRUE );
CWnd *pChild = pFrame->GetWindow(GW_CHILD);
if( pChild ) {
pChild->ModifyStyle( DS_3DLOOK, 0 );
pChild->ModifyStyleEx( WS_EX_CLIENTEDGE, 0 );
}
pFrame->ShowWindow( SW_HIDE );
g_SignalWizardStructDefine[i].pThis = pFrame;
}
SetCurrentView( m_CurrentViewType );
return TRUE; // return TRUE unless you set the focus to a control
// <20><><EFBFBD><EFBFBD>: OCX <20>Ӽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FALSE<53><45> <20><>ȯ<EFBFBD>ؾ<EFBFBD> <20>մϴ<D5B4>.
}
int CModifyEventDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: <20><><EFBFBD>⿡ Ư<><C6AF>ȭ<EFBFBD><C8AD> <20>ۼ<EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
return 0;
}
void CModifyEventDlg::SetCurrentView( CWizardCommon::VIEW_TYPE Type, bool bPreview )
{
// int nCount = sizeof(g_SignalWizardStructDefine) / sizeof(SignalWizardStruct);
for( int i=0; ; i++ ) {
if( g_SignalWizardStructDefine[i].pRuntimeClass == NULL ) break;
if( g_SignalWizardStructDefine[i].ViewType == Type ) {
CWizardCommon::VIEW_TYPE PrevViewType = m_CurrentViewType;
m_CurrentViewType = Type;
if( g_SignalWizardStructDefine[i].pThis ) {
m_pCurrentView = g_SignalWizardStructDefine[i].pThis;
CRect rcRect;
GetClientRect( &rcRect );
m_pCurrentView->MoveWindow( &CRect( 188, 0, rcRect.Width(), rcRect.Height() - 43 ) );
m_pCurrentView->ShowWindow( SW_SHOW );
CWnd *pWnd = ((CFrameWnd*)m_pCurrentView)->GetWindow(GW_CHILD);
CWizardCommon *pWizard = dynamic_cast<CWizardCommon *>(pWnd);
if( !bPreview ) pWizard->SetPrevViewType( PrevViewType );
m_NextButton.EnableWindow( pWizard->IsVisivleNextButton() );
m_BackButton.EnableWindow( pWizard->IsVisivlePrevButton() );
m_FinishButton.EnableWindow( pWizard->IsVisivleFinishButton() );
if( pWizard->IsFinishOrCancel() == true )
m_FinishButton.SetWindowText( "Finish" );
else m_FinishButton.SetWindowText( "Cancel" );
pWnd->SetFocus();
pWizard->PreProcess();
}
}
else {
if( g_SignalWizardStructDefine[i].pThis )
g_SignalWizardStructDefine[i].pThis->ShowWindow( SW_HIDE );
}
}
}
void CModifyEventDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: <20><><EFBFBD><20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
if( m_pCurrentView ) {
m_pCurrentView->MoveWindow( &CRect( 188, 0, cx, cy - 43 ) );
}
}
void CModifyEventDlg::OnBnClickedNext()
{
// TODO: <20><><EFBFBD><20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
CWnd *pWnd = ((CFrameWnd*)m_pCurrentView)->GetWindow(GW_CHILD);
CWizardCommon *pWizard = dynamic_cast<CWizardCommon *>(pWnd);
CWizardCommon::VIEW_TYPE ViewType = pWizard->GetNextView();
if( ViewType == CWizardCommon::UNKNOWN_TYPE ) return;
if( pWizard->PostProcess() == false ) {
pWnd->SetFocus();
return;
}
SetCurrentView( ViewType );
}
void CModifyEventDlg::OnBnClickedBack()
{
// TODO: <20><><EFBFBD><20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
CWnd *pWnd = ((CFrameWnd*)m_pCurrentView)->GetWindow(GW_CHILD);
CWizardCommon *pWizard = dynamic_cast<CWizardCommon *>(pWnd);
CWizardCommon::VIEW_TYPE ViewType = pWizard->GetPrevView();
if( ViewType == CWizardCommon::UNKNOWN_TYPE ) return;
SetCurrentView( ViewType, true );
}
void CModifyEventDlg::OnBnClickedOk()
{
// TODO: <20><><EFBFBD><20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
CString szStr;
m_FinishButton.GetWindowText( szStr );
if( _stricmp( szStr, "Cancel" ) == NULL ) {
OnBnClickedCancel();
return;
}
CWnd *pWnd = ((CFrameWnd*)m_pCurrentView)->GetWindow(GW_CHILD);
CWizardCommon *pWizard = dynamic_cast<CWizardCommon *>(pWnd);
if( pWizard->PostProcess() == false ) {
pWnd->SetFocus();
return;
}
OnOK();
}
void CModifyEventDlg::OnBnClickedCancel()
{
switch( CWizardCommon::s_nStartType ) {
case 0:
case 1:
SAFE_DELETE( CWizardCommon::s_pCurrentSignalItem );
break;
case 2:
break;
case 3:
case 4:
CWizardCommon::s_pCurrentSignalItem = NULL;
SAFE_DELETE( CWizardCommon::s_pCurrentPropertyVariable );
break;
case 5:
CWizardCommon::s_pCurrentSignalItem = NULL;
break;
}
OnCancel();
}
void CModifyEventDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: <20><><EFBFBD><20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
// int nCount = sizeof(g_SignalWizardStructDefine) / sizeof(SignalWizardStruct);
for( int i=0;; i++ ) {
if( g_SignalWizardStructDefine[i].pRuntimeClass == NULL ) break;
g_SignalWizardStructDefine[i].pThis->DestroyWindow();
g_SignalWizardStructDefine[i].pThis = NULL;
}
}
BOOL CModifyEventDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: <20><><EFBFBD><20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD> <20><>/<2F>Ǵ<EFBFBD> <20><EFBFBD><E2BABB><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>մϴ<D5B4>.
return CDialog::OnEraseBkgnd(pDC);
}