// 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; }