reman3/Rayman_X/cpa/tempgrp/OAC/Src/EdActors/EDACDgIA.cpp

185 lines
5.4 KiB
C++

// EDACDgIA.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgIA.hpp"
#include "_AInterf.hpp"
#include "EDACMStA.hpp"
#include "EDACActr.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_InconsistentAllocations dialog
BEGIN_MESSAGE_MAP(EdActors_Dialog_InconsistentAllocations, CDialog)
//{{AFX_MSG_MAP(EdActors_Dialog_InconsistentAllocations)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_Dialog_InconsistentAllocations::EdActors_Dialog_InconsistentAllocations( CPA_Actor *_pclModel,
CPA_Actor *_pclInstance,
BOOL _bAllocatedInModel,
EdActors_ActorMiniStructure *_pclModelAMS,
EdActors_ActorMiniStructure *_pclInstanceAMS,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_InconsistentAllocations::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_Dialog_InconsistentAllocations)
m_iRadioValue = 2;
//}}AFX_DATA_INIT
m_pri_bAllocatedInModel = _bAllocatedInModel;
m_pri_pclInstanceAMS = _pclInstanceAMS;
m_pri_pclModelAMS = _pclModelAMS;
if ( _bAllocatedInModel )
{
m_csText = "The MS '" + _pclInstanceAMS->m_fn_csGetScriptName() + "' is allocated in Model '";
m_csText += _pclModel->GetName() + "'\n";
m_csText += "but not in Instance '" + _pclInstance->GetName() + "'";
}
else
{
m_csText = "The MS '" + _pclInstanceAMS->m_fn_csGetScriptName() + "' is allocated in Instance '";
m_csText += _pclInstance->GetName() + "'\n";
m_csText += "but not in Model '" + _pclModel->GetName() + "'";
}
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_Dialog_InconsistentAllocations)
DDX_Radio(pDX, IDC_RADIO_ALLOCATE, m_iRadioValue);
DDX_Text(pDX, IDC_STATIC_TEXT, m_csText);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_InconsistentAllocations message handlers
//***************************************************************************
BOOL EdActors_Dialog_InconsistentAllocations::OnInitDialog()
{
CDialog::OnInitDialog();
//Inits Text for Radio
if ( m_pri_bAllocatedInModel )
{
GetDlgItem(IDC_RADIO_ALLOCATE)->SetWindowText("Allocate in Instance");
GetDlgItem(IDC_RADIO_UNALLOCATE)->SetWindowText("Unallocate in Model (and all its Instances)");
}
else
{
GetDlgItem(IDC_RADIO_ALLOCATE)->SetWindowText("Allocate in Model (and all its Instances)");
GetDlgItem(IDC_RADIO_UNALLOCATE)->SetWindowText("Unallocate in Instance");
}
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_RADIO_ALLOCATE, "OAc_InconsistentAllocationsDialog_AllocateButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_UNALLOCATE, "OAc_InconsistentAllocationsDialog_UnallocateButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_DO_NOTHING, "OAc_InconsistentAllocationsDialog_DoNothingButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDOK, "OAc_InconsistentAllocationsDialog_OKButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_RADIO_ALLOCATE);
TUT_M_vUnregisterControlID(IDC_RADIO_UNALLOCATE);
TUT_M_vUnregisterControlID(IDC_RADIO_DO_NOTHING);
TUT_M_vUnregisterControlID(IDOK);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::OnOK()
{
UpdateData(TRUE);
switch ( m_iRadioValue )
{
/////////////
//Allocates where it's not allocated
case 0:
if ( !m_pri_pclInstanceAMS->m_fn_bIsAllocated() )
{
m_pri_pclInstanceAMS->m_fn_bAllocate(FALSE);
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
else
{
m_pri_pclModelAMS->m_fn_bAllocate(FALSE);
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
break;
/////////////
//Unallocates where it's allocated
case 1:
if ( m_pri_pclInstanceAMS->m_fn_bIsAllocated() )
{
m_pri_pclInstanceAMS->m_fn_bUnallocate();
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
else
{
m_pri_pclModelAMS->m_fn_bUnallocate();
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
break;
/////////////
//Does nothing and continues
case 2:
break;
};
CDialog::OnOK();
}