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