Add rayman2 source files
This commit is contained in:
387
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_BCL.cpp
Normal file
387
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_BCL.cpp
Normal file
@@ -0,0 +1,387 @@
|
||||
// Implementation file for the definition of a characteristic base control
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_BCL.hpp"
|
||||
|
||||
#include "Controls\CTL_Ctl.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
#define C_SPACE_BETWEEN_CONTROLS 2
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BaseControlList::CTL_Editor_BaseControlList(BOOL _bMustDestroyElements /*= TRUE*/)
|
||||
{
|
||||
m_pri_bMustDestroyElements = _bMustDestroyElements;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BaseControlList::~CTL_Editor_BaseControlList()
|
||||
{
|
||||
if ( m_pri_bMustDestroyElements )
|
||||
m_pri_fn_vEmptyList();
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BaseControl *CTL_Editor_BaseControlList::m_pub_fn_pclAddControlAtHead(CTL_BaseWindowsControl *_pclBaseWindowsControl,
|
||||
CWnd *_pclWnd,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CTL_tdeBaseControlDisplayType _eDisplayType,
|
||||
unsigned char _ucPercentWidth,
|
||||
unsigned short _uwFixedWidth,
|
||||
unsigned short _uwHeight,
|
||||
BOOL _bSamePlaceAsNext /*= FALSE*/,
|
||||
BOOL _bGoToNextLineAfterMe /*= FALSE*/)
|
||||
{
|
||||
CTL_Editor_BaseControl *pclNewElement = new CTL_Editor_BaseControl( _pclBaseWindowsControl,
|
||||
_pclWnd,
|
||||
_pclParentControl,
|
||||
_eDisplayType,
|
||||
_ucPercentWidth,
|
||||
_uwFixedWidth,
|
||||
_uwHeight,
|
||||
_bSamePlaceAsNext,
|
||||
_bGoToNextLineAfterMe);
|
||||
|
||||
AddHead(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BaseControl *CTL_Editor_BaseControlList::m_pub_fn_pclAddControlAtTail(CTL_BaseWindowsControl *_pclBaseWindowsControl,
|
||||
CWnd *_pclWnd,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CTL_tdeBaseControlDisplayType _eDisplayType,
|
||||
unsigned char _ucPercentWidth,
|
||||
unsigned short _uwFixedWidth,
|
||||
unsigned short _uwHeight,
|
||||
BOOL _bSamePlaceAsNext /*= FALSE*/,
|
||||
BOOL _bGoToNextLineAfterMe /*= FALSE*/)
|
||||
{
|
||||
CTL_Editor_BaseControl *pclNewElement = new CTL_Editor_BaseControl( _pclBaseWindowsControl,
|
||||
_pclWnd,
|
||||
_pclParentControl,
|
||||
_eDisplayType,
|
||||
_ucPercentWidth,
|
||||
_uwFixedWidth,
|
||||
_uwHeight,
|
||||
_bSamePlaceAsNext,
|
||||
_bGoToNextLineAfterMe);
|
||||
|
||||
AddTail(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BaseControl *CTL_Editor_BaseControlList::m_pub_fn_pclAddControlAtPosition(unsigned char _ucTargettedPosition,
|
||||
CTL_BaseWindowsControl *_pclBaseWindowsControl,
|
||||
CWnd *_pclWnd,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CTL_tdeBaseControlDisplayType _eDisplayType,
|
||||
unsigned char _ucPercentWidth,
|
||||
unsigned short _uwFixedWidth,
|
||||
unsigned short _uwHeight,
|
||||
BOOL _bSamePlaceAsNext /*= FALSE*/,
|
||||
BOOL _bGoToNextLineAfterMe /*= FALSE*/)
|
||||
{
|
||||
CTL_Editor_BaseControl *pclNewElement = new CTL_Editor_BaseControl( _pclBaseWindowsControl,
|
||||
_pclWnd,
|
||||
_pclParentControl,
|
||||
_eDisplayType,
|
||||
_ucPercentWidth,
|
||||
_uwFixedWidth,
|
||||
_uwHeight,
|
||||
_bSamePlaceAsNext,
|
||||
_bGoToNextLineAfterMe);
|
||||
|
||||
//Searches for the right Position
|
||||
BOOL bFound = FALSE;
|
||||
unsigned char ucCurrentPosition = 0;
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( (pos != NULL) && (!bFound) )
|
||||
{
|
||||
if ( ucCurrentPosition < _ucTargettedPosition )
|
||||
{
|
||||
GetNext(pos);
|
||||
ucCurrentPosition ++;
|
||||
}
|
||||
else
|
||||
bFound = TRUE;
|
||||
}
|
||||
|
||||
InsertAfter(pos, pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_BaseControlList::m_pub_fn_vComputeZoneOfAllBaseControls(long _lTotalWidth,
|
||||
enum CTL_eControlSpacingType _eSpacingType)
|
||||
{
|
||||
CTL_Editor_BaseControlList *pclTempList = new CTL_Editor_BaseControlList(FALSE);
|
||||
BOOL bMustGoOn = TRUE;
|
||||
|
||||
//Builds temp sub-list with one-line controls
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
BOOL bNextLineFound = FALSE;
|
||||
POSITION GlobalPos = GetHeadPosition();
|
||||
POSITION KeepedPos = GlobalPos;
|
||||
while ( (GlobalPos != NULL) && (!bNextLineFound) )
|
||||
{
|
||||
pclBC = GetNext(GlobalPos);
|
||||
|
||||
bNextLineFound = pclBC->m_pri_bBeginsOnNextLine;
|
||||
|
||||
if ( !bNextLineFound )
|
||||
{
|
||||
KeepedPos = GlobalPos;
|
||||
|
||||
pclTempList->AddTail(pclBC);
|
||||
}
|
||||
}
|
||||
|
||||
while ( bMustGoOn )
|
||||
{
|
||||
//Adjusts Total witdh
|
||||
long lTotalWidth = _lTotalWidth - pclTempList->m_pri_fn_wComputeTotalSizeOfSpaces();
|
||||
|
||||
//Resets computed values for base controls
|
||||
CTL_Editor_BaseControl *pclCurrentBC;
|
||||
POSITION pos = pclTempList->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBC = pclTempList->GetNext(pos);
|
||||
|
||||
pclCurrentBC->m_pri_cComputedPercentage = CTL_C_BASE_CONTROL_INVALID_PERCENTAGE;
|
||||
pclCurrentBC->m_pri_lComputedWidth = 0;
|
||||
}
|
||||
|
||||
//Computes total size of "non percentaged" sizes, and each of their sizes
|
||||
long lTotalFixedSize = pclTempList->m_pri_fn_wComputeTotalSizeOfFixedSizeControlsAndTheirSize(_eSpacingType);
|
||||
|
||||
if ( _eSpacingType != CTL_SPACING_TYPE__AUTO )
|
||||
{
|
||||
ERROR_ASSERT( lTotalFixedSize < lTotalWidth );
|
||||
lTotalWidth -= lTotalFixedSize;
|
||||
|
||||
//Computes percentages for the Base Controls which are "percentaged", and each of their sizes
|
||||
pclTempList->m_pri_fn_vComputeTruePercentagesAndSizes(lTotalWidth);
|
||||
}
|
||||
|
||||
//Computes Zone for all Base Controls
|
||||
pos = pclTempList->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBC = pclTempList->GetNext(pos);
|
||||
|
||||
pclCurrentBC->m_pub_fn_vComputeBaseControlZone();
|
||||
}
|
||||
|
||||
//Builds the next sub-list
|
||||
if ( GlobalPos != NULL )
|
||||
{
|
||||
pclTempList->RemoveAll();
|
||||
GlobalPos = KeepedPos;
|
||||
bNextLineFound = FALSE;
|
||||
|
||||
//To avoid the first, for which we are sure 'BeginsOnNextLine' is TRUE
|
||||
pclBC = GetNext(GlobalPos);
|
||||
pclTempList->AddTail(pclBC);
|
||||
KeepedPos = GlobalPos;
|
||||
|
||||
while ( (GlobalPos != NULL) && (!bNextLineFound) )
|
||||
{
|
||||
pclBC = GetNext(GlobalPos);
|
||||
|
||||
bNextLineFound = pclBC->m_pri_bBeginsOnNextLine;
|
||||
|
||||
if ( !bNextLineFound )
|
||||
{
|
||||
KeepedPos = GlobalPos;
|
||||
|
||||
pclTempList->AddTail(pclBC);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
bMustGoOn = FALSE;
|
||||
}
|
||||
|
||||
//Will not destroy
|
||||
delete pclTempList;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////
|
||||
// Private Functions //
|
||||
///////////////////////
|
||||
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_BaseControlList::m_pri_fn_vEmptyList()
|
||||
{
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
delete GetNext(pos);
|
||||
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
short CTL_Editor_BaseControlList::m_pri_fn_wComputeTotalSizeOfSpaces()
|
||||
{
|
||||
short wTotalSize = 0;
|
||||
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
GetNext(pos);
|
||||
|
||||
if ( pos != NULL )
|
||||
wTotalSize += C_SPACE_BETWEEN_CONTROLS;
|
||||
}
|
||||
|
||||
return wTotalSize;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
short CTL_Editor_BaseControlList::m_pri_fn_wComputeTotalOfPercentages()
|
||||
{
|
||||
short wTotalPercentages = 0;
|
||||
|
||||
CTL_Editor_BaseControl *pclCurrentBC;
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBC = GetNext(pos);
|
||||
|
||||
if ( !pclCurrentBC->m_pri_bSamePlaceAsNext )
|
||||
if ( pclCurrentBC->m_pub_fn_bCanBeDisplayed() )
|
||||
wTotalPercentages += pclCurrentBC->m_pri_ucPercentWidth;
|
||||
}
|
||||
|
||||
return wTotalPercentages;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
short CTL_Editor_BaseControlList::m_pri_fn_wComputeTotalSizeOfFixedSizeControlsAndTheirSize(enum CTL_eControlSpacingType _eSpacingType)
|
||||
{
|
||||
short wTotalSize = 0;
|
||||
|
||||
CTL_Editor_BaseControl *pclCurrentBC;
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBC = GetNext(pos);
|
||||
|
||||
if ( pclCurrentBC->m_pub_fn_bCanBeDisplayed() )
|
||||
{
|
||||
//Computes size
|
||||
switch ( pclCurrentBC->m_pub_fn_tdeGetDisplayType() )
|
||||
{
|
||||
////
|
||||
case CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED:
|
||||
pclCurrentBC->m_pri_lComputedWidth = pclCurrentBC->m_pri_uwFixedWidth;
|
||||
break;
|
||||
|
||||
////
|
||||
case CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_PERCENTAGED:
|
||||
pclCurrentBC->m_pri_lComputedWidth = 0; //will be computed later !
|
||||
break;
|
||||
|
||||
////
|
||||
case CTL_BASE_CONTROL_DISPLAY_TYPE__USE_CALLBACK:
|
||||
{
|
||||
switch ( _eSpacingType )
|
||||
{
|
||||
/////
|
||||
case CTL_SPACING_TYPE__SINGLE_LINE:
|
||||
case CTL_SPACING_TYPE__MULTI_LINE:
|
||||
pclCurrentBC->m_pri_lComputedWidth = 0; //will be computed later !
|
||||
break;
|
||||
|
||||
/////
|
||||
case CTL_SPACING_TYPE__AUTO:
|
||||
case CTL_SPACING_TYPE__FIXED_SIZE:
|
||||
pclCurrentBC->m_pri_lComputedWidth = pclCurrentBC->m_pri_td_p_fn_lGetSize_CallBack(pclCurrentBC);
|
||||
break;
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
////
|
||||
case CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL:
|
||||
{
|
||||
switch ( _eSpacingType )
|
||||
{
|
||||
/////
|
||||
case CTL_SPACING_TYPE__SINGLE_LINE:
|
||||
case CTL_SPACING_TYPE__MULTI_LINE:
|
||||
pclCurrentBC->m_pri_lComputedWidth = 0; //will be computed later !
|
||||
break;
|
||||
|
||||
/////
|
||||
case CTL_SPACING_TYPE__AUTO:
|
||||
case CTL_SPACING_TYPE__FIXED_SIZE:
|
||||
pclCurrentBC->m_pri_lComputedWidth = pclCurrentBC->m_pri_uwFixedWidth;
|
||||
break;
|
||||
};
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
//Adds it to the total size
|
||||
wTotalSize += (short)pclCurrentBC->m_pri_lComputedWidth;
|
||||
}
|
||||
}
|
||||
|
||||
return wTotalSize;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
// !!! MUST ALWAYS BE CALLED AFTER 'm_pri_fn_wComputeTotalSizeOfFixedSizeControlsAndTheirSize' !!!
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CTL_Editor_BaseControlList::m_pri_fn_vComputeTruePercentagesAndSizes(long _lTotalWidth)
|
||||
{
|
||||
short wTotalPercentages = m_pri_fn_wComputeTotalOfPercentages();
|
||||
|
||||
if ( wTotalPercentages != 0 )
|
||||
{
|
||||
CTL_Editor_BaseControl *pclCurrentBC;
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBC = GetNext(pos);
|
||||
|
||||
if ( pclCurrentBC->m_pri_lComputedWidth == 0 )
|
||||
if ( pclCurrentBC->m_pub_fn_bCanBeDisplayed() )
|
||||
pclCurrentBC->m_pri_lComputedWidth = (_lTotalWidth * pclCurrentBC->m_pri_ucPercentWidth) / wTotalPercentages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
BOOL CTL_Editor_BaseControlList::m_pri_fn_bAllBaseControlsPercentagesInitialized()
|
||||
{
|
||||
BOOL bReturn = TRUE;
|
||||
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( (pos != NULL) && (bReturn) )
|
||||
bReturn = ( GetNext(pos)->m_pri_cComputedPercentage != CTL_C_BASE_CONTROL_INVALID_PERCENTAGE );
|
||||
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
|
||||
|
205
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_BCtl.cpp
Normal file
205
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_BCtl.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
// Implementation file for the definition of a characteristic base control
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
|
||||
#include "Controls\CTL_Ctl.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
#define C_SPACE_BETWEEN_CONTROLS 2
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
////////////////////////////
|
||||
//************************************************************************
|
||||
CTL_Editor_BaseControl::CTL_Editor_BaseControl(CTL_BaseWindowsControl *_pclBaseWindowsControl,
|
||||
CWnd *_pclWnd,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CTL_tdeBaseControlDisplayType _eDisplayType,
|
||||
unsigned char _ucPercentWidth,
|
||||
unsigned short _uwFixedWidth,
|
||||
unsigned short _uwHeight,
|
||||
BOOL _bSamePlaceAsNext,
|
||||
BOOL _bGoToNextLineAfterMe /*= FALSE*/)
|
||||
{
|
||||
m_pri_pclBaseWindowsControl = _pclBaseWindowsControl;
|
||||
m_pri_pclWnd = _pclWnd;
|
||||
m_pri_pclParentControl = _pclParentControl;
|
||||
m_pri_tdeDisplayType = _eDisplayType;
|
||||
|
||||
m_pri_ucPercentWidth = _ucPercentWidth;
|
||||
m_pri_uwFixedWidth = _uwFixedWidth;
|
||||
|
||||
m_pri_uwHeight = _uwHeight;
|
||||
|
||||
m_pri_lComputedWidth = 0;
|
||||
m_pri_cComputedPercentage = CTL_C_BASE_CONTROL_INVALID_PERCENTAGE;
|
||||
|
||||
m_pri_bSamePlaceAsNext = _bSamePlaceAsNext;
|
||||
m_pri_bBeginsOnNextLine = _bGoToNextLineAfterMe;
|
||||
|
||||
m_crBaseZoneRect = CRect(0, 0, 0, m_pri_uwHeight);
|
||||
|
||||
m_pri_td_p_fn_vCanBeDisplayedCallBack = NULL;
|
||||
m_pri_td_p_fn_vMustBeEnabledCallBack = NULL;
|
||||
|
||||
m_pri_td_p_fn_lGetSize_CallBack = NULL;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_Editor_BaseControl::~CTL_Editor_BaseControl()
|
||||
{
|
||||
delete m_pri_pclWnd;
|
||||
}
|
||||
|
||||
//Access functions
|
||||
///////////////////////
|
||||
|
||||
//************************************************************************
|
||||
CRect &CTL_Editor_BaseControl::m_fn_rcrGetZoneRect()
|
||||
{
|
||||
return m_crBaseZoneRect;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CWnd *CTL_Editor_BaseControl::m_fn_pclGetWnd()
|
||||
{
|
||||
return m_pri_pclWnd;
|
||||
}
|
||||
|
||||
//Member functions
|
||||
///////////////////////
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_fn_vHideBaseControl()
|
||||
{
|
||||
if ( m_pri_pclWnd != NULL )
|
||||
m_pri_pclWnd->ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_fn_vDisplayBaseControl()
|
||||
{
|
||||
if ( m_pri_pclWnd != NULL )
|
||||
{
|
||||
if ( m_pub_fn_bCanBeDisplayed() )
|
||||
{
|
||||
m_pri_pclWnd->ShowWindow(SW_SHOW);
|
||||
|
||||
//Enables/Disables
|
||||
m_pri_pclWnd->EnableWindow(m_pub_fn_bMustBeEnabled());
|
||||
}
|
||||
else
|
||||
m_pri_pclWnd->ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_fn_vMoveBaseControl()
|
||||
{
|
||||
if ( m_pri_pclWnd != NULL )
|
||||
m_pri_pclWnd->MoveWindow(m_crBaseZoneRect);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_BaseControl::m_pub_fn_bCanBeDisplayed()
|
||||
{
|
||||
BOOL bCanBeDisplayed = TRUE;
|
||||
|
||||
if ( m_pri_td_p_fn_vCanBeDisplayedCallBack != NULL )
|
||||
bCanBeDisplayed = m_pri_td_p_fn_vCanBeDisplayedCallBack(this);
|
||||
|
||||
return bCanBeDisplayed;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_BaseControl::m_pub_fn_bMustBeEnabled()
|
||||
{
|
||||
BOOL bMustBeEnabled = TRUE;
|
||||
|
||||
if ( m_pri_td_p_fn_vMustBeEnabledCallBack != NULL )
|
||||
bMustBeEnabled = m_pri_td_p_fn_vMustBeEnabledCallBack(this);
|
||||
|
||||
return bMustBeEnabled;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_pub_fn_vComputeBaseControlZone()
|
||||
{
|
||||
m_crBaseZoneRect.left = 0;
|
||||
m_crBaseZoneRect.top = 0;
|
||||
m_crBaseZoneRect.right = m_pri_lComputedWidth;
|
||||
m_crBaseZoneRect.bottom = m_pri_uwHeight;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_pub_fn_vMoveInZone(CRect &_r_crNextRectOnSameLine,
|
||||
CRect &_r_crNextRectOnNextLine)
|
||||
{
|
||||
//Moves Base Control to the right position
|
||||
if ( m_pri_bBeginsOnNextLine )
|
||||
m_crBaseZoneRect.OffsetRect(_r_crNextRectOnNextLine.left, _r_crNextRectOnNextLine.top);
|
||||
else
|
||||
m_crBaseZoneRect.OffsetRect(_r_crNextRectOnSameLine.left, _r_crNextRectOnSameLine.top);
|
||||
m_fn_vMoveBaseControl();
|
||||
|
||||
//Computes Zones for next Base Control
|
||||
//Adjusts bottom of current line (in case of a bigger control than previous ones)
|
||||
_r_crNextRectOnSameLine.bottom = _r_crNextRectOnSameLine.top
|
||||
+ max(_r_crNextRectOnSameLine.Height(), m_pri_uwHeight);
|
||||
|
||||
short wOldHeight = _r_crNextRectOnNextLine.Height();
|
||||
_r_crNextRectOnNextLine.top = _r_crNextRectOnSameLine.bottom + C_SPACE_BETWEEN_CONTROLS;
|
||||
_r_crNextRectOnNextLine.bottom = _r_crNextRectOnNextLine.top + wOldHeight;
|
||||
|
||||
if ( m_pri_bBeginsOnNextLine )
|
||||
_r_crNextRectOnSameLine = _r_crNextRectOnNextLine;
|
||||
|
||||
if ( !m_pri_bSamePlaceAsNext )
|
||||
_r_crNextRectOnSameLine.left += (m_pri_lComputedWidth + C_SPACE_BETWEEN_CONTROLS);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_pub_fn_vSetCanBeDisplayedCallBack(CTL_td_p_fn_bBaseControlCanBeDisplayed _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_td_p_fn_vCanBeDisplayedCallBack == NULL );
|
||||
|
||||
m_pri_td_p_fn_vCanBeDisplayedCallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_pub_fn_vSetMustBeEnabledCallBack(CTL_td_p_fn_bBaseControlCanBeDisplayed _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_td_p_fn_vMustBeEnabledCallBack == NULL );
|
||||
|
||||
m_pri_td_p_fn_vMustBeEnabledCallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_BaseControl::m_pub_fn_pclGetParentControl()
|
||||
{
|
||||
return m_pri_pclParentControl;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BaseControl::m_pub_fn_vSetGetSize_CallBack(CTL_tdp_fn_lGetSizeOfWindow _p_fn_lCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_td_p_fn_lGetSize_CallBack == NULL );
|
||||
|
||||
m_pri_td_p_fn_lGetSize_CallBack = _p_fn_lCallBack;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_tdeBaseControlDisplayType CTL_Editor_BaseControl::m_pub_fn_tdeGetDisplayType()
|
||||
{
|
||||
return m_pri_tdeDisplayType;
|
||||
}
|
473
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_Ctl.cpp
Normal file
473
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_Ctl.cpp
Normal file
@@ -0,0 +1,473 @@
|
||||
// Implementation file for the definition of a group of controls
|
||||
// used to edit a Characteristic
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_Ctl.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
#define C_TIMER_DELAY 150 //in milliseconds
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor(s) / Destructor
|
||||
////////////////////////////////////
|
||||
//************************************************************************
|
||||
CTL_Editor_Control::CTL_Editor_Control(CTL_tdeEditorDataType tdeType,
|
||||
BOOL bIsAlwaysReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
//ANNECY BBB {
|
||||
BOOL _bAcceptNameFromData /*= TRUE*/,
|
||||
//ANNECY BBB }
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair /* = 0*/
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
//ANNECY BBB {
|
||||
m_bAcceptNameFromData = _bAcceptNameFromData;
|
||||
//ANNECY BBB }
|
||||
m_tdeDataType = tdeType;
|
||||
m_bIsAlwaysReadOnly = bIsAlwaysReadOnly;
|
||||
m_bIsReadOnly = m_bIsAlwaysReadOnly;
|
||||
m_tdeSpacingType = tdeSpacingType;
|
||||
m_bUserCanChangeAspect = bUserCanChangeAspect;
|
||||
m_pro_csControlName = _csControlName;
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Trying to create a control",
|
||||
"CTL_Editor_Control::CTL_Editor_Control(...)",
|
||||
E_ERROR_GRAVITY_WARNING,
|
||||
"No name was given to the control... TUT Module probably won't accept this !");
|
||||
ERROR_ASSERT( !m_pro_csControlName.IsEmpty() );
|
||||
#endif
|
||||
//END
|
||||
|
||||
m_pri_pclParentList = _pclParentList;
|
||||
|
||||
m_bControlCreated = FALSE;
|
||||
m_bHidden = TRUE;
|
||||
|
||||
m_pclNameStatic = NULL;
|
||||
m_pclData = NULL;
|
||||
|
||||
m_crZoneRect = CRect(0,0,0,0);
|
||||
|
||||
m_pclListOfBaseControls = new CTL_Editor_BaseControlList;
|
||||
|
||||
m_pri_p_fn_bControlCanBeDisplayedCallBack = CTL_g_p_fnDefaultCallBack_ControlCanBeDisplayed;
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
m_ucInitialCurrentPair = ucInitialCurrentPair;
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_Editor_Control::~CTL_Editor_Control()
|
||||
{
|
||||
delete m_pclListOfBaseControls;
|
||||
}
|
||||
|
||||
//Access functions
|
||||
//////////////////////////////////
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_fn_bIsReadOnly()
|
||||
{
|
||||
if ( m_bIsAlwaysReadOnly )
|
||||
return TRUE;
|
||||
else
|
||||
return m_bIsReadOnly;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_fn_bIsAlwaysReadOnly()
|
||||
{
|
||||
return m_bIsAlwaysReadOnly;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_pub_fn_bHasBeenCreated()
|
||||
{
|
||||
return m_bControlCreated;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_fn_bCanUserChangeAspect()
|
||||
{
|
||||
return m_bUserCanChangeAspect;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CRect CTL_Editor_Control::m_fn_crGetZoneRect()
|
||||
{
|
||||
return m_crZoneRect;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_Editor_Data *CTL_Editor_Control::m_fn_pclGetEditedData()
|
||||
{
|
||||
return m_pclData;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_fn_vSetEditedData(CTL_Editor_Data *pclData)
|
||||
{
|
||||
m_pclData = pclData;
|
||||
m_pclData->m_pub_fn_vSetParentControl(this);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_tdeEditorDataType CTL_Editor_Control::m_pub_fn_tdeGetDataType()
|
||||
{
|
||||
return m_tdeDataType;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_tdeControlSpacingType CTL_Editor_Control::m_fn_tdeGetSpacingType()
|
||||
{
|
||||
return m_tdeSpacingType;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_pub_fn_vDisplayInZone( CRect &_r_crSameLineDestinationZone,
|
||||
CRect &_r_crNextLineDestinationZone)
|
||||
{
|
||||
if ( m_pub_fn_bMustBeDisplayed() )
|
||||
{
|
||||
//Security !!
|
||||
_r_crSameLineDestinationZone.bottom = _r_crSameLineDestinationZone.top;
|
||||
_r_crNextLineDestinationZone.bottom = _r_crNextLineDestinationZone.top;
|
||||
|
||||
switch( m_fn_tdeGetSpacingType() )
|
||||
{
|
||||
//#################################################################
|
||||
case CTL_SPACING_TYPE__MULTI_LINE:
|
||||
case CTL_SPACING_TYPE__SINGLE_LINE:
|
||||
//Forces this control to start on next line
|
||||
_r_crSameLineDestinationZone = _r_crNextLineDestinationZone;
|
||||
|
||||
m_pri_fn_vDisplaySubControlsInZone( TRUE,
|
||||
_r_crSameLineDestinationZone,
|
||||
_r_crNextLineDestinationZone);
|
||||
|
||||
//Forces the next control to start on next line
|
||||
_r_crSameLineDestinationZone = _r_crNextLineDestinationZone;
|
||||
|
||||
break;
|
||||
|
||||
//#################################################################
|
||||
case CTL_SPACING_TYPE__AUTO:
|
||||
case CTL_SPACING_TYPE__FIXED_SIZE:
|
||||
//If control lies in the left X space
|
||||
if ( m_pri_fn_bCanDisplayInWidth(_r_crSameLineDestinationZone.Width()) )
|
||||
{
|
||||
m_pri_fn_vDisplaySubControlsInZone( FALSE,
|
||||
_r_crSameLineDestinationZone,
|
||||
_r_crNextLineDestinationZone);
|
||||
}
|
||||
//else changes for the next line
|
||||
else
|
||||
{
|
||||
//Forces this control to start on next line
|
||||
_r_crSameLineDestinationZone = _r_crNextLineDestinationZone;
|
||||
|
||||
m_pri_fn_vDisplaySubControlsInZone( TRUE,
|
||||
_r_crSameLineDestinationZone,
|
||||
_r_crNextLineDestinationZone);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}//End of test for non display
|
||||
else
|
||||
{
|
||||
m_fn_vHide();
|
||||
//Security !!
|
||||
m_bHidden = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_pri_fn_bCanDisplayInWidth(unsigned short uwLeftWidth)
|
||||
{
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
ERROR_ASSERT( (m_fn_tdeGetSpacingType() == CTL_SPACING_TYPE__AUTO)
|
||||
|| (m_fn_tdeGetSpacingType() == CTL_SPACING_TYPE__FIXED_SIZE)
|
||||
);
|
||||
#endif
|
||||
//END
|
||||
return ( uwLeftWidth >= m_pri_fn_uwComputeTotalWidth(0) ); //Parameter is only used for Percentage calculations
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
unsigned short CTL_Editor_Control::m_pri_fn_uwComputeTotalWidth(unsigned short uwAllowedTotalWidth)
|
||||
{
|
||||
unsigned short uwTotalWidth = 0;
|
||||
|
||||
m_pclListOfBaseControls->m_pub_fn_vComputeZoneOfAllBaseControls(uwAllowedTotalWidth,
|
||||
m_fn_tdeGetSpacingType());
|
||||
|
||||
CTL_Editor_BaseControl *pclBaseCtrl;
|
||||
POSITION pos = m_pclListOfBaseControls->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclBaseCtrl = m_pclListOfBaseControls->GetNext(pos);
|
||||
|
||||
if ( !pclBaseCtrl->m_pri_bSamePlaceAsNext )
|
||||
uwTotalWidth += (pclBaseCtrl->m_pri_lComputedWidth + CTL_C_SPACE_BETWEEN_CONTROLS);
|
||||
}
|
||||
|
||||
return uwTotalWidth;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
unsigned char CTL_Editor_Control::m_pri_fn_ucGetBaseControlNumber()
|
||||
{
|
||||
return m_pclListOfBaseControls->GetCount();
|
||||
}
|
||||
|
||||
//Member functions
|
||||
///////////////////////////
|
||||
//************************************************************************
|
||||
//Display of sub_controls in list
|
||||
void CTL_Editor_Control::m_pri_fn_vDisplaySubControlsInZone(BOOL _bUseNextLineZone,
|
||||
CRect &_r_crSameLineDestinationZone,
|
||||
CRect &_r_crNextLineDestinationZone)
|
||||
{
|
||||
ERROR_ASSERT( m_pclData != NULL );
|
||||
|
||||
if ( m_fn_bAcceptsToTakeNameFromData() && (m_pub_fn_csGetControlName().CompareNoCase(m_pclData->m_pub_fn_csGetDataName()) != 0) ) //ANNECY BBB
|
||||
m_pub_fn_csSetControlName(m_pclData->m_pub_fn_csGetDataName());
|
||||
|
||||
//Computes exact width for all base controls in list
|
||||
short wTotalWidth = _bUseNextLineZone ? _r_crNextLineDestinationZone.Width(): _r_crSameLineDestinationZone.Width();
|
||||
|
||||
m_pclListOfBaseControls->m_pub_fn_vComputeZoneOfAllBaseControls(wTotalWidth,
|
||||
m_fn_tdeGetSpacingType());
|
||||
|
||||
//Then displays them
|
||||
CTL_Editor_BaseControl *pclCurrentBaseControl;
|
||||
POSITION pos = m_pclListOfBaseControls->GetHeadPosition();
|
||||
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentBaseControl = m_pclListOfBaseControls->GetNext(pos);
|
||||
|
||||
if ( pclCurrentBaseControl->m_pub_fn_bCanBeDisplayed() )
|
||||
pclCurrentBaseControl->m_pub_fn_vMoveInZone(_r_crSameLineDestinationZone,
|
||||
_r_crNextLineDestinationZone);
|
||||
}
|
||||
|
||||
//Displays (only if necessary, i.e. if hidden)
|
||||
m_bHidden = TRUE; //TEMPORAIRE : to force display
|
||||
m_fn_vDisplay();
|
||||
//Security !!
|
||||
m_bHidden = FALSE;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_Control::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_pub_fn_vSetControlCanBeDisplayedCallBack(CTL_td_p_fn_bControlCanBeDisplayed _p_fn_CallBalck)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_p_fn_bControlCanBeDisplayedCallBack == NULL );
|
||||
|
||||
if ( m_pri_p_fn_bControlCanBeDisplayedCallBack == NULL )
|
||||
m_pri_p_fn_bControlCanBeDisplayedCallBack = _p_fn_CallBalck;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_Control::m_pub_fn_bMustBeDisplayed()
|
||||
{
|
||||
//Calls CallBack if it exists
|
||||
if ( m_pri_p_fn_bControlCanBeDisplayedCallBack != NULL )
|
||||
return m_pri_p_fn_bControlCanBeDisplayedCallBack(this);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to edit complex data (which can not be directly
|
||||
//edited)
|
||||
void CTL_Editor_Control::m_fn_vEditData()
|
||||
{
|
||||
ERROR_ASSERT( FALSE ) ;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to hide group of controls
|
||||
void CTL_Editor_Control::m_fn_vHide()
|
||||
{
|
||||
m_pro_fn_vHideBaseControls();
|
||||
|
||||
m_crZoneRect = CRect(0,0,0,0);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_fn_vAskForNewAspect(unsigned short uwAllowedTotalWidth)
|
||||
{
|
||||
// EdActors_ControlDefinitionDialog dial(this, uwAllowedTotalWidth);
|
||||
// dial.DoModal();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to develop complex data in tree
|
||||
void CTL_Editor_Control::m_fn_vDevelopData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//The list of base controls
|
||||
//************************************************************************
|
||||
CTL_Editor_BaseControlList *CTL_Editor_Control::m_pub_fn_pclGetListOfBaseControls()
|
||||
{
|
||||
return m_pclListOfBaseControls;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//The parent list of controls
|
||||
CTL_Editor_ControlList *CTL_Editor_Control::m_pub_fn_pclGetParentList()
|
||||
{
|
||||
return m_pri_pclParentList;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Returns the old name
|
||||
CString CTL_Editor_Control::m_pub_fn_csSetControlName(CString _csNewName)
|
||||
{
|
||||
CString csOldName(m_pro_csControlName);
|
||||
|
||||
m_pro_csControlName = _csNewName;
|
||||
|
||||
//Updates display
|
||||
m_pclNameStatic->m_fn_vSetTextToDisplay(m_pro_csControlName);
|
||||
|
||||
return csOldName;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CString CTL_Editor_Control::m_pub_fn_csGetControlName()
|
||||
{
|
||||
return m_pro_csControlName;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
CTL_Editor_Static *CTL_Editor_Control::m_pub_fn_pclGetNameStatic()
|
||||
{
|
||||
return m_pclNameStatic;
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_Control::m_pub_fn_pclAddOwnerData(void *_pvDataPtr,
|
||||
CString _csName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_pvDataPtr, _csName);
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_Control::m_pub_fn_pclAddOwnerData(long _lData,
|
||||
CString _csName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_lData, _csName);
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_Control::m_pub_fn_pclGetOwnerDataWithName(CString _csSearchedName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclFindOwnerDataWithName(_csSearchedName);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// Constructs the Edit for the name and the CheckBox for the links
|
||||
BOOL CTL_Editor_Control::m_pro_fn_bCreateBaseControls(unsigned char _ucNamePercentWidth,
|
||||
unsigned short _uwNameMinWidth,
|
||||
unsigned short _uwHeight,
|
||||
BOOL _bGoToNextLineAfterName /*= FALSE*/)
|
||||
{
|
||||
BOOL bCreationOK = TRUE;
|
||||
|
||||
//Creates a static box for the name of the charac.
|
||||
////////////////////////////////////////////////////
|
||||
ERROR_ASSERT( m_pclNameStatic == NULL );
|
||||
|
||||
m_pclNameStatic = new CTL_Editor_Static(m_pro_csControlName,
|
||||
CTL_STATIC_TYPE__FIELD_NAME,
|
||||
0,
|
||||
this,
|
||||
m_pclParentWnd
|
||||
);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclNameStatic->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Field Name");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclNameStatic,
|
||||
m_pclNameStatic,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__USE_CALLBACK,
|
||||
_ucNamePercentWidth,
|
||||
_uwNameMinWidth,
|
||||
_uwHeight,
|
||||
FALSE,
|
||||
_bGoToNextLineAfterName);
|
||||
|
||||
pclBC->m_pub_fn_vSetGetSize_CallBack(CTL_fn_lComputeSizeOfStaticForName);
|
||||
|
||||
return bCreationOK;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_pro_fn_vDisplayBaseControls()
|
||||
{
|
||||
if ( m_bHidden )
|
||||
{
|
||||
POSITION pos = m_pclListOfBaseControls->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
m_pclListOfBaseControls->GetNext(pos)->m_fn_vDisplayBaseControl();
|
||||
|
||||
m_bHidden = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_Control::m_pro_fn_vHideBaseControls()
|
||||
{
|
||||
if ( !m_bHidden )
|
||||
{
|
||||
POSITION pos = m_pclListOfBaseControls->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
m_pclListOfBaseControls->GetNext(pos)->m_fn_vHideBaseControl();
|
||||
|
||||
m_bHidden = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
423
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlA.cpp
Normal file
423
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlA.cpp
Normal file
@@ -0,0 +1,423 @@
|
||||
// Implementation file for the definition of a characteristic type
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "scr.h"
|
||||
#include "ai/aibase/gsparam.h"
|
||||
#define ACTIVE_EDITOR /* we don't want optimized arrays in editors, but defining ACTIVE_EDITOR in the project's settings doesn't work... */
|
||||
#include "ai/aibase/array.h"
|
||||
#undef ACTIVE_EDITOR
|
||||
|
||||
#include "Controls\CTL_Ctla.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_Data.hpp"
|
||||
#include "WControls\CTL_WBut.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
#include "Controls\Ctl_Ctle.hpp"
|
||||
#include "Data\CTL_Date.hpp"
|
||||
#include "Controls\Ctl_Ctlv.hpp"
|
||||
#include "Data\CTL_Datv.hpp"
|
||||
#include "Controls\Ctl_Ctlf.hpp"
|
||||
#include "Data\CTL_Datf.hpp"
|
||||
#include "Controls\Ctl_Ctli.hpp"
|
||||
#include "Data\CTL_Dati.hpp"
|
||||
#include "others\ctl_enli.hpp"
|
||||
|
||||
#include "CTL_Dga.hpp"
|
||||
|
||||
#include "ero.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#undef CPA_EXPORT
|
||||
#define ACTIVE_EDITOR
|
||||
#define CPA_EXPORT __declspec(dllimport)
|
||||
#include "ITF\FRMGest.hpp"
|
||||
CPA_EXPORT BaseFrame g_oBaseFrame;
|
||||
#undef CPA_EXPORT
|
||||
|
||||
//Constructor / Destructor
|
||||
//**************************************************************************************
|
||||
CTL_Editor_ArrayControl::CTL_Editor_ArrayControl(CTL_tdeEditorDataType tdeType,
|
||||
BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(tdeType,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_pclEditButton = NULL;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_ArrayControl::~CTL_Editor_ArrayControl()
|
||||
{
|
||||
/*
|
||||
if ( m_pclEditButton != NULL )
|
||||
delete m_pclEditButton;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//Member functions
|
||||
|
||||
//**************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_ArrayControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_BOOL_NAME_BOX_PERCENT_WIDTH,
|
||||
C_BOOL_NAME_BOX_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates check box
|
||||
m_pclEditButton = new CTL_Editor_Button("Edit",
|
||||
CTL_BUTTON_TYPE__EDIT,
|
||||
WS_TABSTOP,
|
||||
this,
|
||||
m_pclParentWnd
|
||||
);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclEditButton->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Array");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
m_pclEditButton->EnableWindow(!m_fn_bIsAlwaysReadOnly());
|
||||
|
||||
m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclEditButton,
|
||||
m_pclEditButton,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_BUTTON_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_ArrayControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update Control in case of values changes.
|
||||
void CTL_Editor_ArrayControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_ArrayControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_ArrayControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( m_pclEditButton != NULL )
|
||||
m_pclEditButton->EnableWindow(FALSE);
|
||||
|
||||
m_bIsReadOnly = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_ArrayControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_pclEditButton != NULL )
|
||||
m_pclEditButton->EnableWindow(TRUE);
|
||||
|
||||
m_bIsReadOnly = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_ArrayControl::m_fn_vSetCurrentValue(tdstArray *_pstNewValue)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_ArrayData *)m_pclData)->mfn_pstSetCurrentValue (_pstNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
// if ( m_td_p_fn_vDataHasChangedCallBack != NULL )
|
||||
// m_td_p_fn_vDataHasChangedCallBack(m_pclData);
|
||||
|
||||
//Updates motor's data
|
||||
m_pclData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
m_fn_vUpdateParent();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Called when button is pressed
|
||||
void CTL_Editor_ArrayControl::m_fn_vEditData()
|
||||
{
|
||||
//Displays the Dialog to Edit the Masked data
|
||||
// CTL_DialogMaskedDataEdition EditionDial(this, AfxGetMainWnd());
|
||||
CTL_DialogArrayDataEdition EditionDial(this, &g_oBaseFrame);
|
||||
if (EditionDial.DoModal() == IDOK)
|
||||
{
|
||||
//Updates motor's data in case of change
|
||||
m_fn_vUpdate (CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
m_fn_vUpdateParent();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************************
|
||||
// the array flavours
|
||||
//*************************************************************************************
|
||||
//*************************************************************************************
|
||||
// Array Enum
|
||||
//*************************************************************************************
|
||||
//**************************************************************************************
|
||||
CTL_Editor_ArrayEnumControl::CTL_Editor_ArrayEnumControl (BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
: CTL_Editor_ArrayControl(CTL_DATA_TYPE__ARRAY_ENUM,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
{
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack = NULL;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ArrayEnumControl::m_fn_pctrlCreateElementControl (CTL_Editor_ControlList *pclControlList)
|
||||
{
|
||||
return new CTL_Editor_EnumControl (FALSE,
|
||||
pclControlList,
|
||||
"",
|
||||
FALSE,
|
||||
0);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Data *CTL_Editor_ArrayEnumControl::m_fn_pdataCreateElementData (CTL_Editor_DataList *pclDataList, CTL_Editor_Control *pclCtrl)
|
||||
{
|
||||
CTL_Editor_EnumDescriptor *pclEnumList = new CTL_Editor_EnumDescriptor ("", 4);
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack (NULL, pclEnumList);
|
||||
|
||||
((CTL_Editor_EnumControl *) pclCtrl) -> m_pub_fn_vSetBuildEnumDesciptor_CallBack (m_td_pri_fn_vBuildEnumDesciptor_CallBack);
|
||||
|
||||
return new CTL_Editor_EnumData (pclEnumList,
|
||||
"",
|
||||
pclDataList);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_ArrayEnumControl::m_pub_fn_vSetBuildEnumDesciptor_CallBack(CTL_td_p_fn_vBuildEnumDescriptor _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_td_pri_fn_vBuildEnumDesciptor_CallBack == NULL );
|
||||
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//*************************************************************************************
|
||||
// Array Vector
|
||||
//*************************************************************************************
|
||||
//***************************************************************************
|
||||
CTL_Editor_ArrayVectorControl::CTL_Editor_ArrayVectorControl (BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
: CTL_Editor_ArrayControl(CTL_DATA_TYPE__ARRAY_VECTOR,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
CTL_Editor_Control *CTL_Editor_ArrayVectorControl::m_fn_pctrlCreateElementControl (CTL_Editor_ControlList *pclControlList)
|
||||
{
|
||||
return new CTL_Editor_VectorControl (-FLT_MAX,
|
||||
FLT_MAX,
|
||||
sizeof(MTH_tdxReal),
|
||||
FALSE,
|
||||
pclControlList,
|
||||
"",
|
||||
FALSE,
|
||||
0);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Data *CTL_Editor_ArrayVectorControl::m_fn_pdataCreateElementData (CTL_Editor_DataList *pclDataList, CTL_Editor_Control *pclCtrl)
|
||||
{
|
||||
return new CTL_Editor_VectorData (sizeof (MTH_tdxReal),
|
||||
"",
|
||||
pclDataList);
|
||||
}
|
||||
|
||||
//*************************************************************************************
|
||||
// Array Float
|
||||
//*************************************************************************************
|
||||
//***************************************************************************
|
||||
CTL_Editor_ArrayFloatControl::CTL_Editor_ArrayFloatControl (BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
: CTL_Editor_ArrayControl(CTL_DATA_TYPE__ARRAY_DECIMAL,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
CTL_Editor_Control *CTL_Editor_ArrayFloatControl::m_fn_pctrlCreateElementControl (CTL_Editor_ControlList *pclControlList)
|
||||
{
|
||||
return new CTL_Editor_DecimalControl (-FLT_MAX,
|
||||
FLT_MAX,
|
||||
sizeof(MTH_tdxReal),
|
||||
FALSE,
|
||||
CTL_SPACING_TYPE__SINGLE_LINE,
|
||||
FALSE,
|
||||
pclControlList,
|
||||
"",
|
||||
FALSE,
|
||||
0);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Data *CTL_Editor_ArrayFloatControl::m_fn_pdataCreateElementData (CTL_Editor_DataList *pclDataList, CTL_Editor_Control *pclCtrl)
|
||||
{
|
||||
return new CTL_Editor_DecimalData (sizeof (MTH_tdxReal),
|
||||
"",
|
||||
pclDataList);
|
||||
}
|
||||
|
||||
//*************************************************************************************
|
||||
// Array Integer
|
||||
//*************************************************************************************
|
||||
//***************************************************************************
|
||||
CTL_Editor_ArrayIntegerControl::CTL_Editor_ArrayIntegerControl (BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
: CTL_Editor_ArrayControl(CTL_DATA_TYPE__ARRAY_INTEGER,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
CTL_Editor_Control *CTL_Editor_ArrayIntegerControl::m_fn_pctrlCreateElementControl (CTL_Editor_ControlList *pclControlList)
|
||||
{
|
||||
return new CTL_Editor_IntegerControl (LONG_MIN,
|
||||
LONG_MAX,
|
||||
4,
|
||||
TRUE,
|
||||
FALSE,
|
||||
CTL_SPACING_TYPE__SINGLE_LINE,
|
||||
FALSE,
|
||||
pclControlList,
|
||||
"",
|
||||
FALSE,
|
||||
0);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Data *CTL_Editor_ArrayIntegerControl::m_fn_pdataCreateElementData (CTL_Editor_DataList *pclDataList, CTL_Editor_Control *pclCtrl)
|
||||
{
|
||||
return new CTL_Editor_IntegerData ( 4,
|
||||
TRUE,
|
||||
"",
|
||||
pclDataList);
|
||||
}
|
177
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlB.cpp
Normal file
177
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlB.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
// Implementation file for the definition of a characteristic type
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlB.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatB.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BooleanControl::CTL_Editor_BooleanControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__BOOLEAN,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_pclCheckBox = NULL;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_BooleanControl::~CTL_Editor_BooleanControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Member functions
|
||||
|
||||
//**************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_BooleanControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls(C_BOOL_NAME_BOX_PERCENT_WIDTH,
|
||||
C_BOOL_NAME_BOX_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates check box
|
||||
m_pclCheckBox = new CTL_Editor_CheckBox(CTL_CHECK_BOX_TYPE__NORMAL,
|
||||
WS_TABSTOP,
|
||||
this,
|
||||
m_pclParentWnd);
|
||||
|
||||
m_pclCheckBox->m_pub_fn_vSetHasBeenClicked_CallBack(s_m_fn_vCheckBoxHasBeenClicked);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCheckBox->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Boolean");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCheckBox,
|
||||
m_pclCheckBox,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_BUTTON_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetMustBeEnabledCallBack(s_m_fn_bCheckBoxMustBeEnabled);
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_BooleanControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update Control in case of values changes.
|
||||
void CTL_Editor_BooleanControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
if ( m_pclCheckBox )
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
// m_pclCheckBox->SetCheck(((CTL_Editor_BooleanData *)m_pclData)->m_bCurrentState);
|
||||
m_pclCheckBox->SetCheck(((CTL_Editor_BooleanData *)m_pclData)->mfn_bGetCurrentState ());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_BooleanControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_BooleanControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( m_pclCheckBox )
|
||||
m_pclCheckBox->EnableWindow(FALSE);
|
||||
|
||||
m_bIsReadOnly = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_BooleanControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_pclCheckBox )
|
||||
m_pclCheckBox->EnableWindow(TRUE);
|
||||
|
||||
m_bIsReadOnly = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_BooleanControl::s_m_fn_bCheckBoxMustBeEnabled(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_BooleanControl::s_m_fn_vCheckBoxHasBeenClicked(class CTL_Editor_CheckBox *_pclSenderCheckBox,
|
||||
class CTL_Editor_Control *_pclParentControl,
|
||||
enum CTL_eCarCheckBoxType _tdeType,
|
||||
long _lUserDefinedType,
|
||||
long _lUserDefinedCode)
|
||||
{
|
||||
ERROR_ASSERT(_pclParentControl != NULL);
|
||||
ERROR_ASSERT(_pclParentControl->m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__BOOLEAN);
|
||||
|
||||
//Updates motor's data
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
// ((CTL_Editor_BooleanData *)_pclParentControl->m_fn_pclGetEditedData())->m_bCurrentState = _pclSenderCheckBox->GetCheck();
|
||||
((CTL_Editor_BooleanData *)_pclParentControl->m_fn_pclGetEditedData())->mfn_bSetCurrentState (_pclSenderCheckBox->GetCheck());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
_pclParentControl->m_fn_pclGetEditedData()->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0);
|
||||
}
|
381
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlE.cpp
Normal file
381
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlE.cpp
Normal file
@@ -0,0 +1,381 @@
|
||||
// Implementation file for the definition of an enum characteristic
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlE.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatE.hpp"
|
||||
#include "WControls\CTL_WCBx.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "Others\CTL_EnLi.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//**************************************************************************
|
||||
//Constructor / Destructor
|
||||
CTL_Editor_EnumControl::CTL_Editor_EnumControl(BOOL bReadOnly,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__ENUM,
|
||||
bReadOnly,
|
||||
CTL_SPACING_TYPE__SINGLE_LINE,
|
||||
FALSE,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_pclEnumDescriptor = NULL;
|
||||
|
||||
m_pclComboBox = NULL;
|
||||
m_pclStatic = NULL;
|
||||
|
||||
m_pri_bMustSortNamesInComboBox = FALSE;
|
||||
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack = NULL;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
CTL_Editor_EnumControl::~CTL_Editor_EnumControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Member functions
|
||||
|
||||
//**************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_EnumControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_ENUM_NAME_PERCENT_WIDTH,
|
||||
40,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates the static control (Read only)
|
||||
m_pclStatic = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0, NULL, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclStatic->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Enum");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclStatic,
|
||||
m_pclStatic,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_ENUM_BOX_PERCENT_WIDTH,
|
||||
C_ENUM_BOX_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly());
|
||||
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticCanBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates the combo box
|
||||
m_pclComboBox = new CTL_Editor_ComboBox(CTL_COMBO_BOX_TYPE__STANDARD,
|
||||
WS_TABSTOP | (m_pri_bMustSortNamesInComboBox ? CBS_SORT : 0),
|
||||
this,
|
||||
m_pclParentWnd);
|
||||
|
||||
m_pclComboBox->m_pub_fn_vSetSelChanged_CallBack(s_m_fn_vComboBoxSelChanged);
|
||||
m_pclComboBox->m_pub_fn_vSetDropDown_CallBack(s_m_fn_vComboBoxDroppedDown);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclComboBox->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Enum");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclComboBox,
|
||||
m_pclComboBox,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_ENUM_BOX_PERCENT_WIDTH,
|
||||
C_ENUM_BOX_MIN_WIDTH,
|
||||
C_ENUM_COMBO_BOX_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bComboBoxCanBeDisplayed);
|
||||
}
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
//Function called to display the associated control of the char.
|
||||
void CTL_Editor_EnumControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_EnumControl::m_fn_vUpdateCurrentValue()
|
||||
{
|
||||
//Gets the new current value
|
||||
if ( m_pclComboBox != NULL )
|
||||
{
|
||||
short wIndex = m_pclComboBox->GetCurSel();
|
||||
if ( wIndex != CB_ERR )
|
||||
{
|
||||
CTL_Editor_EnumElement *pclNewSelectedElement = (CTL_Editor_EnumElement *)(m_pclComboBox->GetItemDataPtr(wIndex));
|
||||
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
if ( ((CTL_Editor_EnumData *)m_pclData)->mfn_pGetCurrentValue () != pclNewSelectedElement )
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_EnumData *)m_pclData)->mfn_pSetCurrentValue (pclNewSelectedElement);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_fn_vUpdateParent(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_EnumControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//Read/Write
|
||||
//Updates the combo box
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
CTL_Editor_EnumElement *pclSearchedElement = ((CTL_Editor_EnumData *)m_pclData)->mfn_pGetCurrentValue ();
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
CTL_Editor_EnumElement *pclCurrentComboValue;
|
||||
BOOL bFound = FALSE;
|
||||
if ( m_pclComboBox )
|
||||
{
|
||||
short wIndex = m_pclComboBox->GetCurSel();
|
||||
for ( wIndex = 0; (wIndex < m_pclComboBox->GetCount()) && (!bFound); wIndex ++ )
|
||||
{
|
||||
pclCurrentComboValue = (CTL_Editor_EnumElement *)(m_pclComboBox->GetItemDataPtr(wIndex));
|
||||
bFound = ( pclSearchedElement == pclCurrentComboValue );
|
||||
}
|
||||
|
||||
if ( bFound )
|
||||
m_pclComboBox->SetCurSel(--wIndex);
|
||||
}
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Read Only
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
if ( (m_pclStatic != NULL) && (((CTL_Editor_EnumData *)m_pclData)->mfn_pGetCurrentValue () != NULL) )
|
||||
m_pclStatic->m_fn_vSetTextToDisplay(((CTL_Editor_EnumData *)m_pclData)->mfn_pGetCurrentValue ()->m_pub_fn_csGetElementName());
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_EnumControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//Updates motor's data
|
||||
m_pclData->m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates parent if necessary(Watch a.s.o.)
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_EnumControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = TRUE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_EnumControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = FALSE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_EnumControl::m_fn_vGetNewEnumDescriptor()
|
||||
{
|
||||
//Gets the EnumDescriptor of the Data
|
||||
m_pclEnumDescriptor = ((CTL_Editor_EnumData *)m_fn_pclGetEditedData())->m_fn_pclGetEnumDescriptor();
|
||||
|
||||
ERROR_ASSERT( m_pclEnumDescriptor != NULL );
|
||||
|
||||
//Fills the combo box
|
||||
if ( m_pclComboBox != NULL )
|
||||
{
|
||||
m_pclComboBox->ResetContent();
|
||||
|
||||
CTL_Editor_EnumElement *pclElement;
|
||||
POSITION pos = m_pclEnumDescriptor->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclElement = m_pclEnumDescriptor->GetNext(pos);
|
||||
short wIndex = m_pclComboBox->AddString(pclElement->m_pub_fn_csGetElementName());
|
||||
m_pclComboBox->SetItemDataPtr(wIndex, (void *)(pclElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_EnumControl::m_pub_fn_vBuildEnumDescriptor()
|
||||
{
|
||||
if( ( m_pclData != NULL )
|
||||
&& ( m_pclComboBox != NULL )
|
||||
)
|
||||
{
|
||||
CTL_Editor_EnumDescriptor *pclEnumDescriptor = ((CTL_Editor_EnumData *)m_pclData)->m_fn_pclGetEnumDescriptor();
|
||||
ERROR_ASSERT( pclEnumDescriptor != NULL );
|
||||
|
||||
//Remembers old value
|
||||
CString csOldValue;
|
||||
int iCurSel = m_pclComboBox->GetCurSel();
|
||||
if ( iCurSel != CB_ERR )
|
||||
m_pclComboBox->GetLBText(iCurSel, csOldValue);
|
||||
|
||||
//Constructs the new list, by CallBack if it exists
|
||||
if ( m_td_pri_fn_vBuildEnumDesciptor_CallBack != NULL )
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack(this, pclEnumDescriptor);
|
||||
|
||||
//Clears the ComboBox
|
||||
m_pclComboBox->ResetContent();
|
||||
|
||||
//Updates ComboBox's content
|
||||
BOOL bOldSelectionFound = FALSE;
|
||||
short wIndex;
|
||||
CTL_Editor_EnumElement *pclCurrentElement;
|
||||
POSITION pos = m_pclEnumDescriptor->GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
{
|
||||
pclCurrentElement = m_pclEnumDescriptor->GetNext(pos);
|
||||
|
||||
wIndex = m_pclComboBox->AddString(pclCurrentElement->m_pub_fn_csGetElementName());
|
||||
m_pclComboBox->SetItemDataPtr(wIndex, (void *)(pclCurrentElement));
|
||||
|
||||
if( pclCurrentElement->m_pub_fn_csGetElementName().CompareNoCase(csOldValue) == 0 )
|
||||
{
|
||||
m_pclComboBox->SetCurSel(wIndex);
|
||||
bOldSelectionFound = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//If selection has changed, selects the first entry
|
||||
if ( !bOldSelectionFound )
|
||||
m_pclComboBox->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_EnumControl::m_pub_fn_vSetBuildEnumDesciptor_CallBack(CTL_td_p_fn_vBuildEnumDescriptor _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_td_pri_fn_vBuildEnumDesciptor_CallBack == NULL );
|
||||
|
||||
m_td_pri_fn_vBuildEnumDesciptor_CallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_EnumControl::m_pub_fn_vMustSortNamesInComboBox(BOOL _bSortOrder /*= TRUE*/)
|
||||
{
|
||||
m_pri_bMustSortNamesInComboBox = _bSortOrder;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_EnumControl::s_m_fn_bStaticCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return _pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_EnumControl::s_m_fn_bComboBoxCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//When selection has been changed in a Combo box
|
||||
void CTL_Editor_EnumControl::s_m_fn_vComboBoxSelChanged(class CTL_Editor_ComboBox *_pclSenderComboBox,
|
||||
class CTL_Editor_Control *_pclParentControl,
|
||||
enum CTL_eComboBoxType _tdeType,
|
||||
long _lUserDefinedType,
|
||||
long _lUserDefinedCode)
|
||||
{
|
||||
((CTL_Editor_EnumControl *)_pclParentControl)->m_fn_vUpdateCurrentValue();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//When selection has been changed in a Combo box
|
||||
void CTL_Editor_EnumControl::s_m_fn_vComboBoxDroppedDown(class CTL_Editor_ComboBox *_pclSenderComboBox,
|
||||
class CTL_Editor_Control *_pclParentControl,
|
||||
enum CTL_eComboBoxType _tdeType,
|
||||
long _lUserDefinedType,
|
||||
long _lUserDefinedCode)
|
||||
{
|
||||
((CTL_Editor_EnumControl *)_pclParentControl)->m_pub_fn_vBuildEnumDescriptor();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_EnumControl::m_fn_vSetEditedData(CTL_Editor_Data *pclData)
|
||||
{
|
||||
m_pclData = pclData;
|
||||
m_pclData->m_pub_fn_vSetParentControl(this);
|
||||
|
||||
if ( m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__ENUM )
|
||||
((CTL_Editor_EnumControl *)this)->m_fn_vGetNewEnumDescriptor();
|
||||
}
|
||||
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Method : m_fn_iSetCanISelect_CallBack
|
||||
// Date : 98-03
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Description :
|
||||
// Author : Stegaru Cristian - CPA2
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Modification :
|
||||
// Date :
|
||||
// By :
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int CTL_Editor_EnumControl::m_fn_iSetCanISelect_CallBack (CTL_tpf_iCheckString pfCheckString)
|
||||
{
|
||||
if (NULL == m_pclComboBox)
|
||||
return 0;
|
||||
|
||||
m_pclComboBox->m_fn_vSetCanISelect_CallBack (pfCheckString);
|
||||
return 1;
|
||||
}
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
312
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlF.cpp
Normal file
312
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlF.cpp
Normal file
@@ -0,0 +1,312 @@
|
||||
// Implementation file for the definition of a decimal control
|
||||
//////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlF.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatF.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "WControls\CTL_WSpn.hpp"
|
||||
#include "WControls\CTL_WEdt.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
//************************************************************************************
|
||||
CTL_Editor_DecimalControl::CTL_Editor_DecimalControl(long double ldMin,
|
||||
long double ldMax,
|
||||
char cDataLength,
|
||||
BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__DECIMAL,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
//Computes min and max
|
||||
/* unsigned long lTypeMax;
|
||||
switch ( cDataLength )
|
||||
{
|
||||
case 1:
|
||||
lTypeMax = 255;
|
||||
break;
|
||||
case 2:
|
||||
lTypeMax = 65535;
|
||||
break;
|
||||
case 4:
|
||||
lTypeMax = 4294967295;
|
||||
break;
|
||||
}
|
||||
|
||||
long lTypeMin = bSigned ? (-lTypeMax/2)-1 : 0;
|
||||
lTypeMax = bSigned ? lTypeMax/2 : lTypeMax;
|
||||
|
||||
m_lMaxValue = min(lMax, lTypeMax);
|
||||
m_lMinValue = max(lMin, lTypeMin);*/
|
||||
m_ldMaxValue = ldMax;
|
||||
m_ldMinValue = ldMin;
|
||||
|
||||
m_pclCurrentEdit = NULL;
|
||||
m_pclCurrentStatic = NULL;
|
||||
m_pclNameStatic = NULL;
|
||||
m_pclSpin = NULL;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_DecimalControl::~CTL_Editor_DecimalControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Member functions
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_DecimalControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
CRect crBidonRect(0,0,10,10);
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_INT_NAME_BOX_PERCENT_WIDTH,
|
||||
40,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates an static box for the current value of the charac. (Read Only mode)
|
||||
m_pclCurrentStatic = new CTL_Editor_Static("",
|
||||
CTL_STATIC_TYPE__FIELD_VALUE,
|
||||
0,
|
||||
NULL,
|
||||
pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStatic->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Decimal");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStatic,
|
||||
m_pclCurrentStatic,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_INT_CURRENT_VALUE_PERCENT_WIDTH,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly());
|
||||
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticMustBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates an edit box for the current value of the charac.
|
||||
m_pclCurrentEdit = new CTL_Editor_Edit(m_ldMinValue, m_ldMaxValue, WS_TABSTOP, this, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentEdit->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Decimal");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentEdit,
|
||||
m_pclCurrentEdit,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_INT_CURRENT_VALUE_PERCENT_WIDTH,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bEditMustBeDisplayed);
|
||||
|
||||
//Creates a spin button for the current value of the charac.
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
m_pclSpin = new CTL_Editor_SpinButton(this, m_ldMinValue, m_ldMaxValue, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclSpin->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Decimal");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(NULL,
|
||||
m_pclSpin,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_SPIN_WIDTH,
|
||||
C_SPIN_HEIGHT);
|
||||
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bSpinMustBeDisplayed);
|
||||
#endif
|
||||
//ENDANNECY
|
||||
}
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_DecimalControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_DecimalControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
m_fn_vUpdateSpin(((CTL_Editor_DecimalData *)m_pclData)->mfn_ldGetCurrentValue ());
|
||||
m_fn_vUpdateEdit(((CTL_Editor_DecimalData *)m_pclData)->mfn_ldGetCurrentValue ());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
if ( m_pclCurrentStatic != NULL )
|
||||
{
|
||||
CString csText;
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
csText.Format("%g", ((CTL_Editor_DecimalData *)m_pclData)->mfn_ldGetCurrentValue ());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
m_pclCurrentStatic->m_fn_vSetTextToDisplay(csText);
|
||||
}
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_DecimalControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the slider when the edit changes
|
||||
void CTL_Editor_DecimalControl::m_fn_vUpdateSpin(long double ldNewValue,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
((CTL_Editor_DecimalData *)m_pclData)->mfn_ldSetCurrentValue (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
// if ( m_td_p_fn_vDataHasChangedCallBack != NULL )
|
||||
// m_td_p_fn_vDataHasChangedCallBack(m_pclData);
|
||||
|
||||
//Updates the spin if it exists
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
if ( m_pclSpin )
|
||||
m_pclSpin->m_fn_vSetCurrentPos(ldNewValue);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the edit when the slider changes
|
||||
void CTL_Editor_DecimalControl::m_fn_vUpdateEdit(long double ldNewValue,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
((CTL_Editor_DecimalData *)m_pclData)->mfn_ldSetCurrentValue (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
// if ( m_td_p_fn_vDataHasChangedCallBack != NULL )
|
||||
// m_td_p_fn_vDataHasChangedCallBack(m_pclData);
|
||||
|
||||
CString csNewString;
|
||||
csNewString.Format("%g", ldNewValue);
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( m_pclCurrentStatic )
|
||||
m_pclCurrentStatic->m_fn_vSetTextToDisplay(csNewString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_pclCurrentEdit )
|
||||
{
|
||||
m_pclCurrentEdit->SetWindowText(csNewString);
|
||||
m_pclCurrentEdit->m_fn_vSetCurrentValue(ldNewValue);
|
||||
}
|
||||
}
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_DecimalControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = TRUE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_DecimalControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = FALSE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_DecimalControl::s_m_fn_bStaticMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_DecimalControl::s_m_fn_bEditMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_DecimalControl::s_m_fn_bSpinMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
346
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlI.cpp
Normal file
346
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlI.cpp
Normal file
@@ -0,0 +1,346 @@
|
||||
__asm{int 3h}// Implementation file for the definition of an integer control
|
||||
//////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "Controls\CTL_CtlI.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatI.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "WControls\CTL_WSpn.hpp"
|
||||
#include "WControls\CTL_WEdt.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
//************************************************************************************
|
||||
CTL_Editor_IntegerControl::CTL_Editor_IntegerControl( /*unsigned */long lMin,
|
||||
/*unsigned */long lMax,
|
||||
char cDataLength,
|
||||
BOOL bSigned,
|
||||
BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control( CTL_DATA_TYPE__INTEGER,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
//Computes min and max
|
||||
//Special treatment for an unsigned longs
|
||||
/* if ( (cDataLength == 4) && (!bSigned) )
|
||||
{
|
||||
m_bIsAnUnsignedLong = TRUE;
|
||||
m_lMinValue = 0;
|
||||
m_lMaxValue = 0;
|
||||
|
||||
m_ulMaxValue = min((long)ulMax, 0);
|
||||
m_ulMinValue = max((long)ulMin, ULONG_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsAnUnsignedLong = FALSE;
|
||||
m_ulMinValue = 0;
|
||||
m_ulMaxValue = 0;
|
||||
|
||||
long ulTypeMax;
|
||||
long ulTypeMin;
|
||||
switch ( cDataLength )
|
||||
{
|
||||
case 1:
|
||||
if ( bSigned )
|
||||
{
|
||||
ulTypeMax = SCHAR_MAX;
|
||||
ulTypeMin = SCHAR_MIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulTypeMax = UCHAR_MAX;
|
||||
ulTypeMin = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ( bSigned )
|
||||
{
|
||||
ulTypeMax = SHRT_MAX;
|
||||
ulTypeMin = SHRT_MIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulTypeMax = USHRT_MAX;
|
||||
ulTypeMin = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ulTypeMax = LONG_MIN;
|
||||
ulTypeMin = LONG_MAX;
|
||||
break;
|
||||
}
|
||||
|
||||
m_lMaxValue = min(ulMax, ulTypeMax);
|
||||
m_lMinValue = max(ulMin, ulTypeMin);
|
||||
}*/
|
||||
m_lMaxValue = lMax;
|
||||
m_lMinValue = lMin;
|
||||
m_ulMaxValue = lMax;
|
||||
m_ulMinValue = lMin;
|
||||
|
||||
m_pclCurrentEdit = NULL;
|
||||
m_pclCurrentStatic = NULL;
|
||||
m_pclNameStatic = NULL;
|
||||
m_pclSpin = NULL;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_IntegerControl::~CTL_Editor_IntegerControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Member functions
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_IntegerControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_INT_NAME_BOX_PERCENT_WIDTH,
|
||||
40,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates a static box for the current value of the charac. (Read Only mode)
|
||||
m_pclCurrentStatic = new CTL_Editor_Static( "",
|
||||
CTL_STATIC_TYPE__FIELD_VALUE,
|
||||
0,
|
||||
NULL,
|
||||
pclParentWnd
|
||||
);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStatic->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Integer");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStatic,
|
||||
m_pclCurrentStatic,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_INT_CURRENT_VALUE_PERCENT_WIDTH,
|
||||
C_INT_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly());
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticMustBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates an edit box for the current value of the charac. (Read-Write mode)
|
||||
m_pclCurrentEdit = new CTL_Editor_Edit(m_lMinValue, m_lMaxValue, WS_TABSTOP, this, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentEdit->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Integer");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentEdit,
|
||||
m_pclCurrentEdit,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_INT_CURRENT_VALUE_PERCENT_WIDTH,
|
||||
C_INT_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bEditMustBeDisplayed);
|
||||
|
||||
//Creates a spin button for the current value of the charac.
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
if ( m_bIsAnUnsignedLong )
|
||||
m_pclSpin = new CTL_Editor_SpinButton(this, m_ulMinValue, m_ulMaxValue, pclParentWnd);
|
||||
else
|
||||
m_pclSpin = new CTL_Editor_SpinButton(this, m_lMinValue, m_lMaxValue, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclSpin->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Integer");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(NULL,
|
||||
m_pclSpin,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_SPIN_WIDTH,
|
||||
C_EDIT_HEIGHT + 2);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bSpinMustBeDisplayed);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
}
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_IntegerControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_IntegerControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
m_fn_vUpdateEdit(((CTL_Editor_IntegerData *)m_pclData)->mfn_lGetCurrentValue ());
|
||||
m_fn_vUpdateSpin(((CTL_Editor_IntegerData *)m_pclData)->mfn_lGetCurrentValue ());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
if ( m_pclCurrentStatic != NULL )
|
||||
{
|
||||
CString csText;
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
csText.Format("%i", ((CTL_Editor_IntegerData *)m_pclData)->mfn_lGetCurrentValue ());
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
m_pclCurrentStatic->m_fn_vSetTextToDisplay(csText);
|
||||
}
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_IntegerControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the slider when the edit changes
|
||||
void CTL_Editor_IntegerControl::m_fn_vUpdateSpin(long lNewValue,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
((CTL_Editor_IntegerData *)m_pclData)->mfn_lSetCurrentValue (lNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
//Updates the spin if it exists
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
if ( m_pclSpin != NULL )
|
||||
m_pclSpin->m_fn_vSetCurrentPos(lNewValue);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the edit when the slider changes
|
||||
void CTL_Editor_IntegerControl::m_fn_vUpdateEdit(long lNewValue,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/25
|
||||
((CTL_Editor_IntegerData *)m_pclData)->mfn_lSetCurrentValue (lNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/25
|
||||
|
||||
CString csNewString;
|
||||
csNewString.Format("%ld", lNewValue);
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( m_pclCurrentStatic )
|
||||
m_pclCurrentStatic->m_fn_vSetTextToDisplay(csNewString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_pclCurrentEdit )
|
||||
{
|
||||
m_pclCurrentEdit->SetWindowText(csNewString);
|
||||
m_pclCurrentEdit->m_fn_vSetCurrentValue(lNewValue);
|
||||
}
|
||||
}
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_IntegerControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = TRUE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_IntegerControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = FALSE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_IntegerControl::s_m_fn_bStaticMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_IntegerControl::s_m_fn_bEditMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_IntegerControl::s_m_fn_bSpinMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
190
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlM.cpp
Normal file
190
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlM.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
// Implementation file for the definition of a characteristic type
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlM.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatM.hpp"
|
||||
#include "WControls\CTL_WBut.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
#include "CTL_DgME.hpp"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#undef CPA_EXPORT
|
||||
#define ACTIVE_EDITOR
|
||||
#define CPA_EXPORT __declspec(dllimport)
|
||||
#include "ITF\FRMGest.hpp"
|
||||
CPA_EXPORT BaseFrame g_oBaseFrame;
|
||||
#undef CPA_EXPORT
|
||||
|
||||
//Constructor / Destructor
|
||||
//**************************************************************************************
|
||||
CTL_Editor_MaskedControl::CTL_Editor_MaskedControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__MASKED,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_pclEditButton = NULL;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_MaskedControl::~CTL_Editor_MaskedControl()
|
||||
{
|
||||
/*
|
||||
if ( m_pclEditButton != NULL )
|
||||
delete m_pclEditButton;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//Member functions
|
||||
|
||||
//**************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_MaskedControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_BOOL_NAME_BOX_PERCENT_WIDTH,
|
||||
C_BOOL_NAME_BOX_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates check box
|
||||
m_pclEditButton = new CTL_Editor_Button("Edit",
|
||||
CTL_BUTTON_TYPE__EDIT,
|
||||
WS_TABSTOP,
|
||||
this,
|
||||
m_pclParentWnd
|
||||
);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclEditButton->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - MaskedData");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
m_pclEditButton->EnableWindow(!m_fn_bIsAlwaysReadOnly());
|
||||
|
||||
m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclEditButton,
|
||||
m_pclEditButton,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_BUTTON_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_MaskedControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update Control in case of values changes.
|
||||
void CTL_Editor_MaskedControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_MaskedControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_MaskedControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( m_pclEditButton != NULL )
|
||||
m_pclEditButton->EnableWindow(FALSE);
|
||||
|
||||
m_bIsReadOnly = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_MaskedControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_pclEditButton != NULL )
|
||||
m_pclEditButton->EnableWindow(TRUE);
|
||||
|
||||
m_bIsReadOnly = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
void CTL_Editor_MaskedControl::m_fn_vSetCurrentValue(unsigned long _ulNewValue)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_MaskedData *)m_pclData)->mfn_ulSetCurrentValue (_ulNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
// if ( m_td_p_fn_vDataHasChangedCallBack != NULL )
|
||||
// m_td_p_fn_vDataHasChangedCallBack(m_pclData);
|
||||
|
||||
//Updates motor's data
|
||||
m_pclData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
|
||||
//Updates parent's controls if necessary (Watch Window, ...)
|
||||
m_fn_vUpdateParent();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Specific to this control, overloaded from CTL_Editor_Buttonable
|
||||
void CTL_Editor_MaskedControl::m_fn_vSetValue(short wAction)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Called when button is pressed
|
||||
void CTL_Editor_MaskedControl::m_fn_vEditData()
|
||||
{
|
||||
//Displays the Dialog to Edit the Masked data
|
||||
// CTL_DialogMaskedDataEdition EditionDial(this, AfxGetMainWnd());
|
||||
CTL_DialogMaskedDataEdition EditionDial(this, &g_oBaseFrame);
|
||||
EditionDial.DoModal();
|
||||
}
|
144
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlT.cpp
Normal file
144
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlT.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
// Implementation file for the definition of a Text control
|
||||
//////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlT.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatT.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
//************************************************************************************
|
||||
CTL_Editor_TextControl::CTL_Editor_TextControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__TEXT,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_pclCurrentStatic = NULL;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_TextControl::~CTL_Editor_TextControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Member functions
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_TextControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls( C_TEXT_NAME_BOX_PERCENT_WIDTH,
|
||||
40,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates a static box for the current value of the Text (Read Only mode)
|
||||
m_pclCurrentStatic = new CTL_Editor_Static( "",
|
||||
CTL_STATIC_TYPE__FIELD_VALUE,
|
||||
0,
|
||||
NULL,
|
||||
pclParentWnd
|
||||
);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStatic->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Text");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStatic,
|
||||
m_pclCurrentStatic,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
C_TEXT_CURRENT_VALUE_PERCENT_WIDTH,
|
||||
C_TEXT_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
/*TRUE*/FALSE);
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_TextControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update controls in case of values changes.
|
||||
void CTL_Editor_TextControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
m_pclCurrentStatic->m_fn_vSetTextToDisplay(((CTL_Editor_TextData *)m_pclData)->mfn_csGetCurrentString ());
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_TextControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_TextControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = TRUE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_TextControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = FALSE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
}
|
508
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlV.cpp
Normal file
508
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_CtlV.cpp
Normal file
@@ -0,0 +1,508 @@
|
||||
// Implementation file for the definition of a decimal control
|
||||
//////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_CtlV.hpp"
|
||||
|
||||
#include "Controls\CTL_BCtl.hpp"
|
||||
#include "Data\CTL_DatV.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "WControls\CTL_WSpn.hpp"
|
||||
#include "WControls\CTL_WEdt.hpp"
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
#include "WControls\CTL_WCkB.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Constructor / Destructor
|
||||
//************************************************************************************
|
||||
CTL_Editor_VectorControl::CTL_Editor_VectorControl(long double ldMin,
|
||||
long double ldMax,
|
||||
char cDataLength,
|
||||
BOOL bReadOnly,
|
||||
CTL_Editor_ControlList *_pclParentList,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
: CTL_Editor_Control(CTL_DATA_TYPE__VECTOR,
|
||||
bReadOnly,
|
||||
CTL_SPACING_TYPE__MULTI_LINE,
|
||||
FALSE,
|
||||
_pclParentList,
|
||||
_csControlName,
|
||||
_bAcceptNameFromData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
m_ldMaxValue = ldMax;
|
||||
m_ldMinValue = ldMin;
|
||||
|
||||
m_pclCurrentEditX = NULL;
|
||||
m_pclCurrentEditY = NULL;
|
||||
m_pclCurrentEditZ = NULL;
|
||||
m_pclCurrentStaticX = NULL;
|
||||
m_pclCurrentStaticY = NULL;
|
||||
m_pclCurrentStaticZ = NULL;
|
||||
m_pclSpinX = NULL;
|
||||
m_pclSpinY = NULL;
|
||||
m_pclSpinZ = NULL;
|
||||
m_pclNameStatic = NULL;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_VectorControl::~CTL_Editor_VectorControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Member functions
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to create associated control
|
||||
BOOL CTL_Editor_VectorControl::m_fn_bCreateControl(CWnd *pclParentWnd)
|
||||
{
|
||||
BOOL bReturnValue = TRUE;
|
||||
CRect crBidonRect(0,0,10,10);
|
||||
|
||||
m_pclParentWnd = pclParentWnd;
|
||||
|
||||
m_pro_fn_bCreateBaseControls(100,
|
||||
40,
|
||||
C_EDIT_HEIGHT);
|
||||
|
||||
//Creates static boxes for the current value of the charac. (Read Only mode)
|
||||
m_pclCurrentStaticX = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0, NULL, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStaticX->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : X");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
CTL_Editor_BaseControl *pclBC;
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStaticX,
|
||||
m_pclCurrentStaticX,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
33,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly(),
|
||||
TRUE);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticMustBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates Edit boxes for the current value of the charac.
|
||||
m_pclCurrentEditX = new CTL_Editor_Edit(m_ldMinValue, m_ldMaxValue, WS_TABSTOP, this, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentEditX->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : X");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentEditX,
|
||||
m_pclCurrentEditX,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
28,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
FALSE,
|
||||
TRUE); //Forces to go to the next line
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bEditMustBeDisplayed);
|
||||
|
||||
//Creates a spin button for the current value of the charac.
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
m_pclSpinX = new CTL_Editor_SpinButton(this, m_ldMinValue, m_ldMaxValue, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclSpinX->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : X");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(NULL,
|
||||
m_pclSpinX,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_SPIN_WIDTH,
|
||||
C_SPIN_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bSpinMustBeDisplayed);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
}
|
||||
|
||||
m_pclCurrentStaticY = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0, NULL, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStaticY->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Y");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStaticY,
|
||||
m_pclCurrentStaticY,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
33,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly());
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticMustBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates Edit boxes for the current value of the charac.
|
||||
m_pclCurrentEditY = new CTL_Editor_Edit(m_ldMinValue, m_ldMaxValue, WS_TABSTOP, this, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentEditY->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Y");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentEditY,
|
||||
m_pclCurrentEditY,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
28,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bEditMustBeDisplayed);
|
||||
|
||||
//Creates a spin button for the current value of the charac.
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
m_pclSpinY = new CTL_Editor_SpinButton(this, m_ldMinValue, m_ldMaxValue, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclSpinY->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Y");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(NULL,
|
||||
m_pclSpinY,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_SPIN_WIDTH,
|
||||
C_SPIN_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bSpinMustBeDisplayed);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
}
|
||||
|
||||
m_pclCurrentStaticZ = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0 , NULL, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentStaticZ->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Z");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentStaticZ,
|
||||
m_pclCurrentStaticZ,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
33,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT,
|
||||
!m_fn_bIsAlwaysReadOnly());
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticMustBeDisplayed);
|
||||
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
//Creates Edit boxes for the current value of the charac.
|
||||
m_pclCurrentEditZ = new CTL_Editor_Edit(m_ldMinValue, m_ldMaxValue, WS_TABSTOP, this, m_pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclCurrentEditZ->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Z");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCurrentEditZ,
|
||||
m_pclCurrentEditZ,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
|
||||
28,
|
||||
C_DECIMAL_CURRENT_VALUE_MIN_WIDTH,
|
||||
C_EDIT_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bEditMustBeDisplayed);
|
||||
|
||||
//Creates a spin button for the current value of the charac.
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
m_pclSpinZ = new CTL_Editor_SpinButton(this, m_ldMinValue, m_ldMaxValue, pclParentWnd);
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pclSpinZ->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Vector : Z");
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(NULL,
|
||||
m_pclSpinZ,
|
||||
this,
|
||||
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
|
||||
0,
|
||||
C_SPIN_WIDTH,
|
||||
C_SPIN_HEIGHT);
|
||||
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bSpinMustBeDisplayed);
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
}
|
||||
|
||||
m_bControlCreated = bReturnValue;
|
||||
|
||||
return bReturnValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to display the associated control(s) of the char.
|
||||
void CTL_Editor_VectorControl::m_fn_vDisplay()
|
||||
{
|
||||
m_pro_fn_vDisplayBaseControls();
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
m_fn_vUpdateSpin(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueX (), eModifType_X);
|
||||
m_fn_vUpdateSpin(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueY (), eModifType_Y);
|
||||
m_fn_vUpdateSpin(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueZ (), eModifType_Z);
|
||||
m_fn_vUpdateEdit(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueX (), eModifType_X);
|
||||
m_fn_vUpdateEdit(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueY (), eModifType_Y);
|
||||
m_fn_vUpdateEdit(((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueZ (), eModifType_Z);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
if ( m_pclCurrentStaticX != NULL )
|
||||
{
|
||||
CString csText;
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
csText.Format("%g", ((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueX ());
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
m_pclCurrentStaticX->m_fn_vSetTextToDisplay(csText);
|
||||
}
|
||||
if ( m_pclCurrentStaticY != NULL )
|
||||
{
|
||||
CString csText;
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
csText.Format("%g", ((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueY ());
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
m_pclCurrentStaticY->m_fn_vSetTextToDisplay(csText);
|
||||
}
|
||||
if ( m_pclCurrentStaticZ != NULL )
|
||||
{
|
||||
CString csText;
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
csText.Format("%g", ((CTL_Editor_VectorData *)m_pclData)->mfn_ldGetCurrentValueZ ());
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
m_pclCurrentStaticZ->m_fn_vSetTextToDisplay(csText);
|
||||
}
|
||||
|
||||
//CallBack
|
||||
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to update parent window in case of values changes.
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the slider when the edit changes
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdateSpin(long double ldNewValue,
|
||||
CTL_Editor_Edit *_pclEditSender,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
if ( _pclEditSender == m_pclCurrentEditX )
|
||||
m_fn_vUpdateSpin(ldNewValue, eModifType_X, _eReason, _lUserDefinedReason);
|
||||
else if ( _pclEditSender == m_pclCurrentEditY )
|
||||
m_fn_vUpdateSpin(ldNewValue, eModifType_Y, _eReason, _lUserDefinedReason);
|
||||
else if ( _pclEditSender == m_pclCurrentEditZ )
|
||||
m_fn_vUpdateSpin(ldNewValue, eModifType_Z, _eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the slider when the edit changes
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdateSpin(long double ldNewValue,
|
||||
m_eModifType _eModifType,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
if ( _eModifType == eModifType_X )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueX (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
else if ( _eModifType == eModifType_Y )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueY (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
else if ( _eModifType == eModifType_Z )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueZ (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
//Updates the spin if it exists
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( _eModifType == eModifType_X )
|
||||
{
|
||||
if ( m_pclSpinX != NULL )
|
||||
m_pclSpinX->m_fn_vSetCurrentPos(ldNewValue);
|
||||
}
|
||||
else if ( _eModifType == eModifType_Y )
|
||||
{
|
||||
if ( m_pclSpinY != NULL )
|
||||
m_pclSpinY->m_fn_vSetCurrentPos(ldNewValue);
|
||||
}
|
||||
else if ( _eModifType == eModifType_Z )
|
||||
{
|
||||
if ( m_pclSpinZ != NULL )
|
||||
m_pclSpinZ->m_fn_vSetCurrentPos(ldNewValue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//ENDANNECY CB
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the edit when the slider changes
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdateEdit(long double ldNewValue,
|
||||
CTL_Editor_SpinButton *_pclSpinSender,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
if ( _pclSpinSender == m_pclSpinX )
|
||||
m_fn_vUpdateEdit(ldNewValue, eModifType_X, _eReason, _lUserDefinedReason);
|
||||
else if ( _pclSpinSender == m_pclSpinY )
|
||||
m_fn_vUpdateEdit(ldNewValue, eModifType_Y, _eReason, _lUserDefinedReason);
|
||||
else if ( _pclSpinSender == m_pclSpinZ )
|
||||
m_fn_vUpdateEdit(ldNewValue, eModifType_Z, _eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//Function called to update the edit when the slider changes
|
||||
void CTL_Editor_VectorControl::m_fn_vUpdateEdit(long double ldNewValue,
|
||||
m_eModifType _eModifType,
|
||||
CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
|
||||
long _lUserDefinedReason /*= 0*/)
|
||||
{
|
||||
if ( _eModifType == eModifType_X )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueX (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
else if ( _eModifType == eModifType_Y )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueY (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
else if ( _eModifType == eModifType_Z )
|
||||
//CPA2 Stegaru Cristian 98/06/26
|
||||
((CTL_Editor_VectorData *)m_pclData)->mfn_ldSetCurrentValueZ (ldNewValue);
|
||||
//End CPA2 Stegaru Cristian 98/06/26
|
||||
|
||||
CString csNewString;
|
||||
csNewString.Format("%g", ldNewValue);
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
if ( _eModifType == eModifType_X )
|
||||
{
|
||||
if ( m_pclCurrentStaticX != NULL )
|
||||
m_pclCurrentStaticX->m_fn_vSetTextToDisplay(csNewString);
|
||||
}
|
||||
else if ( _eModifType == eModifType_Y )
|
||||
{
|
||||
if ( m_pclCurrentStaticY != NULL )
|
||||
m_pclCurrentStaticY->m_fn_vSetTextToDisplay(csNewString);
|
||||
}
|
||||
else if ( _eModifType == eModifType_Z )
|
||||
{
|
||||
if ( m_pclCurrentStaticZ != NULL )
|
||||
m_pclCurrentStaticZ->m_fn_vSetTextToDisplay(csNewString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _eModifType == eModifType_X )
|
||||
{
|
||||
if ( m_pclCurrentEditX != NULL )
|
||||
{
|
||||
m_pclCurrentEditX->SetWindowText(csNewString);
|
||||
m_pclCurrentEditX->m_fn_vSetCurrentValue(ldNewValue);
|
||||
}
|
||||
}
|
||||
else if ( _eModifType == eModifType_Y )
|
||||
{
|
||||
if ( m_pclCurrentEditY != NULL )
|
||||
{
|
||||
m_pclCurrentEditY->SetWindowText(csNewString);
|
||||
m_pclCurrentEditY->m_fn_vSetCurrentValue(ldNewValue);
|
||||
}
|
||||
}
|
||||
else if ( _eModifType == eModifType_Z )
|
||||
{
|
||||
if ( m_pclCurrentEditZ != NULL )
|
||||
{
|
||||
m_pclCurrentEditZ->SetWindowText(csNewString);
|
||||
m_pclCurrentEditZ->m_fn_vSetCurrentValue(ldNewValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Updates parent's datas if necessary
|
||||
m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
|
||||
|
||||
//Updates motor's data in case of change
|
||||
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read Only
|
||||
void CTL_Editor_VectorControl::m_fn_vMakeReadOnly()
|
||||
{
|
||||
if ( !m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = TRUE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
//Function called to make control Read-Write
|
||||
void CTL_Editor_VectorControl::m_fn_vMakeReadWrite()
|
||||
{
|
||||
if ( !m_fn_bIsAlwaysReadOnly() )
|
||||
{
|
||||
if ( m_fn_bIsReadOnly() )
|
||||
{
|
||||
m_bIsReadOnly = FALSE;
|
||||
m_fn_vHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_VectorControl::s_m_fn_bStaticMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_VectorControl::s_m_fn_bEditMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
BOOL CTL_Editor_VectorControl::s_m_fn_bSpinMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
|
||||
{
|
||||
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
|
||||
}
|
||||
|
383
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_LCtl.cpp
Normal file
383
Rayman_X/cpa/tempgrp/Ctl/Src/Controls/CTL_LCtl.cpp
Normal file
@@ -0,0 +1,383 @@
|
||||
// Definition of the class for the list of base controls
|
||||
//
|
||||
// YB
|
||||
//////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Controls\CTL_LCtl.hpp"
|
||||
|
||||
#include "Controls\CTL_CtlB.hpp"
|
||||
#include "Controls\CTL_CtlE.hpp"
|
||||
#include "Controls\CTL_CtlF.hpp"
|
||||
#include "Controls\CTL_CtlI.hpp"
|
||||
#include "Controls\CTL_CtlM.hpp"
|
||||
#include "Controls\CTL_CtlT.hpp"
|
||||
#include "Controls\CTL_CtlV.hpp"
|
||||
#include "Data\CTL_LDat.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
//End of External Modules
|
||||
|
||||
//**************************************************************************************
|
||||
//**************************************************************************************
|
||||
//**************************************************************************************
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_ControlList::CTL_Editor_ControlList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_ControlList::~CTL_Editor_ControlList()
|
||||
{
|
||||
m_fn_vEmptyList();
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_ControlList::m_fn_vAddElement(CTL_Editor_Control *pclNewElement)
|
||||
{
|
||||
AddTail(pclNewElement);
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_ControlList::m_fn_vEmptyList()
|
||||
{
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
delete GetNext(pos);
|
||||
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
//Controls Handling
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_ControlList::m_pub_fn_vDisplayControlsInZone(CPoint &r_clTopLeft, CPoint clTopRight)
|
||||
{
|
||||
long lBeginning = r_clTopLeft.y;
|
||||
CRect crSameLineRect(r_clTopLeft, clTopRight);
|
||||
CRect crNextLineRect(r_clTopLeft, clTopRight);
|
||||
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
GetNext(pos)->m_pub_fn_vDisplayInZone(crSameLineRect, crNextLineRect);
|
||||
|
||||
r_clTopLeft.y = crNextLineRect.top;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
void CTL_Editor_ControlList::m_pub_fn_vHideAllControls()
|
||||
{
|
||||
POSITION pos = GetHeadPosition();
|
||||
while ( pos != NULL )
|
||||
GetNext(pos)->m_fn_vHide();
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
//Updates all controls in list, with the given list of Data
|
||||
// 1) Gets motor data for each Data
|
||||
// 2)
|
||||
void CTL_Editor_ControlList::m_pub_fn_vUpdateControlsWithListOfData(class CTL_Editor_DataList *_pclDataList)
|
||||
{
|
||||
//First checks coherence of the two lists
|
||||
long lNumberOfControls = GetCount();
|
||||
long lNumberOfData = _pclDataList->GetCount();
|
||||
|
||||
ERROR_ASSERT( lNumberOfControls == lNumberOfData );
|
||||
|
||||
CTL_Editor_Control *pclCurrentControl;
|
||||
CTL_Editor_Data *pclCurrentData;
|
||||
|
||||
POSITION ControlPos = GetHeadPosition();
|
||||
POSITION DataPos = _pclDataList->GetHeadPosition();
|
||||
|
||||
while ( ControlPos != NULL )
|
||||
{
|
||||
pclCurrentControl = GetNext(ControlPos);
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Setting pointers on motor data in a list of controls",
|
||||
"CTL_Editor_ControlList::m_pub_fn_vUpdateControlsWithListOfData(...)",
|
||||
E_ERROR_GRAVITY_FATAL,
|
||||
"There are more controls in Controls list than in Data list");
|
||||
ERROR_ASSERT( DataPos != NULL );
|
||||
#endif
|
||||
//END
|
||||
pclCurrentData = _pclDataList->GetNext(DataPos);
|
||||
|
||||
//Verifies types are the same...
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Setting pointers on motor data for the newly selected actor",
|
||||
"EdActors_MyDocument::m_fn_vSetPointers(...)",
|
||||
E_ERROR_GRAVITY_FATAL,
|
||||
"The types of control in Controls and Data are not the same");
|
||||
ERROR_ASSERT( pclCurrentData->m_pub_fn_tdeGetDataType() == pclCurrentControl->m_pub_fn_tdeGetDataType() );
|
||||
#endif
|
||||
//END
|
||||
|
||||
pclCurrentData->m_fn_vGetMotorData();
|
||||
pclCurrentControl->m_fn_vSetEditedData(pclCurrentData);
|
||||
pclCurrentControl->m_fn_vUpdate(CTL_UPDATE_REASON__DATA_READ_FROM_MOTOR, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
//Updates the current value of all controls in the List,according to the currently edited Data of each
|
||||
void CTL_Editor_ControlList::m_pub_fn_vUpdateControlsWithEditedData(BOOL _bMustReadMotorData)
|
||||
{
|
||||
//Updates all controls
|
||||
CTL_Editor_Control *pclCurrentControl;
|
||||
POSITION ControlPos = GetHeadPosition();
|
||||
while ( ControlPos != NULL )
|
||||
{
|
||||
pclCurrentControl = GetNext(ControlPos);
|
||||
|
||||
if ( _bMustReadMotorData )
|
||||
{
|
||||
ERROR_ASSERT( pclCurrentControl->m_fn_pclGetEditedData() != NULL );
|
||||
pclCurrentControl->m_fn_pclGetEditedData()->m_fn_vGetMotorData();
|
||||
}
|
||||
|
||||
pclCurrentControl->m_fn_vUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_ControlList::m_pub_fn_pclAddOwnerData(void *_pvDataPtr,
|
||||
CString _csName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_pvDataPtr, _csName);
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_ControlList::m_pub_fn_pclAddOwnerData(long _lData,
|
||||
CString _csName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_lData, _csName);
|
||||
}
|
||||
|
||||
//*********************************************************************************
|
||||
CTL_OwnerData *CTL_Editor_ControlList::m_pub_fn_pclGetOwnerDataWithName(CString _csSearchedName)
|
||||
{
|
||||
return m_pri_clListOfOwnerData.m_pub_fn_pclFindOwnerDataWithName(_csSearchedName);
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
//**************************************************************************************
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddIntegerControl(long lMinValue,
|
||||
long lMaxValue,
|
||||
char cDataLength,
|
||||
BOOL bSigned,
|
||||
BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_IntegerControl *pclNewElement = new CTL_Editor_IntegerControl( lMinValue,
|
||||
lMaxValue,
|
||||
cDataLength,
|
||||
bSigned,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddDecimalControl(long double ldMinValue,
|
||||
long double ldMaxValue,
|
||||
char cDataLength,
|
||||
BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_DecimalControl *pclNewElement = new CTL_Editor_DecimalControl( ldMinValue,
|
||||
ldMaxValue,
|
||||
cDataLength,
|
||||
bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddBooleanControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_BooleanControl *pclNewElement = new CTL_Editor_BooleanControl( bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddMaskedControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_MaskedControl *pclNewElement = new CTL_Editor_MaskedControl( bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddEnumControl(BOOL bReadOnly,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_EnumControl *pclNewElement = new CTL_Editor_EnumControl( bReadOnly,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddTextControl(BOOL bReadOnly,
|
||||
CTL_tdeControlSpacingType tdeSpacingType,
|
||||
BOOL bUserCanChangeAspect,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_TextControl *pclNewElement = new CTL_Editor_TextControl( bReadOnly,
|
||||
tdeSpacingType,
|
||||
bUserCanChangeAspect,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
||||
|
||||
//**************************************************************************************
|
||||
CTL_Editor_Control *CTL_Editor_ControlList::m_fn_pclAddVectorControl(long double ldMinValue,
|
||||
long double ldMaxValue,
|
||||
char cDataLength,
|
||||
BOOL bReadOnly,
|
||||
CString _csControlName,
|
||||
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
unsigned char ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
)
|
||||
{
|
||||
CTL_Editor_VectorControl *pclNewElement = new CTL_Editor_VectorControl( ldMinValue,
|
||||
ldMaxValue,
|
||||
cDataLength,
|
||||
bReadOnly,
|
||||
this,
|
||||
_csControlName,
|
||||
_bAcceptsToTakeNameOfData, //ANNECY BBB
|
||||
//Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
ucInitialCurrentPair
|
||||
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
|
||||
|
||||
);
|
||||
|
||||
m_fn_vAddElement(pclNewElement);
|
||||
|
||||
return pclNewElement;
|
||||
}
|
Reference in New Issue
Block a user