338 lines
9.8 KiB
C++
338 lines
9.8 KiB
C++
/*
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : EditDia.cpp
|
|
//
|
|
// General dialog edition
|
|
// - to change the super object name
|
|
// - to indicate what is visible
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Creation date: 10 mar 1997 Author: J Thénoz
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification date: Author:
|
|
//
|
|
//
|
|
//
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
#include "acp_base.h"
|
|
#include "resource.h"
|
|
#include "incitf.h"
|
|
#include "incgam.h"
|
|
#include "incai.h"
|
|
#include "EditDia.h"
|
|
#include "WPObj.hpp"
|
|
//ANNECY Shaitan Nettoyage (12/05/98) {
|
|
/*
|
|
#include "WayObj.hpp"
|
|
#include "LinkObj.hpp"
|
|
#include "WayDia.hpp"
|
|
*/
|
|
//ENDANNECY Shaitan Nettoyage }
|
|
#include "Inter.hpp"
|
|
#include "x:\cpa\main\inc\_editid.h"
|
|
#include "oac.h"
|
|
#include "gam.h"
|
|
#include "x:/cpa/main/inc/_EditId.h"
|
|
#include "tut.h"
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EditDia
|
|
|
|
IMPLEMENT_DYNCREATE(EditDia, CFormView)
|
|
|
|
EditDia::EditDia(void)
|
|
: CFormView(EditDia::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(EditDia)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
void EditDia::fn_vSetInterface (Waypoint_Interface* poInterface)
|
|
{
|
|
m_poInterface = poInterface;
|
|
}
|
|
|
|
void EditDia::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CFormView::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(EditDia)
|
|
DDX_Control(pDX, IDC_EDIT_TAB, m_oTab);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(EditDia, CFormView)
|
|
//{{AFX_MSG_MAP(EditDia)
|
|
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ON_RADIO, OnEditWaypointOnRadio)
|
|
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_OFF_RADIO, OnEditWaypointOffRadio)
|
|
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ALL_RADIO, OnEditWaypointAllRadio)
|
|
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ISOLATE_RADIO, OnEditWaypointIsolateRadio)
|
|
//ANNECY Shaitan Nettoyage (12/05/98) {
|
|
/*
|
|
ON_NOTIFY(TCN_SELCHANGE, IDC_EDIT_TAB, OnSelchangeEditTab)
|
|
ON_BN_CLICKED(IDC_EDIT_WAY_OFF_RADIO, OnEditWayOffRadio)
|
|
ON_BN_CLICKED(IDC_EDIT_WAY_ON_RADIO, OnEditWayOnRadio)
|
|
ON_BN_CLICKED(IDC_EDIT_WAY_SELECTED_RADIO, OnEditWaySelectedRadio)
|
|
*/
|
|
//ENDANNECY Shaitan Nettoyage }
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
void EditDia::fn_vInit (void)
|
|
{
|
|
UpdateData (FALSE);
|
|
|
|
CTabCtrl* poTab = (CTabCtrl*)GetDlgItem (IDC_EDIT_TAB);
|
|
|
|
TC_ITEM stTabCtrlItemAll;
|
|
stTabCtrlItemAll.mask = TCIF_TEXT;
|
|
stTabCtrlItemAll.pszText = "All";
|
|
|
|
poTab->InsertItem( 0, &stTabCtrlItemAll );
|
|
poTab->SetItemSize( CSize (30,18) );
|
|
|
|
GetDlgItem (IDC_EDIT_WAY_ON_RADIO)->Invalidate ();
|
|
GetDlgItem (IDC_EDIT_WAY_OFF_RADIO)->Invalidate ();
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->Invalidate ();
|
|
|
|
CheckRadioButton( IDC_EDIT_WAYPOINT_ISOLATE_RADIO, IDC_EDIT_WAYPOINT_ALL_RADIO, WayPoint::fn_bDrawJustIsolateWaypoint() ? IDC_EDIT_WAYPOINT_ISOLATE_RADIO : IDC_EDIT_WAYPOINT_ALL_RADIO );
|
|
CheckRadioButton( IDC_EDIT_WAYPOINT_ON_RADIO, IDC_EDIT_WAYPOINT_OFF_RADIO, WayPoint::fn_bIsWaypointScreen() ? IDC_EDIT_WAYPOINT_ON_RADIO : IDC_EDIT_WAYPOINT_OFF_RADIO );
|
|
}
|
|
|
|
void EditDia::OnEditWaypointOnRadio()
|
|
{
|
|
// Enable buttons
|
|
GetDlgItem (IDC_EDIT_WAYPOINT_ISOLATE_RADIO)->EnableWindow(TRUE);
|
|
GetDlgItem (IDC_EDIT_WAYPOINT_ALL_RADIO)->EnableWindow(TRUE);
|
|
|
|
WayPoint::fn_vSetWaypointOnScreen (TRUE);
|
|
m_poInterface->fn_vRefreshScreen ();
|
|
}
|
|
|
|
|
|
|
|
void EditDia::OnEditWaypointOffRadio()
|
|
{
|
|
// Disable buttons
|
|
GetDlgItem (IDC_EDIT_WAYPOINT_ISOLATE_RADIO)->EnableWindow(FALSE);
|
|
GetDlgItem (IDC_EDIT_WAYPOINT_ALL_RADIO)->EnableWindow(FALSE);
|
|
|
|
WayPoint::fn_vSetWaypointOnScreen (FALSE);
|
|
m_poInterface->fn_vRefreshScreen ();
|
|
}
|
|
|
|
|
|
void EditDia::OnEditWaypointAllRadio()
|
|
{
|
|
WayPoint::fn_vSetDrawJustIsolateWaypoint (FALSE);
|
|
m_poInterface->fn_vRefreshScreen ();
|
|
}
|
|
|
|
void EditDia::OnEditWaypointIsolateRadio()
|
|
{
|
|
WayPoint::fn_vSetDrawJustIsolateWaypoint (TRUE);
|
|
m_poInterface->fn_vRefreshScreen ();
|
|
}
|
|
|
|
//ANNECY Shaitan Nettoyage (12/05/98) {
|
|
/*
|
|
void EditDia::OnSelchangeEditTab(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
|
|
if (pNMHDR->idFrom==IDC_EDIT_TAB)
|
|
{
|
|
int iIndex = m_oTab.GetCurSel();
|
|
|
|
switch (iIndex)
|
|
{
|
|
case 0: // All
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (Way::fn_eGetDisplayAllWay()) );
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
|
|
break;
|
|
|
|
case 1: // Actor
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId ((tdeWayDisplay)m_poInterface->fn_pGetSelectedEdtList()->fn_lGetDrawObjects() ) );
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
|
|
break;
|
|
|
|
case 2: // Way
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (((Way*)m_poInterface->fn_pGetSelectedWay())->fn_eGetDisplayWay() ) );
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_HIDE);
|
|
break;
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
|
|
long EditDia::fn_lGetId (long lWayDisplay)
|
|
{
|
|
tdeWayDisplay eWayDisplay = (tdeWayDisplay)lWayDisplay;
|
|
switch (eWayDisplay)
|
|
{
|
|
case eWayDisplayOn : return IDC_EDIT_WAY_ON_RADIO;
|
|
case eWayDisplayOff : return IDC_EDIT_WAY_OFF_RADIO;
|
|
case eWayDisplaySelected : return IDC_EDIT_WAY_SELECTED_RADIO;
|
|
default :return 0;
|
|
}
|
|
}
|
|
|
|
void EditDia::OnEditWayOffRadio()
|
|
{
|
|
fn_vSetDisplay (eWayDisplayOff);
|
|
}
|
|
|
|
void EditDia::OnEditWayOnRadio()
|
|
{
|
|
fn_vSetDisplay (eWayDisplayOn);
|
|
}
|
|
|
|
void EditDia::OnEditWaySelectedRadio()
|
|
{
|
|
fn_vSetDisplay (eWayDisplaySelected);
|
|
}
|
|
|
|
void EditDia::fn_vSetDisplay ( long lDisplayState )
|
|
{
|
|
tdeWayDisplay eDisplayState = (tdeWayDisplay)lDisplayState;
|
|
int iIndex = m_oTab.GetCurSel();
|
|
|
|
// set flags to object
|
|
fn_vSetFlags ( iIndex, lDisplayState );
|
|
|
|
// set all previous tab to selected
|
|
if (eDisplayState!=eWayDisplayOff)
|
|
{
|
|
for ( int iCounter=0; iCounter<iIndex; iCounter++)
|
|
fn_vSetFlags ( iCounter, (long)eWayDisplaySelected );
|
|
}
|
|
|
|
// Draw screen
|
|
m_poInterface->fn_vRefreshScreen ();
|
|
}
|
|
|
|
|
|
void EditDia::fn_vSetFlags ( int iIndex, long lDisplayState )
|
|
{
|
|
tdeWayDisplay eDisplayState = (tdeWayDisplay)lDisplayState;
|
|
switch (iIndex)
|
|
{
|
|
case 0: // all
|
|
Way::fn_vSetDisplayAllWay (eDisplayState);
|
|
break;
|
|
|
|
case 1: // instance actor
|
|
m_poInterface->fn_poGetEdtListUseByActor (m_poInterface->fn_pGetSelectedInstance ())->fn_vSetDrawObjects ((long)eDisplayState);
|
|
break;
|
|
case 2 : // way
|
|
((Way*)m_poInterface->fn_pGetSelectedWay())->fn_vSetDisplayWay(eDisplayState);
|
|
break;
|
|
}
|
|
}
|
|
*/
|
|
//ENDANNECY Shaitan Nettoyage }
|
|
|
|
|
|
void EditDia::fn_vRefresh (void)
|
|
{
|
|
// add
|
|
if (m_poInterface->fn_pGetSelectedEdtList() && m_oTab.GetItemCount()==1)
|
|
{
|
|
TC_ITEM stTabCtrlItemActor;
|
|
stTabCtrlItemActor.mask = TCIF_TEXT;
|
|
stTabCtrlItemActor.pszText = "Actor";
|
|
m_oTab.InsertItem( 1, &stTabCtrlItemActor );
|
|
}
|
|
|
|
//ANNECY Shaitan Nettoyage (12/05/98) {
|
|
/*
|
|
if (m_poInterface->fn_pGetSelectedWay() && m_oTab.GetItemCount()==2)
|
|
{
|
|
TC_ITEM stTabCtrlItemWay;
|
|
stTabCtrlItemWay.mask = TCIF_TEXT;
|
|
stTabCtrlItemWay.pszText = "Way";
|
|
m_oTab.InsertItem( 2, &stTabCtrlItemWay );
|
|
}
|
|
|
|
// retrieve
|
|
if (!m_poInterface->fn_pGetSelectedWay() && m_oTab.GetItemCount()==3)
|
|
{
|
|
m_oTab.SetCurSel (1);
|
|
m_oTab.DeleteItem (2);
|
|
}
|
|
|
|
*/
|
|
//ENDANNECY Shaitan Nettoyage }
|
|
|
|
if (!m_poInterface->fn_pGetSelectedEdtList() && m_oTab.GetItemCount()==2)
|
|
{
|
|
m_oTab.SetCurSel (0);
|
|
m_oTab.DeleteItem (1);
|
|
}
|
|
|
|
//ANNECY Shaitan Nettoyage (12/05/98) {
|
|
/*
|
|
// refresh
|
|
int iIndex = m_oTab.GetCurSel();
|
|
switch (iIndex)
|
|
{
|
|
case 0: // All
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (Way::fn_eGetDisplayAllWay()) );
|
|
break;
|
|
case 1: // Actor
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId ((tdeWayDisplay)m_poInterface->fn_pGetSelectedEdtList()->fn_lGetDrawObjects() ) );
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
|
|
break;
|
|
case 2: // Way
|
|
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_OFF_RADIO, fn_lGetId (((Way*)m_poInterface->fn_pGetSelectedWay())->fn_eGetDisplayWay() ) );
|
|
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_HIDE);
|
|
break;
|
|
}
|
|
*/
|
|
//ENDANNECY Shaitan Nettoyage }
|
|
Invalidate ();
|
|
}
|
|
|
|
BOOL EditDia::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
|
|
{
|
|
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
|
|
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControl (m_hWnd , "OWP_DisplayControlDialog" , TUT_e_Window);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ON_RADIO,"OWP_DisplayWaypointOn",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_OFF_RADIO,"OWP_DisplayWaypointOff",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ALL_RADIO,"OWP_DisplayWaypointAll",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ISOLATE_RADIO,"OWP_DisplayIsolateWaypoint",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_TAB,"OWP_DisplayControlTab",TUT_e_Window); // <- Onglet
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAY_OFF_RADIO,"OWP_DisplayWayOff",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAY_ON_RADIO,"OWP_DisplayWayOn",TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_EDIT_WAY_SELECTED_RADIO,"OWP_DisplayWaySelected",TUT_e_Button);
|
|
|
|
return bCreate;
|
|
}
|
|
|
|
void EditDia::OnDestroy()
|
|
{
|
|
CFormView::OnDestroy();
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vUnregisterControl (m_hWnd);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ON_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_OFF_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ALL_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ISOLATE_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_TAB);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_OFF_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_ON_RADIO);
|
|
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_SELECTED_RADIO);
|
|
}
|