Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,239 @@
//Microsoft Developer Studio generated resource script.
//
#include "Ctl_Res.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040c04b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "CTL DLL\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Err\0"
VALUE "LegalCopyright", "Copyright (C) UBI Studios 1997\0"
VALUE "OriginalFilename", "CTL___vd.DLL\0"
VALUE "ProductName", "Biblioth<74>que de liaison dynamique CTL\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x40c, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ARRAY_ELEMENTS_VIEW DIALOG DISCARDABLE 0, 0, 186, 94
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ARRAY_ELEMENTS_VIEW, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 87
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"Ctl_Res.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""l.fra\\afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CAR_D_EDIT_MASKED_DATA DIALOG DISCARDABLE 0, 0, 214, 135
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Actors Editor - Masked data edition"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,50,114,50,14
PUSHBUTTON "Cancel",IDCANCEL,112,114,50,14
LTEXT "Data is :",IDC_STATIC,7,8,27,8
CTEXT "Data name",IDC_STATIC_DATA_NAME,64,7,143,11,SS_SUNKEN
LISTBOX IDC_LIST_MASKS,7,21,176,87,LBS_OWNERDRAWFIXED |
LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "All",IDC_BUTTON_ALL_MASKS,185,20,22,14
PUSHBUTTON "None",IDC_BUTTON_NO_MASK,185,36,22,14
PUSHBUTTON "Invert",IDC_BUTTON_INVERT_MASKS,185,52,22,14
END
IDD_CAR_D_EDIT_ARRAY_DATA DIALOG DISCARDABLE 0, 0, 214, 134
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Actors Editor - array data edition"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,157,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,157,22,50,14
PUSHBUTTON "Insert",IDC_BUTTON_INSERT,157,44,50,14
PUSHBUTTON "Delete",IDC_BUTTON_DELETE,157,60,50,14
PUSHBUTTON "Up",IDC_BUTTON_UP,157,76,50,14
PUSHBUTTON "Down ",IDC_BUTTON_DOWN,157,92,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CAR_D_EDIT_MASKED_DATA, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 207
TOPMARGIN, 7
BOTTOMMARGIN, 128
END
IDD_CAR_D_EDIT_ARRAY_DATA, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 207
TOPMARGIN, 7
BOTTOMMARGIN, 127
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_CURSOR_CLOSED_HAND CURSOR DISCARDABLE "..\\res\\cursor1.cur"
IDC_CURSOR_UP_DOWN_HAND CURSOR DISCARDABLE "..\\res\\cursor_c.cur"
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "l.fra\afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,12 @@
// To include ErO and the Module name
//
// YB for Module CTL
/////////////////////////////////////////
#ifndef _CTL_FOR_ERO_
#define _CTL_FOR_ERO_
#include "ErO.h"
extern CString CTL_g_csModuleNameForErO;
#endif //_CTL_FOR_ERO_

View File

@@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by CTL.rc
//
#define IDC_CURSOR_CLOSED_HAND 136
#define IDC_CURSOR_UP_DOWN_HAND 137
#define IDD_ARRAY_ELEMENTS_VIEW 138
#define IDD_CAR_D_EDIT_MASKED_DATA 219
#define IDD_CAR_D_EDIT_ARRAY_DATA 220
#define IDC_BUTTON_INSERT 1009
#define IDC_BUTTON_DELETE 1010
#define IDC_BUTTON_UP 1011
#define IDC_BUTTON_DOWN 1012
#define IDC_STATIC_DATA_NAME 1165
#define IDC_LIST_MASKS 1167
#define IDC_BUTTON_ALL_MASKS 1168
#define IDC_BUTTON_NO_MASK 1169
#define IDC_BUTTON_INVERT_MASKS 1170
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 139
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1015
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogArrayDataEdition dialog
/////////////////////////////////////////////////////////////////////////////
#ifndef _ED_ACTORS_DIALOG_ARRAY_DATA_EDITION_
#define _ED_ACTORS_DIALOG_ARRAY_DATA_EDITION_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "CTL_Res.h"
#include <afxtempl.h>
#include "Controls\Ctl_LCtl.hpp"
#include "Data\Ctl_LDat.hpp"
class CTL_Editor_ArrayControl;
class CTL_Editor_BaseFormView;
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogArrayDataEdition dialog
class CTL_DialogArrayDataEdition : public CDialog
{
// Construction
public:
// standard constructor
CTL_DialogArrayDataEdition( CTL_Editor_ArrayControl *_pclParentControl,
CWnd* _pParent = NULL);
~CTL_DialogArrayDataEdition();
void m_fn_vUpdateColors ();
void m_fn_vSetSelectedControl (CTL_Editor_Control *pclCtrl) {m_pclSelectedControl = pclCtrl;};
// Dialog Data
//{{AFX_DATA(CTL_DialogArrayDataEdition)
enum { IDD = IDD_CAR_D_EDIT_ARRAY_DATA };
CString m_csDataName;
//}}AFX_DATA
private:
//functions
void m_fn_vCleanup (void) {}; // the lists are cleaned by themselves :-)
void m_fn_vCreateElementControl (tdstArray *pstArray, int i);
int m_fn_lGetIndexOfControl (CTL_Editor_Control *pclSeekCtrl);
void m_fn_vResize ();
void m_fn_vUpdateView ();
//members
HINSTANCE hOldInstance;
CTL_Editor_ArrayControl *m_pclParentControl;
CTL_Editor_ControlList m_clControlList;
CTL_Editor_DataList m_clDataList;
CFrameWnd *m_pclFrameControl;
CTL_Editor_BaseFormView *m_pclView;
tdstArray m_stSavedArray;
CTL_Editor_Control *m_pclSelectedControl;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTL_DialogArrayDataEdition)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
// Generated message map functions
//{{AFX_MSG(CTL_DialogArrayDataEdition)
virtual BOOL OnInitDialog();
virtual void OnCancel();
virtual void OnOK();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnButtonInsert();
afx_msg void OnButtonDelete();
afx_msg void OnButtonUp();
afx_msg void OnButtonDown();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // _ED_ACTORS_DIALOG_ARRAY_DATA_EDITION_

View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogMaskedDataEdition dialog
/////////////////////////////////////////////////////////////////////////////
#ifndef _ED_ACTORS_DIALOG_MASKED_DATA_EDITION_
#define _ED_ACTORS_DIALOG_MASKED_DATA_EDITION_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "CTL_Res.h"
#include <afxtempl.h>
class CTL_Editor_Control;
class CTL_Editor_MaskDescriptor;
class CTL_Editor_Mask;
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogMaskedDataEdition dialog
class CTL_DialogMaskedDataEdition : public CDialog
{
// Construction
public:
// standard constructor
CTL_DialogMaskedDataEdition( CTL_Editor_Control *_pclParentControl,
CWnd* _pParent = NULL);
~CTL_DialogMaskedDataEdition();
// Dialog Data
//{{AFX_DATA(CTL_DialogMaskedDataEdition)
enum { IDD = IDD_CAR_D_EDIT_MASKED_DATA };
CString m_csDataName;
//}}AFX_DATA
private:
HINSTANCE hOldInstance;
CTL_Editor_Control *m_pri_pclParentControl;
CTL_Editor_MaskDescriptor *m_pri_pclMaskDescriptor;
struct m_pri_stMaskInListBox
{
CButton *st_m_pclButton;
CTL_Editor_Mask *st_m_Mask;
BOOL st_m_MaskIsOn;
};
CList<struct m_pri_stMaskInListBox *, struct m_pri_stMaskInListBox *> m_clListOfMasksInListBox;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTL_DialogMaskedDataEdition)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
private:
BOOL m_pri_fn_bDataHasThisMask(unsigned long _ulMaskValue);
void m_pri_fn_vSetDataWithMask(unsigned long _ulMaskValue, BOOL _bMaskOn);
protected:
// Generated message map functions
//{{AFX_MSG(CTL_DialogMaskedDataEdition)
virtual void OnOK();
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual BOOL OnInitDialog();
afx_msg void OnButtonAllMasks();
afx_msg void OnButtonNoMask();
afx_msg void OnButtonInvertMasks();
afx_msg void OnDestroy();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // _ED_ACTORS_DIALOG_MASKED_DATA_EDITION_

View File

@@ -0,0 +1,62 @@
#if !defined(AFX_ARRAYELEMENTSVIEW_H__71BABD8C_7ADF_11D2_8745_00A0245476ED__INCLUDED_)
#define AFX_ARRAYELEMENTSVIEW_H__71BABD8C_7ADF_11D2_8745_00A0245476ED__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ArrayElementsView.h : header file
//
#include "CTL_Res.h"
#include <afxtempl.h>
/////////////////////////////////////////////////////////////////////////////
// CArrayElementsView form view
class CArrayElementsView : public CTL_Editor_BaseFormView
{
protected:
CArrayElementsView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CArrayElementsView)
// Form Data
public:
//{{AFX_DATA(CArrayElementsView)
enum { IDD = IDD_ARRAY_ELEMENTS_VIEW };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CArrayElementsView)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CArrayElementsView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CArrayElementsView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ARRAYELEMENTSVIEW_H__71BABD8C_7ADF_11D2_8745_00A0245476ED__INCLUDED_)

View File

@@ -0,0 +1,62 @@
// Global public functions
//
// YB
//////////////////////////////
#ifndef _CTL_GLOBAL_PRIVATE_FUNCTIONS_
#define _CTL_GLOBAL_PRIVATE_FUNCTIONS_
#include "CTL\Others\CTL_ClBk.hpp"
#ifndef CTL_WITH_NO_TUT
typedef void (* CTL_td_p_fn_vRegisterControl) (HWND _hWnd , const CString _csName , enum TUT_eControlType_ _eType);
typedef BOOL (* CTL_td_p_fn_bUnregisterControl) (HWND _hWnd);
#endif //CTL_WITH_NO_TUT
//Module
extern HMODULE CTL_g_hModule;
//Cursors for BaseFormView class
extern HCURSOR CTL_g_hcursor_CloseHand;
extern HCURSOR CTL_g_hcursor_UpDownHand;
#ifndef CTL_WITH_NO_TUT
//The TUT Dll functions
extern CTL_td_p_fn_vRegisterControl CTL_p_fn_vRegisterControl;
extern CTL_td_p_fn_bUnregisterControl CTL_p_fn_bUnregisterControl;
//For TUT Module
extern CString CTL_g_csCurrentTAG;
extern CString CTL_g_csCurrentSecondaryInfo;
#endif //CTL_WITH_NO_TUT
//Default Callbacks
extern CTL_td_p_fn_bControlCanBeDisplayed CTL_g_p_fnDefaultCallBack_ControlCanBeDisplayed;
extern CTL_td_p_fn_vCallBackWhenDataHasChanged CTL_g_p_fnDefaultCallBack_DataHasChanged;
extern CTL_td_p_fn_vStaticHasBeenClicked CTL_g_p_fnDefaultCallBack_StaticHasBeenClicked;
extern CTL_tdp_fn_vGetColor CTL_g_p_fnDefaultCallBack_GetColor;
//Version
extern CString CTL_g_csVersion;
//////////////////////////
//////////////////////////
//Functions
//////////////////////////
void CTL_fn_vInternalInitModule();
long CTL_fn_lComputeSizeOfStaticForName(class CTL_Editor_BaseControl *_pclSenderBaseControl);
#ifndef CTL_WITH_NO_TUT
BOOL CTL_fn_bGetTUT_DLLFunctions();
#endif //CTL_WITH_NO_TUT
void CTL_fn_vSetMemoryForFloat(void *pvDest,
long double ldfSourceValue,
char cDataLength);
void CTL_fn_vGetMemoryForFloat(void *pvSource,
long double &r_ldfEditorValue,
char cDataLength);
#endif //_CTL_GLOBAL_PRIVATE_FUNCTIONS_

View File

@@ -0,0 +1,41 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__3CB795CD_F6C0_11D0_B56C_006097828C2B__INCLUDED_)
#define AFX_STDAFX_H__3CB795CD_F6C0_11D0_B56C_006097828C2B__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC OLE automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__3CB795CD_F6C0_11D0_B56C_006097828C2B__INCLUDED_)

View File

@@ -0,0 +1,5 @@
echo off
copy x:\cpa\Exe\main\Edt_Data\CTl___vd.dll l:\shadow\cpa_edit\exe\main\edt_data\*.*
copy x:\cpa\Exe\main\Edt_Data\CTl___vd.lib l:\shadow\cpa_edit\exe\main\edt_data\*.*
copy x:\cpa\Exe\main\Edt_Data\CTl___vd.pdb l:\shadow\cpa_edit\exe\main\edt_data\*.*
echo Copies OK !

View File

@@ -0,0 +1,597 @@
# Microsoft Developer Studio Project File - Name="CTL" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=CTL - Win32 Debug without TUT
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Ctl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Ctl.mak" CFG="CTL - Win32 Debug without TUT"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "CTL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "CTL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "CTL - Win32 Debug with Copy" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "CTL - Win32 Debug without TUT" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/Ctl/Make", NGCAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "CTL - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\exe\main\edt_data"
# PROP Intermediate_Dir "..\Temp\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\inc\s" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /u
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 /nologo /subsystem:windows /dll /incremental:yes /machine:I386 /out:"x:\cpa\exe\main\edt_data\CTL___vr.dll"
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "CTL - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\exe\main\edt_data"
# PROP Intermediate_Dir "..\Temp\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "x:\cpa\public\Ctl" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /u
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /i "..\res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\cpa\exe\main\edt_data\CTL___vd.dll" /pdbtype:sept
!ELSEIF "$(CFG)" == "CTL - Win32 Debug with Copy"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "CTL___Wi"
# PROP BASE Intermediate_Dir "CTL___Wi"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\exe\main\edt_data"
# PROP Intermediate_Dir "..\Temp\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "x:\cpa\public\Ctl" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "x:\cpa\public\Ctl" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /u
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /i "..\res" /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /i "..\res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\cpa\exe\main\edt_data\CTL___vd.dll" /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\cpa\exe\main\edt_data\CTL___vd.dll" /pdbtype:sept
# Begin Special Build Tool
SOURCE=$(InputPath)
PostBuild_Cmds=x:\cpa\tempgrp\ctl\make\CTL_copy.bat
# End Special Build Tool
!ELSEIF "$(CFG)" == "CTL - Win32 Debug without TUT"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "CTL___Wi"
# PROP BASE Intermediate_Dir "CTL___Wi"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\exe\main\edt_data"
# PROP Intermediate_Dir "..\Temp\Debug_No_TUT"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /Z7 /Od /I "x:\cpa\public\Ctl" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# SUBTRACT BASE CPP /u
# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "x:\cpa\public\Ctl" /I "..\inc" /I "..\inc\Dialogs" /I "x:\cpa\public" /I "x:\cpa\public\CTL" /D "_DEBUG" /D "CTL_WITH_NO_TUT" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "VISUAL" /D "CPA_WANTS_EXPORT" /FR /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /u
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /i "..\res" /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x40c /i "..\res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\cpa\exe\main\edt_data\CTL___vd.dll" /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\cpa\exe\main\edt_data\CTL___vd.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "CTL - Win32 Release"
# Name "CTL - Win32 Debug"
# Name "CTL - Win32 Debug with Copy"
# Name "CTL - Win32 Debug without TUT"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "Controls"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\Controls\CTL_BCL.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_BCtl.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_Ctl.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlA.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlB.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlE.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlF.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlI.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlM.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlT.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_CtlV.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Controls\CTL_LCtl.cpp
# End Source File
# End Group
# Begin Group "Data"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\Data\CTL_Dat.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatA.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatB.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatE.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatF.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatI.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatM.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatT.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_DatV.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Data\CTL_LDat.cpp
# End Source File
# End Group
# Begin Group "WControls"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\WControls\CTL_BWC.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_VBas.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WBut.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WCBx.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WCkB.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WEdt.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WSpn.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\WControls\CTL_WSta.cpp
# End Source File
# End Group
# Begin Group "Dialogs"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\Dialogs\CTL_aevw.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Dialogs\CTL_DgA.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Dialogs\CTL_DgME.cpp
# End Source File
# End Group
# Begin Group "Others"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\Others\CTL_EnLi.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Others\CTL_Mask.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Others\CTL_ODat.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Others\CTL_Pri.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Others\CTL_Pub.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Others\CTL_TTT.cpp
# End Source File
# End Group
# Begin Source File
SOURCE=..\Src\_DLLCom.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\Ctl.def
# End Source File
# Begin Source File
SOURCE=..\Src\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Group "H_Controls"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_BCL.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_BCtl.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_Cnst.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_Ctl.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\public\CTL\Controls\CTL_CtlA.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlB.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlE.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlF.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlI.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlM.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlT.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_CtlV.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Controls\CTL_LCtl.hpp
# End Source File
# End Group
# Begin Group "H_Data"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_Dat.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\public\CTL\Data\CTL_DatA.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatB.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatE.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatF.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatI.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatM.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatT.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_DatV.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Data\CTL_LDat.hpp
# End Source File
# End Group
# Begin Group "H_WControls"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_BWC.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_VBas.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WBut.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WCBx.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WCkB.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WEdt.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WSpn.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\WControls\CTL_WSta.hpp
# End Source File
# End Group
# Begin Group "H_Dialogs"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Inc\Dialogs\CTL_aevw.hpp
# End Source File
# Begin Source File
SOURCE=..\Inc\Dialogs\CTL_DgA.hpp
# End Source File
# Begin Source File
SOURCE=..\Inc\Dialogs\CTL_DgME.hpp
# End Source File
# End Group
# Begin Group "H_Others"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_ClBk.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_EnLi.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_Enum.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_Mask.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_ODat.hpp
# End Source File
# Begin Source File
SOURCE=..\Inc\Others\CTL_Pri.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_Pub.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\CTL\Others\CTL_TTT.hpp
# End Source File
# End Group
# Begin Group "External"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Public\CTL.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\Inc\Ctl_Res.h
# End Source File
# Begin Source File
SOURCE=..\Inc\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=..\Inc\Ctl.rc
# End Source File
# Begin Source File
SOURCE=..\Inc\cursor1.cur
# End Source File
# Begin Source File
SOURCE=..\Res\cursor1.cur
# End Source File
# Begin Source File
SOURCE=..\Res\cursor_c.cur
# End Source File
# End Group
# Begin Group "Libs Debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Exe\Main\EDT_DATA\ErO___vd.lib
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\MaiDFEvd.lib
# End Source File
# End Group
# Begin Source File
SOURCE=.\Ctl.mak
# End Source File
# End Target
# End Project

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[Ctl.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,10 @@
; CTL.def : Declares the module parameters for the DLL.
LIBRARY
DESCRIPTION 'CTL Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
CTL_fn_vInitModule

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

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

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

View 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);
}

View 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);
}

View 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)

View 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());
}

View 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());
}

View 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();
}

View 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();
}
}
}

View 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());
}

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

View File

@@ -0,0 +1,303 @@
// Implementation file for the definition of a characteristic base type
////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_Dat.hpp"
#include "Others\CTL_Pub.hpp"
#include "Others\CTL_Pri.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_Data::CTL_Editor_Data(CTL_tdeEditorDataType _tdeType,
CString _csDataName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *_pclCurrentBaseData /*= NULL*/,
long _lUSerDefinedDataType /*= 0*/)
{
m_pro_tdeDataType = _tdeType;
m_pro_pvMotorData = NULL;
m_pri_pclParentList = _pclParentList;
m_pro_bDataHasChanged = TRUE;
m_pro_csDataName = _csDataName;
//Sets Initial and Current Data links
m_pclAssociatedCurrentData = NULL;
m_pclAssociatedInitialData = NULL;
m_pro_pclParentControl = NULL;
//If a current data corresponds to 'this' data, sets 'this' as the
// initial data of the other
if ( _pclCurrentBaseData != NULL )
{
m_fn_vSetAssociatedCurrentData(_pclCurrentBaseData);
m_pclAssociatedCurrentData->m_fn_vSetAssociatedInitialData(this);
}
m_pro_lUSerDefinedDataType = _lUSerDefinedDataType;
//CallBack functions
m_pro_td_p_fn_vDataHasChangedCallBack = CTL_g_p_fnDefaultCallBack_DataHasChanged;
m_pro_td_p_fn_vDataHasChangedSpecialCallBack = NULL;
m_pro_td_p_fn_vDataModifWhenRead = NULL;
m_pro_td_p_fn_vDataModifWhenWrite = NULL;
m_pro_td_p_fn_bDataMustBeRead = NULL;
m_pro_td_p_fn_bDataMustBeWritten = NULL;
}
//************************************************************************
CTL_Editor_Data::~CTL_Editor_Data()
{
// Removes from Watch Window if necessary
// if ( (g_pclInterface->m_pclWatchWindow != NULL)
// && (m_bIsInWatch)
// )
// g_pclInterface->m_pclWatchWindow->m_fn_vRemoveValue(this);
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_Data::m_fn_vInitData()
{
}
// BEGIN ROMTEAM Cristi Petrescu 98-11-
#include "scr.h"
#include "ai/aibase/gsparam.h"
// END ROMTEAM Cristi Petrescu 98-11-
//************************************************************************
void CTL_Editor_Data::m_fn_vSetMotorDataPtr(void *p_vMotorData)
{
// BEGIN ROMTEAM Cristi Petrescu 98-11-
tduGetSetParam *p_TMotorData = (tduGetSetParam *)p_vMotorData;
// END ROMTEAM Cristi Petrescu 98-11-
m_pro_pvMotorData = p_vMotorData;
}
//************************************************************************
void *CTL_Editor_Data::m_fn_pvGetMotorDataPtr()
{
return m_pro_pvMotorData;
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_Data::m_pub_fn_pclAddOwnerData(void *_pvDataPtr,
CString _csName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_pvDataPtr, _csName);
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_Data::m_pub_fn_pclAddOwnerData(long _lData,
CString _csName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_lData, _csName);
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_Data::m_pub_fn_pclGetOwnerDataWithName(CString _csSearchedName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclFindOwnerDataWithName(_csSearchedName);
}
//*********************************************************************************
//Parent List of Data
CTL_Editor_DataList *CTL_Editor_Data::m_pub_fn_pclGetParentList()
{
return m_pri_pclParentList;
}
//*********************************************************************************
//User Defined Data type
long CTL_Editor_Data::m_pub_fn_lGetUSerDefinedDataType()
{
return m_pro_lUSerDefinedDataType;
}
//************************************************************************
CStringList *CTL_Editor_Data::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
m_csStringList.AddTail("NO APPROPRIATE SAVING FOR THIS DATA !");
return &m_csStringList;
}
//************************************************************************
//Returns the name of the Data
CString CTL_Editor_Data::m_pub_fn_csGetDataName()
{
return m_pro_csDataName;
}
//************************************************************************
//Get/Set for the Parent Control
CTL_Editor_Control *CTL_Editor_Data::m_pub_fn_pclGetParentControl()
{
return m_pro_pclParentControl;
}
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetParentControl(CTL_Editor_Control *_pclParentControl)
{
m_pro_pclParentControl = _pclParentControl;
}
//************************************************************************
//Get/Set for the pointer on motor's data
void *CTL_Editor_Data::m_pub_fn_pvGetMotorData()
{
return m_pro_pvMotorData;
}
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetMotorData(void *_p_vMotorData)
{
m_pro_pvMotorData = _p_vMotorData;
}
//************************************************************************
//Indicates wether current value is different from the old one or not
// (used during motor run)
BOOL CTL_Editor_Data::m_pub_fn_bGetDataHasChanged()
{
return m_pro_bDataHasChanged;
}
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetDataHasChanged(BOOL _bNewSate)
{
m_pro_bDataHasChanged = _bNewSate;
}
//************************************************************************
CTL_tdeEditorDataType CTL_Editor_Data::m_pub_fn_tdeGetDataType()
{
return m_pro_tdeDataType;
}
//Link between initial and current Data
//The associated current Data
//************************************************************************
BOOL CTL_Editor_Data::m_fn_bHasACurrentData()
{
return ( m_pclAssociatedCurrentData != NULL );
}
//************************************************************************
CTL_Editor_Data *CTL_Editor_Data::m_fn_pclGetAssociatedCurrentData()
{
return m_pclAssociatedCurrentData;
}
//************************************************************************
void CTL_Editor_Data::m_fn_vSetAssociatedCurrentData(CTL_Editor_Data *pclData)
{
ERROR_ASSERT( m_pro_tdeDataType == pclData->m_pro_tdeDataType );
m_pclAssociatedCurrentData = pclData;
}
//The associated Initial Data
//************************************************************************
BOOL CTL_Editor_Data::m_fn_bHasAnInitialData()
{
return ( m_pclAssociatedInitialData != NULL );
}
//************************************************************************
CTL_Editor_Data *CTL_Editor_Data::m_fn_pclGetAssociatedInitialData()
{
return m_pclAssociatedInitialData;
}
//************************************************************************
void CTL_Editor_Data::m_fn_vSetAssociatedInitialData(CTL_Editor_Data *pclData)
{
//This must be already done
ERROR_ASSERT( pclData->m_pclAssociatedCurrentData == this );
ERROR_ASSERT( m_pro_tdeDataType == pclData->m_pro_tdeDataType );
m_pclAssociatedInitialData = pclData;
}
//************************************************************************
//Set : CallBack function : called when Data has changed
void CTL_Editor_Data::m_pub_fn_vSetDataChangedCallBackFunction(CTL_td_p_fn_vCallBackWhenDataHasChanged _td_p_fn_vDataHasChangedCallBack)
{
ERROR_ASSERT( m_pro_td_p_fn_vDataHasChangedCallBack == NULL );
m_pro_td_p_fn_vDataHasChangedCallBack = _td_p_fn_vDataHasChangedCallBack;
}
//************************************************************************
//Set : CallBack function : called when Data has changed (specific for one type of Data)
void CTL_Editor_Data::m_pub_fn_vSetDataChangedSpecialCallBackFunction(CTL_td_p_fn_vCallBackWhenDataHasChanged _td_p_fn_vDataHasChangedSpecialCallBack)
{
ERROR_ASSERT( m_pro_td_p_fn_vDataHasChangedSpecialCallBack == NULL );
m_pro_td_p_fn_vDataHasChangedSpecialCallBack = _td_p_fn_vDataHasChangedSpecialCallBack;
}
//**************************************************************************************
void CTL_Editor_Data::m_fn_vDataHasBeenChanged(CTL_tdeUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
if ( m_pro_td_p_fn_vDataHasChangedCallBack != NULL )
m_pro_td_p_fn_vDataHasChangedCallBack(this, _eReason, _lUserDefinedReason);
if ( m_pro_td_p_fn_vDataHasChangedSpecialCallBack != NULL )
m_pro_td_p_fn_vDataHasChangedSpecialCallBack(this, _eReason, _lUserDefinedReason);
}
//Modification Functions
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetModificationFunctionWhenRead(CTL_tdp_fn_vDataModificationFunction p_fn_vDataModifWhenRead)
{
ERROR_ASSERT( m_pro_td_p_fn_vDataModifWhenRead == NULL );
m_pro_td_p_fn_vDataModifWhenRead = p_fn_vDataModifWhenRead;
}
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetModificationFunctionWhenWrite(CTL_tdp_fn_vDataModificationFunction p_fn_vDataModifWhenWrite)
{
ERROR_ASSERT( m_pro_td_p_fn_vDataModifWhenWrite == NULL );
m_pro_td_p_fn_vDataModifWhenWrite = p_fn_vDataModifWhenWrite;
}
//************************************************************************
//When Data must be Read or Write
void CTL_Editor_Data::m_pub_fn_vSetDataMustBeRead_CallBack(CTL_td_p_fn_bCallBackWhenDataMustBeReadOrWritten _p_fn_CallBack)
{
ERROR_ASSERT( m_pro_td_p_fn_bDataMustBeRead == NULL );
m_pro_td_p_fn_bDataMustBeRead = _p_fn_CallBack;
}
//************************************************************************
void CTL_Editor_Data::m_pub_fn_vSetDataMustBeWritten_CallBack(CTL_td_p_fn_bCallBackWhenDataMustBeReadOrWritten _p_fn_CallBack)
{
ERROR_ASSERT( m_pro_td_p_fn_bDataMustBeWritten == NULL );
m_pro_td_p_fn_bDataMustBeWritten = _p_fn_CallBack;
}

View File

@@ -0,0 +1,212 @@
// 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 "Data\CTL_DatA.hpp"
#include "WControls\CTL_WCkB.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
//**************************************************************************************
CTL_Editor_ArrayData::CTL_Editor_ArrayData ( CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData)
: CTL_Editor_Data(CTL_DATA_TYPE__ARRAY,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
}
//**************************************************************************************
CTL_Editor_ArrayData::~CTL_Editor_ArrayData()
{
}
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_ArrayData::m_fn_vInitData()
{
}
//**************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_ArrayData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
tdstArray * pstValue = ((tdstArray *) m_pub_fn_pvGetMotorData());
M_ARRAY_COPY (& m_stCurrentValue, pstValue);
}
}
//**************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_ArrayData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
tdstArray * p_stValue = (tdstArray *) m_pub_fn_pvGetMotorData();
M_ARRAY_COPY (p_stValue, & m_stCurrentValue);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_ArrayData::m_fn_vUpdateData( CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
M_ARRAY_COPY (& m_stCurrentValue, ((CTL_Editor_ArrayData *)pclSourceData) -> mfn_pstGetCurrentValue ());
//m_fn_bSetLink(pclSourceData->m_fn_eGetLink());
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_ArrayData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
//TODO
//csStringToReturn.Format("%u",(unsigned long)m_ulCurrentValue);
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_ArrayData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
//TODO
//m_ulCurrentValue = atol((char *)LPCTSTR(csValueString));
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_ArrayData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged (! M_ARRAY_COMPARE (& m_stCurrentValue, & m_stOldValue));
if ( m_pub_fn_bGetDataHasChanged() )
M_ARRAY_COPY (& m_stOldValue, & m_stCurrentValue);
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_ArrayData::m_fn_vKeepCurrentValue()
{
M_ARRAY_COPY (& m_stKeepedValueForUndo, & m_stCurrentValue);
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_ArrayData::m_fn_vRegisterUndoAction()
{
/* if ( m_bKeepedValueForUndo != m_bCurrentState )
{
EdActors_ActorBooleanDataModif *pclModif = new EdActors_ActorBooleanDataModif(this,
m_bKeepedValueForUndo,
m_bCurrentState);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//************************************************************************
/*
CTL_Editor_MaskDescriptor *CTL_Editor_MaskedData::m_pub_fn_pclGetMaskdescriptor()
{
return m_pri_pclMaskdescriptor;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_ArrayData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
tdstArray *pstCompareValue = & ((CTL_Editor_ArrayData *)pModifiedData)->m_stOldValue;
return M_ARRAY_COMPARE (& m_stCurrentValue, pstCompareValue);
}
/*
Macros...
void fn_vCopyArray (tdstArray *pstSource, tdstArray *pstDest)
{
M_ARRAY_SIZE (pstDest) = M_ARRAY_SIZE (pstSource);
M_ARRAY_TYPE (pstDest) = M_ARRAY_TYPE (pstSource);
memcpy (M_ARRAY_ELEMENT (pstDest, 0), M_ARRAY_ELEMENT (pstSource, 0), M_ARRAY_SIZE (pstSource) * C_SizeOfArrayElement);
}
BOOL fn_bCompareArray (tdstArray *pstArray1, tdstArray *pstArray2)
{
if (M_ARRAY_SIZE (pstArray1) != M_ARRAY_SIZE (pstArray2)
return FALSE;
if (M_ARRAY_TYPE (pstArray1) != M_ARRAY_TYPE (pstArray2)
return FALSE;
// not quite sure about this, but ...
// should work most of times
return memcmp (M_ARRAY_ELEMENT (pstArray1, 0), M_ARRAY_ELEMENT (pstArray2, 0), M_ARRAY_SIZE (pstArray1) * C_SizeOfArrayElement) == 0;
}
*/

View File

@@ -0,0 +1,224 @@
// Implementation file for the definition of a characteristic type
/////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatB.hpp"
#include "WControls\CTL_WCkB.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
#define C_szTrueString "True"
#define C_szFalseString "False"
//Constructors / Destructor
//**************************************************************************************
CTL_Editor_BooleanData::CTL_Editor_BooleanData(CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__BOOLEAN,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_bISBitFieldCoded = FALSE;
}
//**************************************************************************************
CTL_Editor_BooleanData::CTL_Editor_BooleanData(tdBitFieldCoder tdMask,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__BOOLEAN,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_tdMask = tdMask;
m_bISBitFieldCoded = TRUE;
}
//**************************************************************************************
CTL_Editor_BooleanData::~CTL_Editor_BooleanData()
{
}
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_BooleanData::m_fn_vInitData()
{
}
//**************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_BooleanData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
if(m_pub_fn_pvGetMotorData())
{
unsigned char ucValue = *((unsigned char *)m_pub_fn_pvGetMotorData());
if ( m_bISBitFieldCoded )
m_bCurrentState = ( (ucValue & m_tdMask) != 0 );
else
m_bCurrentState = ( ucValue != 0 );
}
}
}
//**************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_BooleanData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
unsigned char *p_ucValue = (unsigned char *)m_pub_fn_pvGetMotorData();
if ( m_bISBitFieldCoded )
{
//Only available with a one bit long bitfield coded on a char !!
unsigned char ucValue = *p_ucValue;
if ( m_bCurrentState )
{
if ( (ucValue & m_tdMask) == 0 ) //If bit must be changed
{
ucValue = ucValue ^ m_tdMask;
*p_ucValue = ucValue;
}
}
else
{
if ( (ucValue & m_tdMask) != 0 ) //If bit must be changed
{
tdBitFieldCoder tdInverseMask = 0xFF - m_tdMask;
unsigned char ucModifiedValue = ucValue & tdInverseMask;
*p_ucValue = ucModifiedValue;
}
}
}
else
{
*p_ucValue = (m_bCurrentState ? 1 : 0);
}
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_BooleanData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_bCurrentState = ((CTL_Editor_BooleanData *)pclSourceData)->m_bCurrentState;
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_BooleanData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
csStringToReturn.Format("%s",(m_bCurrentState) ? C_szTrueString : C_szFalseString);
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_BooleanData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
if ( csValueString.CompareNoCase(CString(C_szTrueString)) == 0)
m_bCurrentState = TRUE;
else
m_bCurrentState = FALSE;
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_BooleanData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged( m_bCurrentState != m_bOldState );
if ( m_pub_fn_bGetDataHasChanged() )
m_bOldState = m_bCurrentState;
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_BooleanData::m_fn_vKeepCurrentValue()
{
m_bKeepedValueForUndo = m_bCurrentState;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_BooleanData::m_fn_vRegisterUndoAction()
{
/* if ( m_bKeepedValueForUndo != m_bCurrentState )
{
EdActors_ActorBooleanDataModif *pclModif = new EdActors_ActorBooleanDataModif(this,
m_bKeepedValueForUndo,
m_bCurrentState);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_BooleanData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_bCurrentState == ((CTL_Editor_BooleanData *)pModifiedData)->m_bOldState;
}

View File

@@ -0,0 +1,272 @@
// Implementation file for the definition of an enum characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatE.hpp"
#include "Others\CTL_EnLi.hpp"
#include "Others\CTL_Pub.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_EnumData::CTL_Editor_EnumData(CTL_Editor_EnumDescriptor *pclEnumDescriptor,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__ENUM,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_pclCurrentValue = NULL;
m_pclKeepedValueForUndo = NULL;
m_pclEnumDescriptor = pclEnumDescriptor;
}
//**************************************************************************
CTL_Editor_EnumData::~CTL_Editor_EnumData()
{
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_EnumData::m_fn_vInitData()
{
}
//**************************************************************************
//Function called to read associated motor's data
void CTL_Editor_EnumData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData = m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
long lEnumValue;
switch (m_pclEnumDescriptor->m_fn_ucGetEnumSize())
{
case 0:
char bTempValue;
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &bTempValue, 0);
lEnumValue = bTempValue;
break;
case 1:
char cTempValue;
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &cTempValue, 1);
lEnumValue = cTempValue;
break;
case 2:
short wTempValue;
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &wTempValue, 2);
lEnumValue = wTempValue;
break;
case 4:
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &lEnumValue, 4);
break;
}
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
//Updates current value (pointer)
BOOL bFound = FALSE;
CTL_Editor_EnumElement *m_pclCurrentElement;
if ( m_pclEnumDescriptor != NULL )
{
POSITION pos = m_pclEnumDescriptor->GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
m_pclCurrentElement = m_pclEnumDescriptor->GetNext(pos);
bFound = ( m_pclCurrentElement->m_pub_fn_lGetValue() == lEnumValue );
}
}
if ( bFound )
m_pclCurrentValue = m_pclCurrentElement;
else
{
if ( m_pclEnumDescriptor->GetCount() > 0 )
m_pclCurrentValue = m_pclEnumDescriptor->GetHead();
else
m_pclCurrentValue = NULL;
}
}
}
//**************************************************************************
//Function called to update associated motor's data
void CTL_Editor_EnumData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData = m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenWrite != NULL )
m_pro_td_p_fn_vDataModifWhenWrite(this);
ERROR_ASSERT( m_pub_fn_pvGetMotorData() != NULL );
if ( m_pclCurrentValue != NULL )
{
switch ( m_pclEnumDescriptor->m_fn_ucGetEnumSize() )
{
case 0:
{
char cTempValue = (char)m_pclCurrentValue->m_pub_fn_lGetValue();
CTL_fn_vSetMemory(m_pub_fn_pvGetMotorData(), &cTempValue, 0);
}
break;
case 1:
{
char cTempValue = (char)m_pclCurrentValue->m_pub_fn_lGetValue();
CTL_fn_vSetMemory(m_pub_fn_pvGetMotorData(), &cTempValue, 1);
}
break;
case 2:
{
short sTempValue = (short)m_pclCurrentValue->m_pub_fn_lGetValue();
CTL_fn_vSetMemory(m_pub_fn_pvGetMotorData(), &sTempValue, 2);
}
break;
case 4:
{
long lValue = m_pclCurrentValue->m_pub_fn_lGetValue();
CTL_fn_vSetMemory(m_pub_fn_pvGetMotorData(), &lValue, 4);
}
break;
}
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_EnumData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_pclCurrentValue = ((CTL_Editor_EnumData *)pclSourceData)->m_pclCurrentValue;
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_EnumData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn = "!! Unknown !!";
if ( m_pclCurrentValue != NULL )
csStringToReturn.Format("%s", LPCTSTR(m_pclCurrentValue->m_pub_fn_csGetElementName()));
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data according to a string representing it
void CTL_Editor_EnumData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_pclCurrentValue = m_pclEnumDescriptor->m_fn_pclGetElementFromString(csValueString);
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_EnumData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged(m_pclCurrentValue != m_pclOldValue);
if ( m_pub_fn_bGetDataHasChanged() )
m_pclOldValue = m_pclCurrentValue;
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_EnumData::m_fn_vKeepCurrentValue()
{
m_pclKeepedValueForUndo = m_pclCurrentValue;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_EnumData::m_fn_vRegisterUndoAction()
{
/* if ( m_pclKeepedValueForUndo->m_pub_fn_lGetValue() != m_pclCurrentValue->m_pub_fn_lGetValue() )
{
EdActors_ActorEnumDataModif *pclModif = new EdActors_ActorEnumDataModif(this,
m_pclKeepedValueForUndo,
m_pclCurrentValue);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//************************************************************************
CTL_Editor_EnumDescriptor *CTL_Editor_EnumData::m_fn_pclGetEnumDescriptor()
{
return m_pclEnumDescriptor;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_EnumData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_pclCurrentValue == ((CTL_Editor_EnumData *)pModifiedData)->m_pclOldValue;
}

View File

@@ -0,0 +1,185 @@
// Implementation file for the definition of an integer characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatF.hpp"
#include "Others\CTL_Pri.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_DecimalData::CTL_Editor_DecimalData(char cDataSize,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__DECIMAL,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_cDataSize = cDataSize;
m_ldCurrentValue = 0;
}
//************************************************************************************
CTL_Editor_DecimalData::~CTL_Editor_DecimalData()
{
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_DecimalData::m_fn_vInitData()
{
}
//************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_DecimalData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
m_ldCurrentValue = 0;
CTL_fn_vGetMemoryForFloat(m_pub_fn_pvGetMotorData(), m_ldCurrentValue, m_cDataSize);
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
}
}
//************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_DecimalData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenWrite != NULL )
m_pro_td_p_fn_vDataModifWhenWrite(this);
CTL_fn_vSetMemoryForFloat(m_pub_fn_pvGetMotorData(), m_ldCurrentValue, m_cDataSize);
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_DecimalData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_cDataSize = ((CTL_Editor_DecimalData *)pclSourceData)->m_cDataSize;
m_ldCurrentValue = ((CTL_Editor_DecimalData *)pclSourceData)->m_ldCurrentValue;
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_DecimalData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
csStringToReturn.Format("%.3f", m_ldCurrentValue);
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_DecimalData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_ldCurrentValue = atof(LPCTSTR(csValueString));
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_DecimalData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged(m_ldCurrentValue != m_ldOldValue);
if ( m_pub_fn_bGetDataHasChanged() )
m_ldOldValue = m_ldCurrentValue;
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_DecimalData::m_fn_vKeepCurrentValue()
{
m_ldKeepedValueForUndo = m_ldCurrentValue;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_DecimalData::m_fn_vRegisterUndoAction()
{
/* if ( m_ldKeepedValueForUndo != m_ldCurrentValue )
{
EdActors_ActorFloatDataModif *pclModif = new EdActors_ActorFloatDataModif(this,
m_ldKeepedValueForUndo,
m_ldCurrentValue);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_DecimalData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_ldCurrentValue == ((CTL_Editor_DecimalData *)pModifiedData)->m_ldOldValue;
}

View File

@@ -0,0 +1,188 @@
// Implementation file for the definition of an integer characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatI.hpp"
#include "Controls\CTL_Ctl.hpp"
#include "Others\CTL_Pub.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_IntegerData::CTL_Editor_IntegerData(char cDataSize,
BOOL bSigned,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__INTEGER,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_cDataSize = cDataSize;
m_bSigned = bSigned;
m_lCurrentValue = 0;
}
//************************************************************************************
CTL_Editor_IntegerData::~CTL_Editor_IntegerData()
{
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_IntegerData::m_fn_vInitData()
{
}
//************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_IntegerData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
m_lCurrentValue = 0;
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &m_lCurrentValue, m_cDataSize);
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
}
}
//************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_IntegerData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenWrite != NULL )
m_pro_td_p_fn_vDataModifWhenWrite(this);
CTL_fn_vSetMemory(m_pub_fn_pvGetMotorData(), &m_lCurrentValue, m_cDataSize);
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_IntegerData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_cDataSize = ((CTL_Editor_IntegerData *)pclSourceData)->m_cDataSize;
m_bSigned = ((CTL_Editor_IntegerData *)pclSourceData)->m_bSigned;
m_lCurrentValue = ((CTL_Editor_IntegerData *)pclSourceData)->m_lCurrentValue;
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_IntegerData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
csStringToReturn.Format("%ld", m_lCurrentValue);
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_IntegerData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_lCurrentValue = atoi(LPCTSTR(csValueString));
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_IntegerData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged(m_lCurrentValue != m_lOldValue);
if ( m_pub_fn_bGetDataHasChanged() )
m_lOldValue = m_lCurrentValue;
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_IntegerData::m_fn_vKeepCurrentValue()
{
m_lKeepedValueForUndo = m_lCurrentValue;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_IntegerData::m_fn_vRegisterUndoAction()
{
/* if ( m_lKeepedValueForUndo != m_lCurrentValue )
{
EdActors_ActorIntegerDataModif *pclModif = new EdActors_ActorIntegerDataModif(this,
m_lKeepedValueForUndo,
m_lCurrentValue);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_IntegerData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_lCurrentValue == ((CTL_Editor_IntegerData *)pModifiedData)->m_lOldValue;
}

View File

@@ -0,0 +1,234 @@
// Implementation file for the definition of a characteristic type
/////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatM.hpp"
#include "WControls\CTL_WCkB.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
//Constructors / Destructor
//**************************************************************************************
CTL_Editor_MaskedData::CTL_Editor_MaskedData(CTL_Editor_MaskDescriptor *_pclMaskdescriptor,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__MASKED,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_pri_pclMaskdescriptor = _pclMaskdescriptor;
}
//**************************************************************************************
CTL_Editor_MaskedData::~CTL_Editor_MaskedData()
{
}
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_MaskedData::m_fn_vInitData()
{
}
//**************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_MaskedData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
unsigned long ulValue = *((unsigned long *)m_pub_fn_pvGetMotorData());
m_ulCurrentValue = ulValue;
}
}
//**************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_MaskedData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
long *p_lValue = (long *)m_pub_fn_pvGetMotorData();
*p_lValue = m_ulCurrentValue;
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_MaskedData::m_fn_vUpdateData( CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_ulCurrentValue = ((CTL_Editor_MaskedData *)pclSourceData)->m_ulCurrentValue;
// m_fn_bSetLink(pclSourceData->m_fn_eGetLink());
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_MaskedData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
csStringToReturn.Format("%u",(unsigned long)m_ulCurrentValue);
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_MaskedData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_ulCurrentValue = atol((char *)LPCTSTR(csValueString));
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_MaskedData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged( m_ulCurrentValue != m_ulOldValue );
if ( m_pub_fn_bGetDataHasChanged() )
m_ulOldValue = m_ulCurrentValue;
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_MaskedData::m_fn_vKeepCurrentValue()
{
m_ulKeepedValueForUndo = m_ulCurrentValue;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_MaskedData::m_fn_vRegisterUndoAction()
{
/* if ( m_bKeepedValueForUndo != m_bCurrentState )
{
EdActors_ActorBooleanDataModif *pclModif = new EdActors_ActorBooleanDataModif(this,
m_bKeepedValueForUndo,
m_bCurrentState);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//************************************************************************
CTL_Editor_MaskDescriptor *CTL_Editor_MaskedData::m_pub_fn_pclGetMaskdescriptor()
{
return m_pri_pclMaskdescriptor;
}
//##################################################################"
//************************************************************************
//Constructor
/*EdActors_ActorBooleanDataModif::EdActors_ActorBooleanDataModif( CTL_Editor_Data *pclData,
BOOL bOldValue,
BOOL bNewValue)
: EdActors_ActorDataModif(pclData)
{
m_bNewValue = bNewValue;
m_bKeepedValue = bOldValue;
CString csName;
csName.Format("%s : %s --> %s", pclData->m_csScriptName,
bOldValue ? "Vrai" : "Faux",
bNewValue ? "Vrai" : "Faux");
SetName(csName);
}
//************************************************************************
//Destructor
EdActors_ActorBooleanDataModif::~EdActors_ActorBooleanDataModif()
{
}
//************************************************************************
BOOL EdActors_ActorBooleanDataModif::Do()
{
((CTL_Editor_MaskedData *)m_pclData)->m_bCurrentState = m_bNewValue;
m_pclData->m_fn_vUpdateMotorData();
m_pclData->m_bDataHasChanged = TRUE;
m_pclData->m_pclParentControl->m_fn_vUpdate();
// m_pclData->m_pclParentActor->m_pclActor->fn_vNotifySave();
return TRUE;
}
//************************************************************************
BOOL EdActors_ActorBooleanDataModif::Undo()
{
((CTL_Editor_MaskedData *)m_pclData)->m_bCurrentState = m_bKeepedValue;
m_pclData->m_fn_vUpdateMotorData();
m_pclData->m_bDataHasChanged = TRUE;
m_pclData->m_pclParentControl->m_fn_vUpdate();
return TRUE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_MaskedData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_ulCurrentValue == ((CTL_Editor_MaskedData *)pModifiedData)->m_ulOldValue;
}

View File

@@ -0,0 +1,127 @@
// Implementation file for the definition of a text characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatT.hpp"
#include "CTL_ErO.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Constructor / Destructor
//************************************************************************************
CTL_Editor_TextData::CTL_Editor_TextData(CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__TEXT,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
}
//************************************************************************************
CTL_Editor_TextData::~CTL_Editor_TextData()
{
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_TextData::m_fn_vInitData()
{
}
//************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_TextData::m_fn_vGetMotorData()
{
m_csCurrentString = (CString)((char *)m_pub_fn_pvGetMotorData());
}
//************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_TextData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_TextData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_csCurrentString = ((CTL_Editor_TextData *)pclSourceData)->m_csCurrentString;
// m_fn_bSetLink(pclSourceData->m_fn_eGetLink());
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_TextData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
m_csStringList.AddTail(m_csCurrentString);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_TextData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_csCurrentString = csValueString;
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_TextData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged(m_csCurrentString != m_csOldString);
if ( m_pub_fn_bGetDataHasChanged() )
m_csOldString = m_csCurrentString;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_TextData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_csCurrentString == ((CTL_Editor_TextData *)pModifiedData)->m_csOldString;
}

View File

@@ -0,0 +1,293 @@
// Implementation file for the definition of an integer characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_DatV.hpp"
#include "Others\CTL_Pri.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "MTH.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Constructor / Destructor
//************************************************************************************
CTL_Editor_VectorData::CTL_Editor_VectorData(char cDataSize,
CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__VECTOR,
csScriptName,
_pclParentList,
pclCurrentBaseData)
{
m_cDataSize = cDataSize;
m_ldCurrentValueX = 0;
m_ldCurrentValueY = 0;
m_ldCurrentValueZ = 0;
}
//************************************************************************************
CTL_Editor_VectorData::~CTL_Editor_VectorData()
{
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CTL_Editor_VectorData::m_fn_vInitData()
{
}
//************************************************************************************
//Function called to read associated motor's data
void CTL_Editor_VectorData::m_fn_vGetMotorData()
{
m_ldCurrentValueX = 0.0;
m_ldCurrentValueY = 0.0;
m_ldCurrentValueZ = 0.0;
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
MTH3D_tdstVector *p_tdstVector = (MTH3D_tdstVector *)m_pub_fn_pvGetMotorData();
if(p_tdstVector)
{
CTL_fn_vGetMemoryForFloat(&(p_tdstVector->xX), m_ldCurrentValueX, m_cDataSize);
CTL_fn_vGetMemoryForFloat(&(p_tdstVector->xY), m_ldCurrentValueY, m_cDataSize);
CTL_fn_vGetMemoryForFloat(&(p_tdstVector->xZ), m_ldCurrentValueZ, m_cDataSize);
}
}
}
//************************************************************************************
//Function called to update associated motor's data
void CTL_Editor_VectorData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
MTH3D_tdstVector *p_tdstVector = (MTH3D_tdstVector *)m_pub_fn_pvGetMotorData();
CTL_fn_vSetMemoryForFloat(&(p_tdstVector->xX), m_ldCurrentValueX, m_cDataSize);
CTL_fn_vSetMemoryForFloat(&(p_tdstVector->xY), m_ldCurrentValueY, m_cDataSize);
CTL_fn_vSetMemoryForFloat(&(p_tdstVector->xZ), m_ldCurrentValueZ, m_cDataSize);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//************************************************************************
//Function called to update data with another one
void CTL_Editor_VectorData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT(pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
m_cDataSize = ((CTL_Editor_VectorData *)pclSourceData)->m_cDataSize;
m_ldCurrentValueX = ((CTL_Editor_VectorData *)pclSourceData)->m_ldCurrentValueX;
m_ldCurrentValueY = ((CTL_Editor_VectorData *)pclSourceData)->m_ldCurrentValueY;
m_ldCurrentValueZ = ((CTL_Editor_VectorData *)pclSourceData)->m_ldCurrentValueZ;
m_fn_vUpdateMotorData();
m_fn_vLookIfDataHasBeenModified();
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CTL_Editor_VectorData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringValueX;
csStringValueX.Format("%.3f", m_ldCurrentValueX);
m_csStringList.AddTail(csStringValueX);
CString csStringValueY;
csStringValueY.Format("%.3f", m_ldCurrentValueY);
m_csStringList.AddTail(csStringValueY);
CString csStringValueZ;
csStringValueZ.Format("%.3f", m_ldCurrentValueZ);
m_csStringList.AddTail(csStringValueZ);
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CTL_Editor_VectorData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
CString csMessage = "? ? ?";
CString csMessage2 = "! ! !";
ERROR_PREPARE(/*_M(g_c_csActorModuleNameForErrors,*/
csMessage,
"CTL_Editor_VectorData::m_fn_vSetValueWithString(...)",
E_ERROR_GRAVITY_WARNING,
csMessage2);
ERROR_ASSERT( pcslValueStringList->GetCount() == 3 );
if ( (pcslValueStringList->GetCount() == 3) )
{
//Extracts the three components of the Vector
CString csIsolatedData;
//X coordinate
CString csValueString = pcslValueStringList->GetAt(pcslValueStringList->FindIndex(0));
m_ldCurrentValueX = atof(LPCTSTR(csValueString));
//Y coordinate
csValueString = pcslValueStringList->GetAt(pcslValueStringList->FindIndex(1));
m_ldCurrentValueY = atof(LPCTSTR(csValueString));
//Z coordinate
csValueString = pcslValueStringList->GetAt(pcslValueStringList->FindIndex(2));
m_ldCurrentValueZ = atof(LPCTSTR(csValueString));
}
else
{
m_ldCurrentValueX = 0.0;
m_ldCurrentValueY = 0.0;
m_ldCurrentValueZ = 0.0;
}
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CTL_Editor_VectorData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pub_fn_vSetDataHasChanged ( ( m_ldCurrentValueX != m_ldOldValueX )
|| ( m_ldCurrentValueY != m_ldOldValueY )
|| ( m_ldCurrentValueZ != m_ldOldValueZ )
);
if ( m_pub_fn_bGetDataHasChanged() )
{
m_ldOldValueX = m_ldCurrentValueX;
m_ldOldValueY = m_ldCurrentValueY;
m_ldOldValueZ = m_ldCurrentValueZ;
}
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CTL_Editor_VectorData::m_fn_vKeepCurrentValue()
{
m_ldKeepedValueForUndoX = m_ldCurrentValueX;
m_ldKeepedValueForUndoY = m_ldCurrentValueY;
m_ldKeepedValueForUndoZ = m_ldCurrentValueZ;
}
//************************************************************************
//Function called to validate Undo for the current change
void CTL_Editor_VectorData::m_fn_vRegisterUndoAction()
{
/* if ( m_ldKeepedValueForUndo != m_ldCurrentValue )
{
EdActors_ActorFloatDataModif *pclModif = new EdActors_ActorFloatDataModif(this,
m_ldKeepedValueForUndo,
m_ldCurrentValue);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//##################################################################"
//************************************************************************
//Constructor
/*EdActors_ActorFloatDataModif::EdActors_ActorFloatDataModif( CTL_Editor_Data *pclData,
long double ldOldValue,
long double ldNewValue)
: EdActors_ActorDataModif(pclData)
{
m_ldNewValue = ldNewValue;
m_ldKeepedValue = ldOldValue;
CString csName;
csName.Format("%s : %.3f --> %.3f", pclData->m_csScriptName,
ldOldValue,
ldNewValue);
SetName(csName);
}
//************************************************************************
//Destructor
EdActors_ActorFloatDataModif::~EdActors_ActorFloatDataModif()
{
}
//************************************************************************
BOOL EdActors_ActorFloatDataModif::Do()
{
((CTL_Editor_VectorData *)m_pclData)->m_ldCurrentValue = m_ldNewValue;
m_pclData->m_fn_vUpdateMotorData();
m_pclData->m_bDataHasChanged = TRUE;
m_pclData->m_pclParentControl->m_fn_vUpdate();
m_pclData->m_pclParentActor->m_pclActor->fn_vNotifySave();
return TRUE;
}
//************************************************************************
BOOL EdActors_ActorFloatDataModif::Undo()
{
((CTL_Editor_VectorData *)m_pclData)->m_ldCurrentValue = m_ldKeepedValue;
m_pclData->m_fn_vUpdateMotorData();
m_pclData->m_bDataHasChanged = TRUE;
m_pclData->m_pclParentControl->m_fn_vUpdate();
return TRUE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bEqualsModifiedDataOldValue
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CTL_Editor_VectorData::mfn_bEqualsModifiedDataOldValue (CTL_Editor_Data *pModifiedData)
{
ASSERT (pModifiedData);
ERROR_ASSERT(pModifiedData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType());
return m_ldCurrentValueX == ((CTL_Editor_VectorData *)pModifiedData)->m_ldOldValueX
&& m_ldCurrentValueY == ((CTL_Editor_VectorData *)pModifiedData)->m_ldOldValueY
&& m_ldCurrentValueZ == ((CTL_Editor_VectorData *)pModifiedData)->m_ldOldValueZ;
}

View File

@@ -0,0 +1,211 @@
// Implementation file for the definition of a characteristic base type
////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Data\CTL_LDat.hpp"
#include "Data\CTL_DatB.hpp"
#include "Data\CTL_DatI.hpp"
#include "Data\CTL_DatF.hpp"
#include "Data\CTL_DatE.hpp"
#include "Data\CTL_DatT.hpp"
#include "Data\CTL_DatV.hpp"
#include "Data\CTL_DatM.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
//**************************************************************************************
CTL_Editor_DataList::CTL_Editor_DataList()
{
}
//**************************************************************************************
CTL_Editor_DataList::~CTL_Editor_DataList()
{
m_fn_vEmptyList();
}
//**************************************************************************************
void CTL_Editor_DataList::m_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while ( pos != NULL )
delete GetNext(pos);
RemoveAll();
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_DataList::m_pub_fn_pclAddOwnerData(void *_pvDataPtr,
CString _csName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_pvDataPtr, _csName);
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_DataList::m_pub_fn_pclAddOwnerData(long _lData,
CString _csName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclAddOwnerData(_lData, _csName);
}
//*********************************************************************************
CTL_OwnerData *CTL_Editor_DataList::m_pub_fn_pclGetOwnerDataWithName(CString _csSearchedName)
{
return m_pri_clListOfOwnerData.m_pub_fn_pclFindOwnerDataWithName(_csSearchedName);
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddBooleanData(CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_BooleanData *pclNewData = new CTL_Editor_BooleanData(csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddBitFieldBooleanData(tdBitFieldCoder tdBFCoder,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_BooleanData *pclNewData = new CTL_Editor_BooleanData(tdBFCoder,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddMaskedData(CTL_Editor_MaskDescriptor *_pclMaskDescriptor,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_MaskedData *pclNewData = new CTL_Editor_MaskedData(_pclMaskDescriptor,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddIntegerData(char cDataLength,
BOOL bSigned,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_IntegerData *pclNewData = new CTL_Editor_IntegerData(cDataLength,
bSigned,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddDecimalData(char cDataLength,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_DecimalData *pclNewData = new CTL_Editor_DecimalData(cDataLength,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddEnumData(CTL_Editor_EnumDescriptor *pclEnumDescriptor,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_EnumData *pclNewData = new CTL_Editor_EnumData(pclEnumDescriptor,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddTextData(CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_TextData *pclNewData = new CTL_Editor_TextData(csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclAddVectorData(char cDataLength,
CString csScriptName,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
{
CTL_Editor_VectorData *pclNewData = new CTL_Editor_VectorData(cDataLength,
csScriptName,
this,
pclCurrentBaseData);
AddTail(pclNewData);
return pclNewData;
}
//**************************************************************************************
//To add a user defined data
void CTL_Editor_DataList::m_pub_fn_vAddData(CTL_Editor_Data *_pclDataToAdd)
{
AddTail(_pclDataToAdd);
}
//**************************************************************************************
CTL_Editor_Data * CTL_Editor_DataList::m_fn_pclGetDataFromName(CString csName)
{
POSITION pos=GetHeadPosition();
CTL_Editor_Data *pclData=NULL;
while((pos!=NULL) && (pclData==NULL))
{
CTL_Editor_Data *pclCurrentData=GetNext(pos);
if(csName.CompareNoCase(pclCurrentData->m_pub_fn_csGetDataName())==0)
pclData=pclCurrentData;
}
return pclData;
}

View File

@@ -0,0 +1,600 @@
// ctl_Dga.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#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 "ai/aigame/enumVar.h"
#include "CTL_Dga.hpp"
#include "Controls\CTL_Ctl.hpp"
#include "Controls\Ctl_Ctla.hpp"
#include "Controls\Ctl_Cnst.hpp"
//#include "Others\CTL_Mask.hpp"
#include "Data\CTL_Data.hpp"
#include "Others\CTL_Pri.hpp"
#include "WControls\Ctl_vBas.hpp"
#include "WControls\Ctl_wsta.hpp"
#include "dialogs\ctl_aevw.hpp"
#include "Main\Inc\_EditID.h"
//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
#define EdActors_C_FirstIDForListBoxCheckButtons 1000
#define C_COLOR_UNSEL RGB( 50,200, 50)
#define C_COLOR_SEL RGB(200, 70, 30)
#define C_ARRAY_DIALOG "Array"
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogArrayDataEdition dialog
BEGIN_MESSAGE_MAP(CTL_DialogArrayDataEdition, CDialog)
//{{AFX_MSG_MAP(CTL_DialogArrayDataEdition)
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BUTTON_INSERT, OnButtonInsert)
ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
ON_BN_CLICKED(IDC_BUTTON_UP, OnButtonUp)
ON_BN_CLICKED(IDC_BUTTON_DOWN, OnButtonDown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CTL_DialogArrayDataEdition::CTL_DialogArrayDataEdition(CTL_Editor_ArrayControl *_pclParentControl,
CWnd* _pParent /*= NULL*/)
: CDialog(CTL_DialogArrayDataEdition::IDD, _pParent)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(CTL_g_hModule);
//{{AFX_DATA_INIT(CTL_DialogArrayDataEdition)
//}}AFX_DATA_INIT
m_pclParentControl = _pclParentControl;
m_csDataName = m_pclParentControl->m_fn_pclGetEditedData()->m_pub_fn_csGetDataName();
m_pclSelectedControl = NULL;
}
//***************************************************************************
CTL_DialogArrayDataEdition::~CTL_DialogArrayDataEdition()
{
AfxSetResourceHandle(hOldInstance);
}
//***************************************************************************
void CTL_DialogArrayDataEdition::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTL_DialogArrayDataEdition)
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogArrayDataEdition message handlers
#define M_ADD_ONE_DSG_VAR(Name,TypeControl,TypeData,ParmsData,EngineStruct) \
//***************************************************************************
BOOL CTL_DialogArrayDataEdition::OnInitDialog()
{
CDialog::OnInitDialog();
m_pclFrameControl = new CFrameWnd ();
CRect rect = CRect (0,0, 200, 150);
BOOL bRes = m_pclFrameControl -> Create (NULL,
"Titlu",
WS_CHILD | WS_VISIBLE,
rect,
this,
0,
NULL);
CCreateContext CreateContext;
CreateContext . m_pNewViewClass = RUNTIME_CLASS (CArrayElementsView);
CreateContext . m_pCurrentDoc = NULL;
CreateContext . m_pNewDocTemplate = NULL;
CreateContext . m_pLastView = NULL;
CreateContext . m_pCurrentFrame = NULL;
CWnd *pView = m_pclFrameControl -> CreateView (& CreateContext, AFX_IDW_PANE_FIRST);
pView->ShowWindow(TRUE);
pView->ModifyStyle(WS_BORDER, 0);
m_pclFrameControl -> SetActiveView ((CView *) pView, TRUE);
m_pclView = (CTL_Editor_BaseFormView *) m_pclFrameControl -> GetActiveView ();
// the array
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
// save
M_ARRAY_COPY (& m_stSavedArray, pstArray);
// for all elements
for (int i = 0; i < pstArray -> ucMaxSize; i ++)
m_fn_vCreateElementControl (pstArray, i);
m_pclSelectedControl = m_clControlList . GetHead ();
//update
m_fn_vResize ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void CTL_DialogArrayDataEdition::OnOK()
{
// We are fine ;-)
// cleanup
m_fn_vCleanup ();
CDialog::OnOK ();
}
//***************************************************************************
void CTL_DialogArrayDataEdition::OnCancel()
{
//cleanup
m_fn_vCleanup ();
// restore
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
M_ARRAY_COPY (pstArray, & m_stSavedArray);
CDialog::OnCancel();
}
//***************************************************************************
#define SPACING 8
void CTL_DialogArrayDataEdition::m_fn_vResize()
{
// Move Buttons
CRect rect;
GetClientRect (& rect);
CRect rectNew = rect;
CRect rectSize;
CWnd *pButton = GetDlgItem (IDOK);
if (! pButton)
return;
pButton -> GetClientRect (& rectSize);
rectNew . left = rectNew . right - rectSize . right;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton -> MoveWindow (rectNew);
rectNew . top = rectNew . bottom + C_SPACE_BETWEEN_CONTROLS;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton = GetDlgItem (IDCANCEL);
pButton -> MoveWindow (rectNew);
rectNew . top = rectNew . bottom + 2 * C_SPACE_BETWEEN_CONTROLS;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton = GetDlgItem (IDC_BUTTON_INSERT);
pButton -> MoveWindow (rectNew);
rectNew . top = rectNew . bottom + C_SPACE_BETWEEN_CONTROLS;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton = GetDlgItem (IDC_BUTTON_DELETE);
pButton -> MoveWindow (rectNew);
rectNew . top = rectNew . bottom + C_SPACE_BETWEEN_CONTROLS;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton = GetDlgItem (IDC_BUTTON_UP);
pButton -> MoveWindow (rectNew);
rectNew . top = rectNew . bottom + C_SPACE_BETWEEN_CONTROLS;
rectNew . bottom = rectNew . top + rectSize . bottom;
pButton = GetDlgItem (IDC_BUTTON_DOWN);
pButton -> MoveWindow (rectNew);
// Resize frame
rectNew = rect;
rectNew . right = rectNew . right - rectSize . right - C_SPACE_BETWEEN_CONTROLS;
m_pclFrameControl -> MoveWindow (rectNew);
// Resize view
m_fn_vUpdateView ();
}
//***************************************************************************
void CTL_DialogArrayDataEdition::m_fn_vUpdateView (void)
{
/*
CPoint cpTopLeft = rect . TopLeft ();
CPoint cpTopRight;
cpTopRight . x = rect . right;
cpTopRight . y = cpTopLeft . y;
*/
CPoint cpOffset=m_pclView->GetScrollPosition();
CPoint cpTopLeft(0,-cpOffset.y);
CRect rect ;
m_pclFrameControl -> GetClientRect (& rect);
CPoint cpTopRight(rect.Width() + 20,-cpOffset.y);
m_clControlList. m_pub_fn_vDisplayControlsInZone(cpTopLeft, cpTopRight);
m_clControlList. m_pub_fn_vUpdateControlsWithListOfData(& m_clDataList);
m_pclView -> m_fn_vSetViewHeight ((unsigned short) (cpTopLeft . y + m_pclView -> GetScrollPosition () . y));
m_fn_vUpdateColors ();
}
void CTL_DialogArrayDataEdition::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
m_fn_vResize ();
}
void CTL_DialogArrayDataEdition::OnButtonInsert()
{
// the array
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
if (pstArray -> ucMaxSize == 255)
{
AfxMessageBox ("Maximum 255 elements");
return;
}
if (pstArray -> ucMaxSize == 0)
{
AfxMessageBox ("Minimum 1 element");
return;
}
POSITION pos = m_clControlList . GetHeadPosition ();
POSITION posCtrl = pos;
POSITION posData = m_clDataList . GetHeadPosition ();
int i = 0;
int lSelectedControlIndex = -1;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
if (pclCtrl == m_pclSelectedControl)
{
lSelectedControlIndex = i;
break;
}
posCtrl = pos;
m_clDataList . GetNext (posData);
i ++;
}
if (lSelectedControlIndex < 0)
return;
// move elements
pos = m_clDataList . GetTailPosition ();
for (i = pstArray -> ucMaxSize - 1; i > lSelectedControlIndex; i --)
{
CTL_Editor_Data *pclData = m_clDataList . GetPrev (pos);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, i));
* M_ARRAY_ELEMENT (pstArray, i) = * M_ARRAY_ELEMENT (pstArray, i - 1);
}
// BEGIN ROMTEAM Cristi Petrescu 98-12-
// Do not increase size, last element will be lost
//pstArray -> ucMaxSize ++;
// clear
memset (M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex), 0, C_SizeOfArrayElement);
// create control
m_fn_vCreateElementControl (pstArray, lSelectedControlIndex);
// move it into place
CTL_Editor_Control *pclCtrl = m_clControlList . RemoveTail ();
m_clControlList . InsertBefore (posCtrl, pclCtrl);
m_pclSelectedControl = pclCtrl;
// remove last element
pclCtrl = m_clControlList . RemoveTail ();
delete pclCtrl;
CTL_Editor_Data *pclData = m_clDataList . RemoveTail ();
m_clDataList . InsertBefore (posData, pclData);
// remove last element
pclData = m_clDataList . RemoveTail ();
delete pclData;
// END ROMTEAM Cristi Petrescu 98-12-
m_fn_vUpdateView ();
}
void CTL_DialogArrayDataEdition::OnButtonDelete()
{
// the array
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
if (pstArray -> ucMaxSize == 1)
{
AfxMessageBox ("Minimim 1 element");
return;
}
POSITION pos = m_clControlList . GetHeadPosition ();
POSITION posCtrl = pos;
POSITION posData = m_clDataList . GetHeadPosition ();
int i = 0;
int lSelectedControlIndex = -1;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
if (pclCtrl == m_pclSelectedControl)
{
lSelectedControlIndex = i;
break;
}
posCtrl = pos;
m_clDataList . GetNext (posData);
i ++;
}
if (lSelectedControlIndex < 0)
return;
// BEGIN ROMTEAM Cristi Petrescu 98-12-
// Do not decrease size, last element will be cleared
//pstArray -> ucMaxSize --;
// move elements
pos = posData;
m_clDataList . GetNext (pos);
for (i = lSelectedControlIndex; i < pstArray -> ucMaxSize - 1; i ++)
{
CTL_Editor_Data *pclData = m_clDataList . GetNext (pos);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, i));
* M_ARRAY_ELEMENT (pstArray, i) = * M_ARRAY_ELEMENT (pstArray, i + 1);
}
// clear
memset (M_ARRAY_ELEMENT (pstArray, pstArray -> ucMaxSize - 1), 0, C_SizeOfArrayElement);
// delete controls
pos = posCtrl;
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (posCtrl);
if (! posCtrl)
{
posCtrl = pos;
m_clControlList . GetPrev (posCtrl);
}
m_pclSelectedControl = m_clControlList . GetAt (posCtrl);
m_clControlList . RemoveAt (pos);
//delete pclCtrl;
// add at last position
m_clControlList . AddTail (pclCtrl);
CTL_Editor_Data *pclData = m_clDataList . GetAt (posData);
m_clDataList . RemoveAt (posData);
//delete pclData;
// add at last position
m_clDataList . AddTail (pclData);
// the engine pointer
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, pstArray -> ucMaxSize - 1));
// END ROMTEAM Cristi Petrescu 98-12-
m_fn_vUpdateView ();
}
void CTL_DialogArrayDataEdition::OnButtonUp()
{
// the array
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
POSITION pos = m_clControlList . GetHeadPosition ();
POSITION posCtrl = pos;
POSITION posData = m_clDataList . GetHeadPosition ();
int i = 0;
int lSelectedControlIndex = -1;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
if (pclCtrl == m_pclSelectedControl)
{
lSelectedControlIndex = i;
break;
}
posCtrl = pos;
m_clDataList . GetNext (posData);
i ++;
}
if (lSelectedControlIndex < 0)
return;
if (lSelectedControlIndex == 0)
return;
// switch engine
tduGetSetParam stTemp = * M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex);
* M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex) = * M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex - 1);
* M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex - 1) = stTemp;
// switch ctrl
pos = posCtrl;
CTL_Editor_Control *pclCtrl = m_clControlList . GetAt (posCtrl);
m_clControlList . GetPrev (posCtrl);
m_clControlList . InsertBefore (posCtrl, pclCtrl);
m_clControlList . RemoveAt (pos);
// switch data
pos = posData;
CTL_Editor_Data *pclData = m_clDataList . GetAt (posData);
m_clDataList . GetPrev (posData);
posData = m_clDataList . InsertBefore (posData, pclData);
m_clDataList . RemoveAt (pos);
// set engine pointers
pclData = m_clDataList . GetNext (posData);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex - 1));
pclData = m_clDataList . GetNext (posData);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex ));
m_fn_vUpdateView ();
}
void CTL_DialogArrayDataEdition::OnButtonDown()
{
// the array
CTL_Editor_Data *pclParentData= m_pclParentControl -> m_fn_pclGetEditedData ();
tdstArray *pstArray = (tdstArray *) pclParentData -> m_pub_fn_pvGetMotorData ();
POSITION pos = m_clControlList . GetHeadPosition ();
POSITION posCtrl = pos;
POSITION posData = m_clDataList . GetHeadPosition ();
int i = 0;
int lSelectedControlIndex = -1;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
if (pclCtrl == m_pclSelectedControl)
{
lSelectedControlIndex = i;
break;
}
posCtrl = pos;
m_clDataList . GetNext (posData);
i ++;
}
if (lSelectedControlIndex < 0)
return;
if (lSelectedControlIndex == pstArray -> ucMaxSize - 1)
return;
// switch engine
tduGetSetParam stTemp = * M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex);
* M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex) = * M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex + 1);
* M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex + 1) = stTemp;
// switch ctrl
pos = posCtrl;
CTL_Editor_Control *pclCtrl = m_clControlList . GetAt (posCtrl);
m_clControlList . GetNext (posCtrl);
m_clControlList . InsertAfter (posCtrl, pclCtrl);
m_clControlList . RemoveAt (pos);
// switch data
pos = posData;
CTL_Editor_Data *pclData = m_clDataList . GetAt (posData);
m_clDataList . GetNext (posData);
posData = m_clDataList . InsertAfter (posData, pclData);
m_clDataList . RemoveAt (pos);
// set engine pointers
pclData = m_clDataList . GetPrev (posData);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex + 1));
pclData = m_clDataList . GetPrev (posData);
pclData -> m_fn_vSetMotorDataPtr (M_ARRAY_ELEMENT (pstArray, lSelectedControlIndex ));
m_fn_vUpdateView ();
}
void fn_vNameClicked (CTL_Editor_Static *pclSender, enum CTL_eClickType tdeClickType)
{
CTL_Editor_Control *pclElement = pclSender -> m_pub_fn_pclGetParentControl ();
CTL_DialogArrayDataEdition *pclDlg = (CTL_DialogArrayDataEdition *) (pclElement -> m_pub_fn_pclGetOwnerDataWithName (C_ARRAY_DIALOG) -> m_pub_fn_pvGetDataPtr ());
pclDlg -> m_fn_vSetSelectedControl (pclElement);
pclDlg -> m_fn_vUpdateColors ();
//pclDlg -> RedrawWindow ();
}
void CTL_DialogArrayDataEdition::m_fn_vCreateElementControl (tdstArray *pstArray, int i)
{
CTL_Editor_Control *pclCtrl = m_pclParentControl -> m_fn_pctrlCreateElementControl (& m_clControlList);
m_clControlList . AddTail (pclCtrl);
pclCtrl -> m_fn_bCreateControl (m_pclView);
CTL_Editor_Data *pclData = m_pclParentControl -> m_fn_pdataCreateElementData (& m_clDataList, pclCtrl);
void *pvElem = M_ARRAY_ELEMENT (pstArray, i);
tduGetSetParam *pvTElem = (tduGetSetParam *)pvElem;
pclData -> m_fn_vSetMotorDataPtr (pvElem);
m_clDataList . AddTail (pclData);
pclCtrl->m_fn_vSetEditedData(pclData);
pclData->m_fn_vGetMotorData();
pclCtrl -> m_pub_fn_pclGetNameStatic () -> m_pub_fn_vSetStaticHasBeenClicked_CallBack (fn_vNameClicked);
pclCtrl -> m_pub_fn_pclAddOwnerData (this, C_ARRAY_DIALOG);
pclCtrl->m_fn_vUpdate ();
}
void CTL_DialogArrayDataEdition::m_fn_vUpdateColors (void)
{
POSITION pos = m_clControlList . GetHeadPosition ();
int i = 0;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
static char szName[100];
itoa (i, szName,10);
if (pclCtrl == m_pclSelectedControl)
pclCtrl -> m_pub_fn_pclGetNameStatic () -> m_pub_fn_vSetBackGroundColor (C_COLOR_SEL);
else
pclCtrl -> m_pub_fn_pclGetNameStatic () -> m_pub_fn_vSetBackGroundColor (C_COLOR_UNSEL);
pclCtrl -> m_pub_fn_pclGetNameStatic () -> m_fn_vSetTextToDisplay (szName, TRUE);
i ++;
}
}
int CTL_DialogArrayDataEdition::m_fn_lGetIndexOfControl (CTL_Editor_Control *pclSeekCtrl)
{
POSITION pos = m_clControlList . GetHeadPosition ();
int i = 0;
while (pos)
{
CTL_Editor_Control *pclCtrl = m_clControlList . GetNext (pos);
if (pclCtrl == pclSeekCtrl)
return i;
i ++;
}
return -1;
}

View File

@@ -0,0 +1,349 @@
// EDACDgME.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "CTL_DgME.hpp"
#include "Controls\CTL_Ctl.hpp"
#include "Others\CTL_Mask.hpp"
#include "Data\CTL_DatM.hpp"
#include "Others\CTL_Pri.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define EdActors_C_FirstIDForListBoxCheckButtons 1000
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogMaskedDataEdition dialog
BEGIN_MESSAGE_MAP(CTL_DialogMaskedDataEdition, CDialog)
//{{AFX_MSG_MAP(CTL_DialogMaskedDataEdition)
ON_WM_DRAWITEM()
ON_BN_CLICKED(IDC_BUTTON_ALL_MASKS, OnButtonAllMasks)
ON_BN_CLICKED(IDC_BUTTON_NO_MASK, OnButtonNoMask)
ON_BN_CLICKED(IDC_BUTTON_INVERT_MASKS, OnButtonInvertMasks)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CTL_DialogMaskedDataEdition::CTL_DialogMaskedDataEdition(CTL_Editor_Control *_pclParentControl,
CWnd* _pParent /*= NULL*/)
: CDialog(CTL_DialogMaskedDataEdition::IDD, _pParent)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(CTL_g_hModule);
//{{AFX_DATA_INIT(CTL_DialogMaskedDataEdition)
//}}AFX_DATA_INIT
m_pri_pclParentControl = _pclParentControl;
m_csDataName = m_pri_pclParentControl->m_fn_pclGetEditedData()->m_pub_fn_csGetDataName();
m_pri_pclMaskDescriptor = ((CTL_Editor_MaskedData *)m_pri_pclParentControl->m_fn_pclGetEditedData())->m_pub_fn_pclGetMaskdescriptor();
}
//***************************************************************************
CTL_DialogMaskedDataEdition::~CTL_DialogMaskedDataEdition()
{
AfxSetResourceHandle(hOldInstance);
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTL_DialogMaskedDataEdition)
DDX_Text(pDX, IDC_STATIC_DATA_NAME, m_csDataName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CTL_DialogMaskedDataEdition message handlers
//***************************************************************************
BOOL CTL_DialogMaskedDataEdition::OnInitDialog()
{
CDialog::OnInitDialog();
//Fills list box with masks
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
CTL_Editor_Mask *pclCurrentMask;
short wIndex;
POSITION pos = m_pri_pclMaskDescriptor->GetHeadPosition();
while ( pos != NULL )
{
pclCurrentMask = m_pri_pclMaskDescriptor->GetNext(pos);
struct m_pri_stMaskInListBox *p_stNewMaskForLB = new struct m_pri_stMaskInListBox;
p_stNewMaskForLB->st_m_pclButton = NULL;
p_stNewMaskForLB->st_m_Mask = pclCurrentMask;
p_stNewMaskForLB->st_m_MaskIsOn = m_pri_fn_bDataHasThisMask(pclCurrentMask->m_pub_fn_ulGetMaskValue());
wIndex = pclListBox->AddString(pclCurrentMask->m_pub_fn_csGetString());
if ( wIndex != LB_ERR )
pclListBox->SetItemDataPtr(wIndex, (void *)p_stNewMaskForLB);
}
#ifndef CTL_WITH_NO_TUT
//////////////
//////////////
//Registers for TUT Module
//Registers in TUT
if ( CTL_p_fn_vRegisterControl != NULL )
{
CTL_p_fn_vRegisterControl(GetDlgItem(IDC_LIST_MASKS)->m_hWnd, "CTL_MaskEditionDialog_ListBox", TUT_e_ListBox);
CTL_p_fn_vRegisterControl(GetDlgItem(IDC_BUTTON_ALL_MASKS)->m_hWnd, "CTL_MaskEditionDialog_AllMasksButton", TUT_e_Button);
CTL_p_fn_vRegisterControl(GetDlgItem(IDC_BUTTON_NO_MASK)->m_hWnd, "CTL_MaskEditionDialog_NoMaskButton", TUT_e_Button);
CTL_p_fn_vRegisterControl(GetDlgItem(IDC_BUTTON_INVERT_MASKS)->m_hWnd, "CTL_MaskEditionDialog_InvertButton", TUT_e_Button);
CTL_p_fn_vRegisterControl(GetDlgItem(IDOK)->m_hWnd, "CTL_MaskEditionDialog_OKButton", TUT_e_Button);
CTL_p_fn_vRegisterControl(GetDlgItem(IDCANCEL)->m_hWnd, "CTL_MaskEditionDialog_CancelButton", TUT_e_Button);
}
//End of Registers for TUT Module
//////////////
#endif //CTL_WITH_NO_TUT
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnDestroy()
{
#ifndef CTL_WITH_NO_TUT
//////////////
//////////////
//UnRegisters for TUT Module
if ( CTL_p_fn_bUnregisterControl != NULL )
{
CTL_p_fn_bUnregisterControl(GetDlgItem(IDC_LIST_MASKS)->m_hWnd);
CTL_p_fn_bUnregisterControl(GetDlgItem(IDC_BUTTON_ALL_MASKS)->m_hWnd);
CTL_p_fn_bUnregisterControl(GetDlgItem(IDC_BUTTON_NO_MASK)->m_hWnd);
CTL_p_fn_bUnregisterControl(GetDlgItem(IDC_BUTTON_INVERT_MASKS)->m_hWnd);
CTL_p_fn_bUnregisterControl(GetDlgItem(IDOK)->m_hWnd);
CTL_p_fn_bUnregisterControl(GetDlgItem(IDCANCEL)->m_hWnd);
}
//End of UnRegisters for TUT Module
//////////////
#endif //CTL_WITH_NO_TUT
CDialog::OnDestroy();
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnOK()
{
//Reads the selected Masks and updates the Data
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
struct m_pri_stMaskInListBox *p_stCurrentNewMaskForLB;
short wCurrentIndex = 0;
for (wCurrentIndex; wCurrentIndex < pclListBox->GetCount(); wCurrentIndex ++ )
{
p_stCurrentNewMaskForLB = (struct m_pri_stMaskInListBox *)pclListBox->GetItemDataPtr(wCurrentIndex);
//If Button has been created, gets its state
if ( p_stCurrentNewMaskForLB->st_m_pclButton != NULL )
p_stCurrentNewMaskForLB->st_m_MaskIsOn = p_stCurrentNewMaskForLB->st_m_pclButton->GetCheck();
m_pri_fn_vSetDataWithMask(p_stCurrentNewMaskForLB->st_m_Mask->m_pub_fn_ulGetMaskValue(), p_stCurrentNewMaskForLB->st_m_MaskIsOn);
#ifndef CTL_WITH_NO_TUT
//////////////
//////////////
//UnRegisters for TUT Module
if ( (CTL_p_fn_bUnregisterControl != NULL) && (p_stCurrentNewMaskForLB->st_m_pclButton != NULL) )
CTL_p_fn_bUnregisterControl(p_stCurrentNewMaskForLB->st_m_pclButton->m_hWnd);
//End of UnRegisters for TUT Module
//////////////
#endif //CTL_WITH_NO_TUT
delete p_stCurrentNewMaskForLB;
}
m_pri_pclParentControl->m_fn_pclGetEditedData()->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
CDialog::OnOK();
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnCancel()
{
//Deletes buttons
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
struct m_pri_stMaskInListBox *p_stCurrentNewMaskForLB;
short wCurrentIndex = 0;
for (wCurrentIndex; wCurrentIndex < pclListBox->GetCount(); wCurrentIndex ++ )
{
p_stCurrentNewMaskForLB = (struct m_pri_stMaskInListBox *)pclListBox->GetItemDataPtr(wCurrentIndex);
#ifndef CTL_WITH_NO_TUT
//////////////
//////////////
//UnRegisters for TUT Module
if ( (CTL_p_fn_bUnregisterControl != NULL) && (p_stCurrentNewMaskForLB->st_m_pclButton != NULL) )
CTL_p_fn_bUnregisterControl(p_stCurrentNewMaskForLB->st_m_pclButton->m_hWnd);
//End of UnRegisters for TUT Module
//////////////
#endif //CTL_WITH_NO_TUT
delete p_stCurrentNewMaskForLB;
}
CDialog::OnCancel();
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ERROR_ASSERT( nIDCtl == IDC_LIST_MASKS );
if ( nIDCtl == IDC_LIST_MASKS )
{
ERROR_ASSERT( lpDrawItemStruct->CtlType == ODT_LISTBOX );
CDC *pclDC;
pclDC = pclDC->FromHandle(lpDrawItemStruct->hDC);
CRect crRect(lpDrawItemStruct->rcItem);
CFont *pclFont = GetFont();
pclDC->SelectObject(pclFont);
struct m_pri_stMaskInListBox *pclElement = (struct m_pri_stMaskInListBox *)lpDrawItemStruct->itemData;
if ( pclElement->st_m_pclButton == NULL )
{
//Creates the Check Button
pclElement->st_m_pclButton = new CButton;
CWnd *pclWnd;
pclWnd = pclWnd->FromHandle(lpDrawItemStruct->hwndItem);
pclElement->st_m_pclButton->Create( pclElement->st_m_Mask->m_pub_fn_csGetString(),
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
lpDrawItemStruct->rcItem,
pclWnd,
EdActors_C_FirstIDForListBoxCheckButtons + lpDrawItemStruct->itemID);
pclElement->st_m_pclButton->SetFont(pclFont);
//Initializes Button's state
pclElement->st_m_pclButton->SetCheck( pclElement->st_m_MaskIsOn );
#ifndef CTL_WITH_NO_TUT
//////////////
//////////////
//Registers for TUT Module
if ( CTL_p_fn_vRegisterControl != NULL )
CTL_p_fn_vRegisterControl(pclElement->st_m_pclButton->m_hWnd,
CString("CTL_MaskEditionDialog_CheckBox_") + pclElement->st_m_Mask->m_pub_fn_csGetString(), TUT_e_ListBox);
//End of Registers for TUT Module
//////////////
#endif //CTL_WITH_NO_TUT
}
}
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnButtonAllMasks()
{
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
struct m_pri_stMaskInListBox *p_stCurrentNewMaskForLB;
short wCurrentIndex = 0;
for (wCurrentIndex; wCurrentIndex < pclListBox->GetCount(); wCurrentIndex ++ )
{
p_stCurrentNewMaskForLB = (struct m_pri_stMaskInListBox *)pclListBox->GetItemDataPtr(wCurrentIndex);
p_stCurrentNewMaskForLB->st_m_MaskIsOn = TRUE;
if ( p_stCurrentNewMaskForLB->st_m_pclButton != NULL )
p_stCurrentNewMaskForLB->st_m_pclButton->SetCheck(p_stCurrentNewMaskForLB->st_m_MaskIsOn);
}
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnButtonNoMask()
{
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
struct m_pri_stMaskInListBox *p_stCurrentNewMaskForLB;
short wCurrentIndex = 0;
for (wCurrentIndex; wCurrentIndex < pclListBox->GetCount(); wCurrentIndex ++ )
{
p_stCurrentNewMaskForLB = (struct m_pri_stMaskInListBox *)pclListBox->GetItemDataPtr(wCurrentIndex);
p_stCurrentNewMaskForLB->st_m_MaskIsOn = FALSE;
if ( p_stCurrentNewMaskForLB->st_m_pclButton != NULL )
p_stCurrentNewMaskForLB->st_m_pclButton->SetCheck(p_stCurrentNewMaskForLB->st_m_MaskIsOn);
}
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::OnButtonInvertMasks()
{
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_MASKS);
struct m_pri_stMaskInListBox *p_stCurrentNewMaskForLB;
short wCurrentIndex = 0;
for (wCurrentIndex; wCurrentIndex < pclListBox->GetCount(); wCurrentIndex ++ )
{
p_stCurrentNewMaskForLB = (struct m_pri_stMaskInListBox *)pclListBox->GetItemDataPtr(wCurrentIndex);
p_stCurrentNewMaskForLB->st_m_MaskIsOn = !p_stCurrentNewMaskForLB->st_m_MaskIsOn;
if ( p_stCurrentNewMaskForLB->st_m_pclButton != NULL )
p_stCurrentNewMaskForLB->st_m_pclButton->SetCheck(p_stCurrentNewMaskForLB->st_m_MaskIsOn);
}
}
//***************************************************************************
BOOL CTL_DialogMaskedDataEdition::m_pri_fn_bDataHasThisMask(unsigned long _ulMaskValue)
{
//CPA2 Stegaru Cristian 98/06/26
unsigned long ulCurrentDataValue = ((CTL_Editor_MaskedData *)m_pri_pclParentControl->m_fn_pclGetEditedData())->mfn_ulGetCurrentValue ();
//End CPA2 Stegaru Cristian 98/06/26
return ( (ulCurrentDataValue & _ulMaskValue) != 0 );
}
//***************************************************************************
void CTL_DialogMaskedDataEdition::m_pri_fn_vSetDataWithMask(unsigned long _ulMaskValue, BOOL _bMaskOn)
{
//CPA2 Stegaru Cristian 98/06/26
unsigned long ulCurrentDataValue = ((CTL_Editor_MaskedData *)m_pri_pclParentControl->m_fn_pclGetEditedData())->mfn_ulGetCurrentValue ();
//End CPA2 Stegaru Cristian 98/06/26
if ( _bMaskOn )
{
if ( !m_pri_fn_bDataHasThisMask(_ulMaskValue) )
ulCurrentDataValue += _ulMaskValue;
}
else
{
if ( m_pri_fn_bDataHasThisMask(_ulMaskValue) )
ulCurrentDataValue -= _ulMaskValue;
}
//CPA2 Stegaru Cristian 98/06/26
((CTL_Editor_MaskedData *)m_pri_pclParentControl->m_fn_pclGetEditedData())->mfn_ulSetCurrentValue (ulCurrentDataValue);
//End CPA2 Stegaru Cristian 98/06/26
m_pri_pclParentControl->m_fn_pclGetEditedData()->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0);
}

View File

@@ -0,0 +1,66 @@
// ctl_aevw.cpp : implementation file
//
#include "stdafx.h"
//#include "CTL_Res.h"
#include "WControls\Ctl_vBas.hpp"
#include "dialogs\ctl_aevw.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CArrayElementsView
IMPLEMENT_DYNCREATE(CArrayElementsView, CFormView)
CArrayElementsView::CArrayElementsView()
: CTL_Editor_BaseFormView (CArrayElementsView::IDD, TRUE)
{
//{{AFX_DATA_INIT(CArrayElementsView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CArrayElementsView::~CArrayElementsView()
{
}
void CArrayElementsView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CArrayElementsView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CArrayElementsView, CFormView)
//{{AFX_MSG_MAP(CArrayElementsView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CArrayElementsView diagnostics
#ifdef _DEBUG
void CArrayElementsView::AssertValid() const
{
CFormView::AssertValid();
}
void CArrayElementsView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CArrayElementsView message handlers

View File

@@ -0,0 +1,223 @@
// Implementation for the definition of 'enum' type lists in the editor
//////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_EnLi.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//************************************************************************
CTL_Editor_EnumElement::CTL_Editor_EnumElement(CString _csElementName,
long _lEnumValue,
CString _csAdditionalString,
void *_p_vAdditionnalPointer)
{
m_pri_csElementName = _csElementName;
m_pri_lEnumValue = _lEnumValue;
m_pri_csAdditionalString = _csAdditionalString;
m_pri_p_vAdditionnalPointer = _p_vAdditionnalPointer;
}
//************************************************************************
CTL_Editor_EnumElement::~CTL_Editor_EnumElement()
{
}
//Value
//************************************************************************
void CTL_Editor_EnumElement::m_pub_fn_vSetValue(long lNewValue)
{
m_pri_lEnumValue = lNewValue;
}
//************************************************************************
long CTL_Editor_EnumElement::m_pub_fn_lGetValue()
{
return m_pri_lEnumValue;
}
//Element Name
//************************************************************************
void CTL_Editor_EnumElement::m_pub_fn_vSetElementName(CString _csNewString)
{
m_pri_csElementName = _csNewString;
}
//************************************************************************
CString CTL_Editor_EnumElement::m_pub_fn_csGetElementName()
{
return m_pri_csElementName;
}
//Additional String
//************************************************************************
void CTL_Editor_EnumElement::m_pub_fn_vSetAdditionalString(CString _csNewString)
{
m_pri_csAdditionalString = _csNewString;
}
//************************************************************************
CString CTL_Editor_EnumElement::m_pub_fn_csGetAdditionalString()
{
return m_pri_csAdditionalString;
}
//Additionnal Pointer
//************************************************************************
void CTL_Editor_EnumElement::m_pub_fn_vSetAdditionnalPointer(void *_p_vAdditionnalPointer)
{
m_pri_p_vAdditionnalPointer = _p_vAdditionnalPointer;
}
//************************************************************************
void *CTL_Editor_EnumElement::m_pub_fn_pvGetAdditionnalPointer()
{
return m_pri_p_vAdditionnalPointer;
}
//************************************************************************
//************************************************************************
//************************************************************************
CTL_Editor_EnumDescriptor::CTL_Editor_EnumDescriptor(CString csEnumName,
unsigned char ucSize)
{
m_csEnumName = csEnumName;
m_ucEnumSize = ucSize;
}
//************************************************************************
CTL_Editor_EnumDescriptor::~CTL_Editor_EnumDescriptor()
{
m_fn_vEmptyList();
}
//************************************************************************
void CTL_Editor_EnumDescriptor::m_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while ( pos != NULL )
delete GetNext(pos);
RemoveAll();
}
//************************************************************************
CTL_Editor_EnumElement *CTL_Editor_EnumDescriptor::m_fn_pclAddElement(CString _csElementName,
long _lEnumValue /*= LIST_ENUM_ERROR*/,
CString _csAdditionalString /*= ""*/,
void *_p_vAdditionnalPointer /*= NULL*/)
{
//Adds only if name is not found in list
if ( m_fn_pclGetElementFromString(_csElementName) == NULL )
{
CTL_Editor_EnumElement *pclNewElement = new CTL_Editor_EnumElement(_csElementName,
_lEnumValue,
_csAdditionalString,
_p_vAdditionnalPointer);
AddTail(pclNewElement);
return pclNewElement;
}
else
return NULL;
}
//************************************************************************
CString CTL_Editor_EnumDescriptor::m_fn_csGetStringFromEnumIndex(long lEnumIndex)
{
CTL_Editor_EnumElement *pclCurrentElement;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && !bFound )
{
pclCurrentElement = GetNext(pos);
bFound = ( pclCurrentElement->m_pub_fn_lGetValue() == lEnumIndex );
}
if ( bFound )
return (pclCurrentElement->m_pub_fn_csGetElementName());
else
return "*** E R R O R ***";
}
//************************************************************************
CTL_Editor_EnumElement *CTL_Editor_EnumDescriptor::m_fn_pclGetElementFromEnumIndex(long lEnumIndex)
{
CTL_Editor_EnumElement *pclCurrentElement;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && !bFound )
{
pclCurrentElement = GetNext(pos);
bFound = ( pclCurrentElement->m_pub_fn_lGetValue() == lEnumIndex );
}
if ( bFound )
return pclCurrentElement;
else
return NULL;
}
//************************************************************************
CTL_Editor_EnumElement *CTL_Editor_EnumDescriptor::m_fn_pclGetElementFromString(CString _csStringToFind)
{
CTL_Editor_EnumElement *pclCurrentElement;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && !bFound )
{
pclCurrentElement = GetNext(pos);
bFound = ( pclCurrentElement->m_pub_fn_csGetElementName().Compare(_csStringToFind) == 0 );
}
if ( bFound )
return pclCurrentElement;
else
return NULL;
}
//************************************************************************
unsigned char CTL_Editor_EnumDescriptor::m_fn_ucGetEnumSize()
{
return m_ucEnumSize;
}
//************************************************************************
//************************************************************************
//************************************************************************
CTL_Editor_EnumDescriptorList::CTL_Editor_EnumDescriptorList()
{
}
//************************************************************************
CTL_Editor_EnumDescriptorList::~CTL_Editor_EnumDescriptorList()
{
}
//************************************************************************
CTL_Editor_EnumDescriptor *CTL_Editor_EnumDescriptorList::m_fn_pclGetEnumDescriptorByName(CString csDescriptorName)
{
CTL_Editor_EnumDescriptor *pclCurrent;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && !bFound )
{
pclCurrent = GetNext(pos);
bFound = ( pclCurrent->m_csEnumName == csDescriptorName );
}
if ( bFound )
return pclCurrent;
else
return NULL;
}

View File

@@ -0,0 +1,141 @@
// Implementation for the list of Masks
//
// (used by Masked Data and Controls)
//
// Writen by YB
///////////////////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_Mask.hpp"
//######################################################################
//######################################################################
//######################################################################
//**********************************************************************
CTL_Editor_Mask::CTL_Editor_Mask(CString _csString,
unsigned long _ulValue)
{
m_pri_csString = _csString;
m_pri_ulMaskValue = _ulValue;
}
//**********************************************************************
CTL_Editor_Mask::~CTL_Editor_Mask()
{
}
//**********************************************************************
CString CTL_Editor_Mask::m_pub_fn_csGetString()
{
return m_pri_csString;
}
//**********************************************************************
unsigned long CTL_Editor_Mask::m_pub_fn_ulGetMaskValue()
{
return m_pri_ulMaskValue;
}
//######################################################################
//######################################################################
//######################################################################
//**********************************************************************
CTL_Editor_MaskDescriptor::CTL_Editor_MaskDescriptor(CString _csName)
{
m_pri_csName = _csName;
}
//**********************************************************************
CTL_Editor_MaskDescriptor::~CTL_Editor_MaskDescriptor()
{
m_pri_fn_vEmptyList();
}
//**********************************************************************
CString CTL_Editor_MaskDescriptor::m_pub_fn_csGetName()
{
return m_pri_csName;
}
//**********************************************************************
CTL_Editor_Mask *CTL_Editor_MaskDescriptor::m_pub_fn_pclAddMask(CString _csString,
unsigned long _ulValue)
{
CTL_Editor_Mask *pclNewMask = new CTL_Editor_Mask(_csString, _ulValue);
AddTail(pclNewMask);
return pclNewMask;
}
//**********************************************************************
void CTL_Editor_MaskDescriptor::m_pri_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while ( pos != NULL )
delete ( GetNext(pos) );
RemoveAll();
}
//######################################################################
//######################################################################
//######################################################################
//**********************************************************************
CTL_Editor_MaskList::CTL_Editor_MaskList()
{
}
//**********************************************************************
CTL_Editor_MaskList::~CTL_Editor_MaskList()
{
m_pub_fn_vEmptyList();
}
//**********************************************************************
CTL_Editor_MaskDescriptor *CTL_Editor_MaskList::m_pub_fn_pclAddMaskDescriptor(CString _csName)
{
CTL_Editor_MaskDescriptor *pclNewMaskDesc = new CTL_Editor_MaskDescriptor(_csName);
AddTail(pclNewMaskDesc);
return pclNewMaskDesc;
}
//**********************************************************************
void CTL_Editor_MaskList::m_pub_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while ( pos != NULL )
delete ( GetNext(pos) );
RemoveAll();
}
//************************************************************************
CTL_Editor_MaskDescriptor *CTL_Editor_MaskList::m_fn_pclGetMaskDescriptorByName(CString _csDescriptorName)
{
CTL_Editor_MaskDescriptor *pclCurrent;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && !bFound )
{
pclCurrent = GetNext(pos);
bFound = ( pclCurrent->m_pub_fn_csGetName().CompareNoCase(_csDescriptorName) == 0 );
}
if ( bFound )
return pclCurrent;
else
return NULL;
}

View File

@@ -0,0 +1,163 @@
// Definitions for the classes to handle lists of Owner Data
//
// YB
///////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_ODat.hpp"
//External Modules
#include "CTL_ErO.hpp"
//End of External Modules
//#############################################################
//#############################################################
//#############################################################
//*********************************************************************************
CTL_OwnerData::CTL_OwnerData(void *_pvDataPtr,
CString _csName)
{
m_pri_pvDataPtr = _pvDataPtr;
m_pri_csName = _csName;
m_pri_tdeType = CTL_OWNER_DATA_TYPE_POINTER;
m_pri_lData = 0;
}
//*********************************************************************************
CTL_OwnerData::CTL_OwnerData(long _lData,
CString _csName)
{
m_pri_lData = _lData;
m_pri_csName = _csName;
m_pri_tdeType = CTL_OWNER_DATA_TYPE_LONG;
m_pri_pvDataPtr = NULL;
}
//*********************************************************************************
CTL_OwnerData::~CTL_OwnerData()
{
}
//*********************************************************************************
CString CTL_OwnerData::m_pub_fn_csGetName()
{
return m_pri_csName;
}
//*********************************************************************************
void *CTL_OwnerData::m_pub_fn_pvGetDataPtr()
{
//ANNECY CB
// ERROR_ASSERT( m_pri_tdeType == CTL_OWNER_DATA_TYPE_POINTER );
//END
return m_pri_pvDataPtr;
}
//*********************************************************************************
void CTL_OwnerData::m_pub_fn_vSetDataPtr(void *_pvDataPtr)
{
m_pri_pvDataPtr = _pvDataPtr;
}
//*********************************************************************************
long CTL_OwnerData::m_pub_fn_lGetData()
{
//ANNECY CB
// ERROR_ASSERT( m_pri_tdeType == CTL_OWNER_DATA_TYPE_LONG );
//END
return m_pri_lData;
}
//*********************************************************************************
void CTL_OwnerData::m_pub_fn_vSetData(long _lData)
{
m_pri_lData = _lData;
}
//#############################################################
//#############################################################
//#############################################################
//*********************************************************************************
CTL_ListOfOwnerData::CTL_ListOfOwnerData()
{
}
//*********************************************************************************
CTL_ListOfOwnerData::~CTL_ListOfOwnerData()
{
m_pub_fn_vEmptyListAndDestroyElements();
}
//*********************************************************************************
void CTL_ListOfOwnerData::m_pub_fn_vAddOwnerData(CTL_OwnerData *_pclNewOwnerData)
{
}
//*********************************************************************************
CTL_OwnerData *CTL_ListOfOwnerData::m_pub_fn_pclAddOwnerData(void *_pvDataPtr,
CString _csName)
{
CTL_OwnerData *pclNewOD = new CTL_OwnerData(_pvDataPtr, _csName);
AddTail(pclNewOD);
return pclNewOD;
}
//*********************************************************************************
CTL_OwnerData *CTL_ListOfOwnerData::m_pub_fn_pclAddOwnerData(long _lData,
CString _csName)
{
CTL_OwnerData *pclNewOD = new CTL_OwnerData(_lData, _csName);;
AddTail(pclNewOD);
return pclNewOD;
}
//*********************************************************************************
void CTL_ListOfOwnerData::m_pub_fn_vEmptyListAndDestroyElements()
{
POSITION pos = GetHeadPosition();
while ( pos != NULL )
delete ( GetNext(pos) );
RemoveAll();
}
//*********************************************************************************
void CTL_ListOfOwnerData::m_pub_fn_vEmptyListWithoutDestroyingElements()
{
RemoveAll();
}
//*********************************************************************************
CTL_OwnerData *CTL_ListOfOwnerData::m_pub_fn_pclFindOwnerDataWithName(CString _csSearchedName)
{
CTL_OwnerData *pclCurrentOD;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
pclCurrentOD = GetNext(pos);
bFound = ( pclCurrentOD->m_pub_fn_csGetName().Compare(_csSearchedName) == 0 );
}
if ( bFound )
return pclCurrentOD;
else
return NULL;
}

View File

@@ -0,0 +1,203 @@
// Global private functions
//
// YB
//////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_Pri.hpp"
#include "Controls\CTL_BCtl.hpp"
#include "Controls\CTL_Ctl.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
//------------------------------------------------------------------------
// Global vars
CString CTL_g_csModuleNameForErO;
//Module
HMODULE CTL_g_hModule = 0;
//Cursors for BaseFormView class
HCURSOR CTL_g_hcursor_CloseHand;
HCURSOR CTL_g_hcursor_UpDownHand;
#ifndef CTL_WITH_NO_TUT
//The TUT Dll Functions
CTL_td_p_fn_vRegisterControl CTL_p_fn_vRegisterControl = NULL;
CTL_td_p_fn_bUnregisterControl CTL_p_fn_bUnregisterControl = NULL;
//For TUT Module
CString CTL_g_csCurrentTAG;
CString CTL_g_csCurrentSecondaryInfo;
#endif //CTL_WITH_NO_TUT
// End of Global vars
//------------------------------------------------------------------------
//******************************************************************************
void CTL_fn_vInternalInitModule()
{
//Computes version String
CTL_g_csVersion = "2.0.3 [" + CString(__DATE__) + " (using TUT)]";
//Registers Module for ErO
CTL_g_csModuleNameForErO = "Data / Controls DLL";
ERROR_g_fn_vAddAModuleDescriptor( CTL_g_csModuleNameForErO,
CTL_g_csVersion,
"Yves BABITCH",
"01 48 18 53 32 (Montreuil)",
"ybabitch@ubisoft.fr",
"Daniel PALIX",
"04 50 51 26 63 (Annecy)",
"dpalix@ubisoft.fr",
"","",""
);
}
//******************************************************************************
long CTL_fn_lComputeSizeOfStaticForName(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
CTL_Editor_Control *pclControl = _pclSenderBaseControl->m_pub_fn_pclGetParentControl();
ERROR_ASSERT( pclControl != NULL );
CString csTextToDisplay = pclControl->m_pub_fn_csGetControlName();
CClientDC dc(_pclSenderBaseControl->m_fn_pclGetWnd());
dc.SelectObject(_pclSenderBaseControl->m_fn_pclGetWnd()->GetFont());
return ( dc.GetTextExtent(csTextToDisplay).cx + 6 );
}
#ifndef CTL_WITH_NO_TUT
//******************************************************************************
BOOL CTL_fn_bGetTUT_DLLFunctions()
{
if ( CTL_p_fn_vRegisterControl == NULL )
{
//Gets Module
#ifdef _DEBUG
HMODULE hTUTModule = (HMODULE)LoadLibrary("Edt_Data\\Tools\\TUTDFEvd.dll");
#else
HMODULE hTUTModule = (HMODULE)LoadLibrary("Edt_Data\\Tools\\TUTDFEvr.dll");
#endif //_DEBUG_
if ( hTUTModule != NULL )
{
//Gets functions
FARPROC Function = GetProcAddress(hTUTModule, "fn_vRegisterControl");
CTL_p_fn_vRegisterControl = (CTL_td_p_fn_vRegisterControl)Function;
if ( CTL_p_fn_bUnregisterControl == NULL )
{
Function = GetProcAddress(hTUTModule, "fn_bUnregisterControl");
CTL_p_fn_bUnregisterControl = (CTL_td_p_fn_bUnregisterControl)Function;
}
}
}
return ( (CTL_p_fn_vRegisterControl != NULL) && (CTL_p_fn_bUnregisterControl != NULL) );
}
#endif //CTL_WITH_NO_TUT
//**************************************************************************
void CTL_fn_vSetMemoryForFloat(void *pvDest,
long double ldfSourceValue,
char cDataLength)
{
//ANNECY CB
#if 0
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Seting memory to update a motor data",
"CTL_fn_vSetMemoryForFloat(...)",
E_ERROR_GRAVITY_INSTABLE,
"The destination is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvDest != NULL );
#endif
//END
if ( pvDest != NULL )
{
switch ( cDataLength )
{
case sizeof(float)/*FLOAT*/ :
{
float fTempValue = (float)ldfSourceValue;
memcpy(pvDest, &fTempValue, sizeof(float));
}
break;
/* case DOUBLE :
{
double dfTempValue = (double)ldfSourceValue;
memcpy(pvDest, &dfTempValue, sizeof(double));
}
break;
case LONG_DOUBLE :
{
long double ldfTempValue = (long double)ldfSourceValue;
memcpy(pvDest, &ldfTempValue, sizeof(long double));
}
break;
*/
}
}
}
//**************************************************************************
void CTL_fn_vGetMemoryForFloat(void *pvSource,
long double &r_ldfEditorValue,
char cDataLength)
{
//ANNECY CB
#if 0
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Seting memory to update a motor data",
"CTL_fn_vGetMemoryForFloat(...)",
E_ERROR_GRAVITY_INSTABLE,
"The source is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvSource != NULL );
#endif
//END
if ( pvSource != NULL )
{
switch ( cDataLength )
{
case sizeof(float) :
{
float fTempValue;
memcpy(&fTempValue, pvSource, sizeof(float));
r_ldfEditorValue = fTempValue;
}
break;
/* case DOUBLE :
{
double dfTempValue;
memcpy(&dfTempValue, pvSource, sizeof(double));
r_ldfEditorValue = dfTempValue;
}
break;
case LONG_DOUBLE :
{
long double ldfTempValue;
memcpy(&ldfTempValue, pvSource, sizeof(long double));
r_ldfEditorValue = ldfTempValue;
}
break;
*/
default:
ERROR_ASSERT( FALSE );
}
}
}

View File

@@ -0,0 +1,190 @@
// Global public functions
//
// YB
//////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "CTL_ErO.hpp"
//End of External Modules
long CTL_g_lCurrentId = 10000;
CString CTL_g_csVersion;
CTL_td_p_fn_bControlCanBeDisplayed CTL_g_p_fnDefaultCallBack_ControlCanBeDisplayed = NULL;
CTL_td_p_fn_vCallBackWhenDataHasChanged CTL_g_p_fnDefaultCallBack_DataHasChanged = NULL;
CTL_td_p_fn_vStaticHasBeenClicked CTL_g_p_fnDefaultCallBack_StaticHasBeenClicked = NULL;
CTL_tdp_fn_vGetColor CTL_g_p_fnDefaultCallBack_GetColor = NULL;
#ifndef CTL_WITH_NO_TUT
//For TUT Module
extern CString CTL_g_csCurrentTAG;
extern CString CTL_g_csCurrentSecondaryInfo;
#endif //CTL_WITH_NO_TUT
//******************************************************************************
void CTL_fn_vSetDefaultCallBackFunctionWhenControlMustBeDisplayed(CTL_td_p_fn_bControlCanBeDisplayed _p_fnCallBack)
{
CTL_g_p_fnDefaultCallBack_ControlCanBeDisplayed = _p_fnCallBack;
}
//******************************************************************************
void CTL_fn_vSetDefaultCallBackFunctionWhenDataHasChanged(CTL_td_p_fn_vCallBackWhenDataHasChanged _p_fnCallBack)
{
CTL_g_p_fnDefaultCallBack_DataHasChanged = _p_fnCallBack;
}
//******************************************************************************
void CTL_fn_vSetDefaultCallBackFunctionWhenStaticIsClicked(CTL_td_p_fn_vStaticHasBeenClicked _p_fnDefaultCallBack_StaticHasBeenClicked)
{
CTL_g_p_fnDefaultCallBack_StaticHasBeenClicked = _p_fnDefaultCallBack_StaticHasBeenClicked;
}
//******************************************************************************
void CTL_fn_vSetDefaultCallBackFunctionToGetStaticColor(CTL_tdp_fn_vGetColor _p_fnDefaultCallBack_StaticColor)
{
CTL_g_p_fnDefaultCallBack_GetColor = _p_fnDefaultCallBack_StaticColor;
}
//******************************************************************************
CString CTL_fn_csGetVersion()
{
return CTL_g_csVersion;
}
//******************************************************************************
void CTL_fn_vSetModuleInfo(CString _csTAG,
CString _csSecondaryInfo)
{
#ifndef CTL_WITH_NO_TUT
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Setting Module info for controls registration (TUT)",
"CTL_fn_csSetModuleInfo(...)",
E_ERROR_GRAVITY_INSTABLE,
"You are going to overwrite the actual Module name ! Please call 'CTL_fn_vResetModuleInfo()'");
ERROR_ASSERT( CTL_g_csCurrentTAG.IsEmpty() );
CTL_g_csCurrentTAG = _csTAG;
CTL_g_csCurrentSecondaryInfo = _csSecondaryInfo;
#endif //CTL_WITH_NO_TUT
}
//******************************************************************************
void CTL_fn_vResetModuleInfo()
{
#ifndef CTL_WITH_NO_TUT
CTL_g_csCurrentTAG = "";
CTL_g_csCurrentSecondaryInfo = "";
#endif //CTL_WITH_NO_TUT
}
//******************************************************************************
CString CTL_fn_csGetCurrentTAG()
{
#ifndef CTL_WITH_NO_TUT
return CTL_g_csCurrentTAG;
#endif //CTL_WITH_NO_TUT
return "<< CTL is not using TUT ! >>";
}
//******************************************************************************
CString CTL_fn_csGetCurrentSecondaryInfo()
{
#ifndef CTL_WITH_NO_TUT
return CTL_g_csCurrentSecondaryInfo;
#endif //CTL_WITH_NO_TUT
return "<< CTL is not using TUT ! >>";
}
//**************************************************************************
void CTL_fn_vSetMemory(void *pvDest,
void *pvSource,
char cDataLength)
{
//ANNECY CB
#if 0
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Seting memory to update a motor data",
"CTL_fn_vSetMemory(...)",
E_ERROR_GRAVITY_INSTABLE,
"The source is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvSource != NULL );
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Seting memory to update a motor data",
"CTL_fn_vSetMemory(...)",
E_ERROR_GRAVITY_INSTABLE,
"The destination is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvDest != NULL );
#endif
//END
if ( (pvSource != NULL) && (pvDest != NULL) )
{
if (cDataLength == 0)
{
*((char *)pvDest) &=0xf0;
*((char *)pvDest) |= *((char *)pvSource);
}
else
memcpy(pvDest, pvSource, cDataLength);
}
}
//**************************************************************************
void CTL_fn_vGetMemory(void *pvSource,
void *pvDest,
char cDataLength)
{
//ANNECY CB
#if 0
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Geting memory to update a motor data",
"CTL_fn_vGetMemory(...)",
E_ERROR_GRAVITY_INSTABLE,
"The source is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvSource != NULL );
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Geting memory to update a motor data",
"CTL_fn_vGetMemory(...)",
E_ERROR_GRAVITY_INSTABLE,
"The destination is not a valid pointer : memory has not been updated");
ERROR_ASSERT( pvDest != NULL );
#endif
//END
if ( (pvSource != NULL) && (pvDest != NULL) )
{
if (cDataLength == 0)
{
memcpy(pvDest, pvSource, 1);
*((char *)pvDest) &= 0x0f;
}
else
memcpy(pvDest, pvSource, cDataLength);
}
}
//****************************************************************************
//Returns 'CTL_g_lCurrentId', and adds one to it
//.... Will be improved in future versions ....
long CTL_fn_lGetNextAvailableIDForControl()
{
CTL_g_lCurrentId ++;
return (CTL_g_lCurrentId - 1);
}
//****************************************************************************
//Returns the last returned ID
long CPA_EXPORT CTL_fn_lGetCurrentIDForControl()
{
return (CTL_g_lCurrentId - 1);
}

View File

@@ -0,0 +1,88 @@
// Implementation for the class CMyDocument
//
// YB
//
/////////////////////////////////////////////
#include "StdAfx.h"
#include "Others\CTL_TTT.hpp"
//==================================================================================================
//==================================================================================================
tdoTTTData &CTL_ToolTipTextDatabase::operator [](unsigned int uiControlId)
{
POSITION xPos;
tdoTTTData *p_stData;
//look in the list for an existing association
xPos = m_oDataList.GetHeadPosition();
while ( xPos && (p_stData = m_oDataList.GetNext(xPos)) )
if ( p_stData->m_uiId() == uiControlId )
return *p_stData;
//none were found, add a dummy one
p_stData = new tdoTTTData();
p_stData->m_roSet(""); //bbb 17/03/97
p_stData->m_uiId(uiControlId); //bbb 17/03/97
m_oDataList.AddTail(p_stData);
return *p_stData;
}
//==================================================================================================
CTL_ToolTipTextDatabase::~CTL_ToolTipTextDatabase()
{
while ( !m_oDataList.IsEmpty() )
{
tdoTTTData *p_stData = m_oDataList.GetHead();
m_oDataList.RemoveHead();
delete p_stData;
}
}
//==================================================================================================
//==================================================================================================
tdoTTTData::~tdoTTTData()
{ //bbb 17/03/97 tout dedans
m_uiId(-1);
if ( m_pszModelText )
free((void *) m_pszModelText);
if ( m_pszInstanceText )
free((void *) m_pszInstanceText);
}
//==================================================================================================
tdoTTTData::tdoTTTData()
{
m_uiId(-1); //bbb 17/03/97
m_pszModelText = m_pszInstanceText = NULL; //bbb 17/03/97
}
//==================================================================================================
tdoTTTData &tdoTTTData::m_roSet(char *_pszModelText, char *_pszInstanceText)
{ //bbb 17/03/97 tout dedans
ASSERT(_pszModelText);
if ( m_pszModelText )
free((void *) m_pszModelText);
if ( m_pszInstanceText )
free((void *) m_pszInstanceText);
m_pszModelText = strdup(_pszModelText);
m_pszInstanceText = strdup(_pszInstanceText ? _pszInstanceText : _pszModelText);
return *this;
}
//==================================================================================================
const char *tdoTTTData::operator [](BOOL bIsAModel)
{ //bbb 17/03/97 tout dedans
return bIsAModel
? m_pszModelText
: m_pszInstanceText;
}

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// Err.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,154 @@
// Base Windows Control for CTL
//
// YB
////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_BWC.hpp"
#include "Others\CTL_Pri.hpp"
#include "Others\CTL_Pub.hpp"
#include "Controls\CTL_Ctl.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
//***************************************************************************
CTL_BaseWindowsControl::CTL_BaseWindowsControl(CTL_Editor_Control *_pclParentControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
{
m_pri_pclParentControl = _pclParentControl;
m_pri_pclParentWnd = _pclParentWnd;
m_pri_lUserDefinedType = _lUserDefinedType;
m_pri_lUserDefinedCode = _lUserDefinedCode;
m_pri_pclWnd = NULL;
}
//***************************************************************************
CTL_BaseWindowsControl::~CTL_BaseWindowsControl()
{
#ifndef CTL_WITH_NO_TUT
if ( CTL_p_fn_bUnregisterControl != NULL )
{
if ( m_pri_pclWnd != NULL )
CTL_p_fn_bUnregisterControl(m_pri_pclWnd->m_hWnd);
}
/* else
{
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Trying to unregister a control from TUT Module",
"CTL_BaseWindowsControl::~CTL_BaseWindowsControl()",
E_ERROR_GRAVITY_INSTABLE,
"Function not found : the TUT DLL is probably not present in ""Edt_Data\\Tools"" directory");
ERROR_ASSERT( FALSE );
}*/
#endif //CTL_WITH_NO_TUT
}
//***************************************************************************
long CTL_BaseWindowsControl::m_pub_fn_lGetUserDefinedType()
{
return m_pri_lUserDefinedType;
}
//***************************************************************************
long CTL_BaseWindowsControl::m_pub_fn_lGetUserDefinedCode()
{
return m_pri_lUserDefinedCode;
}
//***************************************************************************
CTL_Editor_Control *CTL_BaseWindowsControl::m_pub_fn_pclGetParentControl()
{
return m_pri_pclParentControl;
}
//***************************************************************************
CWnd *CTL_BaseWindowsControl::m_pub_fn_pclGetParentWnd()
{
return m_pri_pclParentWnd;
}
#ifndef CTL_WITH_NO_TUT
//***************************************************************************
//For TUT registration
void CTL_BaseWindowsControl::m_pro_fn_vRegisterWindowsControl(CString _csAdditionnalInfo,
enum TUT_eControlType_ _eType,
CString _csControlString,
CWnd *_pclWnd)
{
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Trying to register a control for TUT Module",
"CTL_BaseWindowsControl::m_pub_fn_vRegisterWindowsControl(...)",
E_ERROR_GRAVITY_INSTABLE,
"An additonnal information should be stored in TUT's control name...");
ERROR_ASSERT( !_csAdditionnalInfo.IsEmpty() );
m_pri_pclWnd = _pclWnd;
m_pri_fn_vBuildNameForTUT(_csAdditionnalInfo, _eType, _csControlString, _pclWnd);
}
#endif //CTL_WITH_NO_TUT
//***************************************************************************
// Private Functions
//***************************************************************************
#ifndef CTL_WITH_NO_TUT
//***************************************************************************
void CTL_BaseWindowsControl::m_pri_fn_vBuildNameForTUT(CString _csAdditionnalInfo,
enum TUT_eControlType_ _eType,
CString _csControlString,
CWnd *_pclWnd)
{
/* ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
"Trying to register a control for TUT Module",
"CTL_BaseWindowsControl::m_pri_fn_vBuildNameForTUT()",
E_ERROR_GRAVITY_INSTABLE,
"Function not found : the TUT DLL is probably not present in ""Edt_Data\\Tools"" directory");
ERROR_CHECK( CTL_fn_bGetTUT_DLLFunctions() );*/
if ( CTL_p_fn_vRegisterControl == NULL )
CTL_fn_bGetTUT_DLLFunctions();
if ( CTL_p_fn_vRegisterControl != NULL )
{
const CString c_csSeparator = " - ";
CString csTUTName;
//Adds TAG
if ( CTL_g_csCurrentTAG.IsEmpty() )
csTUTName = CString("CTL alone");
else
csTUTName = CString("CTL > ") + CTL_g_csCurrentTAG;
//Adds Secondary Info
if ( !CTL_g_csCurrentSecondaryInfo.IsEmpty() )
csTUTName += c_csSeparator + CTL_g_csCurrentSecondaryInfo;
//Adds additionnal Info
if ( !_csAdditionnalInfo.IsEmpty() )
csTUTName += c_csSeparator + _csAdditionnalInfo;
//Adds control type
if ( !_csControlString.IsEmpty() )
csTUTName += c_csSeparator + _csControlString;
//To ensure name's unicity : adds the ID
//CString csID;
//csID.Format("%i", CTL_fn_lGetCurrentIDForControl());
//csTUTName += (c_csSeparator + csID);
//Registers in TUT
CTL_p_fn_vRegisterControl(_pclWnd->m_hWnd,
csTUTName,
_eType);
}
}
#endif //CTL_WITH_NO_TUT

View File

@@ -0,0 +1,330 @@
// Implementation of the CTL_Editor_BaseFormView class
///////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_VBas.hpp"
#include "Controls\CTL_Cnst.hpp"
#include "Others\CTL_Pri.hpp"
#include "CTL_Res.h"
//For Init
static BOOL s_g_pri_bBaseViewInitDone = FALSE;;
//Screen Height
static unsigned short s_g_uwScreenHeight;
//#define _CTL_BASE_VIEW_ACCELERATION_
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_BaseFormView
IMPLEMENT_DYNCREATE(CTL_Editor_BaseFormView, CFormView)
BEGIN_MESSAGE_MAP(CTL_Editor_BaseFormView, CFormView)
//{{AFX_MSG_MAP(CTL_Editor_BaseFormView)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_BaseFormView construction/destruction
//***************************************************************************
CTL_Editor_BaseFormView::CTL_Editor_BaseFormView( UINT Id,
BOOL bMustDisplayClosedHand )
: CFormView( Id )
{
m_bMustDisplayClosedHand = bMustDisplayClosedHand;
m_bUserWantsToScroll = FALSE;
if ( !s_g_pri_bBaseViewInitDone )
{
//Gets screen's height
HDC hdc;
hdc = ::GetWindowDC(NULL);
s_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
::ReleaseDC(NULL,hdc);
//Loads Cursors
HINSTANCE hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(CTL_g_hModule);
CTL_g_hcursor_CloseHand = AfxGetApp()->LoadCursor(IDC_CURSOR_CLOSED_HAND);
CTL_g_hcursor_UpDownHand = AfxGetApp()->LoadCursor(IDC_CURSOR_UP_DOWN_HAND);
AfxSetResourceHandle(hOldInstance);
//Ints are now done
s_g_pri_bBaseViewInitDone = TRUE;
}
}
//***************************************************************************
//***************************************************************************
// SHOULD NOT BE USED //
//***************************************************************************
//***************************************************************************
CTL_Editor_BaseFormView::CTL_Editor_BaseFormView()
: CFormView(-1)
{
}
//***************************************************************************
CTL_Editor_BaseFormView::~CTL_Editor_BaseFormView()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_BaseFormView public functions
//***************************************************************************
void CTL_Editor_BaseFormView::m_fn_vSetViewHeight(unsigned short uwViewHeight)
{
m_uwViewHeight = uwViewHeight;
unsigned short uwScrollBarHeight = GetSystemMetrics(SM_CYHSCROLL);
//Protection...
//ANNECY CB
// short wXSize = m_uwWindowWidth - 5;
short wXSize = m_uwWindowWidth - 5 - GetSystemMetrics(SM_CXVSCROLL);
//END ANNECY
SetScrollSizes(MM_TEXT, CSize(max(0, wXSize), max(0, m_uwViewHeight /*- uwScrollBarHeight*/)));
if ( m_uwViewHeight > m_uwWindowHeight )
m_bScrollIsPossible = TRUE;
else
m_bScrollIsPossible = FALSE;
//Supresses the scroll bar
if ( m_bScrollIsPossible )
{
//ANNECY CB
// EnableScrollBarCtrl(SB_VERT, FALSE);
//END ANNECY
EnableScrollBarCtrl(SB_HORZ, FALSE);
::SetClassLong(m_hWnd, GCL_HCURSOR, 0L);
}
else
::SetClassLong(m_hWnd, GCL_HCURSOR, m_lInitialClassLong);
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_BaseFormView private functions
//***************************************************************************
void CTL_Editor_BaseFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
m_uwViewHeight = 0;
CRect crWindowRect;
GetClientRect(crWindowRect);
m_uwWindowHeight = crWindowRect.Height();
m_uwWindowWidth = crWindowRect.Width();
m_bScrollIsPossible = FALSE;
//To avoid cursor flashing
m_lInitialClassLong = ::GetClassLong(m_hWnd, GCL_HCURSOR);
}
//*******************************************************************************
void CTL_Editor_BaseFormView::OnMouseMove(UINT nFlags, CPoint point)
{
//Remove comments if acceleration is wanted...
#ifdef _CTL_BASE_VIEW_ACCELERATION_
static const short cs_wAcceleration = 1;
static const short cs_wMaxCounterForAccel = 5;
static const short cs_wInitialAddValue = 2;
static short s_wCounterForAccel = 0;
static short s_wCurrentAddValue = cs_wInitialAddValue;
static BOOL s_bWasGoingUp = FALSE;
if ( m_bScrollIsPossible )
{
if ( nFlags & MK_LBUTTON )
{
CPoint cpScrollPos = GetScrollPosition();
if ( point.y - s_cpOldPoint.y < 0 )
{
if ( !s_bWasGoingUp )
{
s_wCounterForAccel = 0;
s_wCurrentAddValue = cs_wInitialAddValue;
}
SetCursor(g_hcursor_UpHand);
cpScrollPos.y += s_wCurrentAddValue;
s_bWasGoingUp = TRUE;
}
else if ( point.y - s_cpOldPoint.y > 0 )
{
if ( s_bWasGoingUp )
{
s_wCounterForAccel = 0;
s_wCurrentAddValue = cs_wInitialAddValue;
}
SetCursor(g_hcursor_DownHand);
cpScrollPos.y -= s_wCurrentAddValue;
s_bWasGoingUp = FALSE;
}
else
SetCursor(g_hcursor_CloseHand);
s_wCounterForAccel++;
if ( s_wCounterForAccel >= cs_wMaxCounterForAccel )
{
s_wCounterForAccel = 0;
s_wCurrentAddValue += cs_wAcceleration;
}
ScrollToPosition(cpScrollPos);
}
else
{
SetCursor(g_hcursor_CloseHand);
s_wCounterForAccel = 0;
s_wCurrentAddValue = cs_wInitialAddValue;
}
}
#endif //_CTL_BASE_VIEW_ACCELERATION_
CPoint cpScreenPos = point;
ClientToScreen(&cpScreenPos);
if ( m_bScrollIsPossible )
{
if ( nFlags & MK_LBUTTON )
{
//If window must scroll
if ( m_bUserWantsToScroll )
{
//For Up and Down exits
if ( cpScreenPos.y == 0 )
{
SetCursorPos(cpScreenPos.x, s_g_uwScreenHeight-2);
cpScreenPos.y = m_uwOldPosition = s_g_uwScreenHeight-2;
}
if ( cpScreenPos.y == (s_g_uwScreenHeight-1) )
{
SetCursorPos(cpScreenPos.x, 1);
cpScreenPos.y = m_uwOldPosition = 1;
}
//Scrolls
CPoint cpScrollPos = GetScrollPosition();
cpScrollPos.y -= (cpScreenPos.y - m_uwOldPosition);
ScrollToPosition(cpScrollPos);
//Forces Repaint
MSG message;
while ( ::PeekMessage(&message, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) )
::DispatchMessage(&message);
}
}
//Displays the closed hand to see where you can scroll
else if ( m_bMustDisplayClosedHand )
SetCursor(CTL_g_hcursor_CloseHand);
}
else
CFormView::OnMouseMove(nFlags, point);
m_uwOldPosition = (unsigned short)cpScreenPos.y ;
}
//*******************************************************************************
void CTL_Editor_BaseFormView::OnLButtonDown(UINT nFlags, CPoint point)
{
if ( m_bScrollIsPossible )
{
SetCapture();
SetCursor(CTL_g_hcursor_UpDownHand);
m_bUserWantsToScroll = TRUE;
ClientToScreen(&point);
m_uwOldPosition = (unsigned short)point.y;
}
CFormView::OnLButtonDown(nFlags, point);
}
//*******************************************************************************
void CTL_Editor_BaseFormView::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
m_bUserWantsToScroll = FALSE;
CFormView::OnLButtonUp(nFlags, point);
}
//*******************************************************************************
void CTL_Editor_BaseFormView::OnSize(UINT nType, int cx, int cy)
{
m_uwWindowHeight = cy;
//Looks if scroll is possible
if ( m_uwViewHeight > m_uwWindowHeight )
m_bScrollIsPossible = TRUE;
else
m_bScrollIsPossible = FALSE;
//Supresses the scroll bar
if ( m_bScrollIsPossible )
{
//ANNECY CB
// EnableScrollBarCtrl(SB_VERT, FALSE);
//END ANNECY
EnableScrollBarCtrl(SB_HORZ, FALSE);
::SetClassLong(m_hWnd, GCL_HCURSOR, 0L);
}
else
::SetClassLong(m_hWnd, GCL_HCURSOR, m_lInitialClassLong);
CFormView::OnSize(nType, cx, cy);
}
//*******************************************************************************
//*******************************************************************************
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_BaseFormView diagnostics
#ifdef _DEBUG
void CTL_Editor_BaseFormView::AssertValid() const
{
CFormView::AssertValid();
}
void CTL_Editor_BaseFormView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG

View File

@@ -0,0 +1,107 @@
// CPACEdBu.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_WBut.hpp"
#include "Controls\CTL_Ctl.hpp"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Button
BEGIN_MESSAGE_MAP(CTL_Editor_Button, CButton)
//{{AFX_MSG_MAP(CTL_Editor_Button)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**********************************************************************************
CTL_Editor_Button::CTL_Editor_Button(CString _csName,
CTL_tdeButtonType _tdeType,
long _lAdditionnalStyles,
CTL_Editor_Control *_pclParentControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclParentControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_tdeType = _tdeType;
DWORD dwStyle = WS_CHILD;
dwStyle |= _lAdditionnalStyles;
if ( Create(_csName,
dwStyle,
CRect(0,0,0,0),
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack = NULL;
}
//**********************************************************************************
CTL_Editor_Button::~CTL_Editor_Button()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Button message handlers
//**********************************************************************************
void CTL_Editor_Button::m_pub_fn_vSetButtonHasBeenClicked_CallBack(CTL_tdp_fn_vButtonHasBeenClicked _p_fn_vCallBack)
{
ERROR_ASSERT( m_pri_td_p_fn_vButtonHasBeenClicked_CallBack == NULL );
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack = _p_fn_vCallBack;
}
//**********************************************************************************
void CTL_Editor_Button::OnClicked()
{
switch (m_tdeType)
{
case CTL_BUTTON_TYPE__EDIT:
if ( m_pub_fn_pclGetParentControl() != NULL )
m_pub_fn_pclGetParentControl()->m_fn_vEditData();
break;
}
//Calls CallBack
if ( m_pri_td_p_fn_vButtonHasBeenClicked_CallBack != NULL )
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack(this,
m_pub_fn_pclGetParentControl(),
m_tdeType,
m_pub_fn_lGetUserDefinedType(),
m_pub_fn_lGetUserDefinedCode());
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_Button::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Button, "Button", this);
#endif //CTL_WITH_NO_TUT
}

View File

@@ -0,0 +1,165 @@
// CPACLstB.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_WCBx.hpp"
#include "Controls\CTL_CtlE.hpp"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
#include "Others\CTL_EnLi.hpp"
#include "Data\CTL_DatE.hpp"
#include "Controls\CTL_CtlE.hpp"
//ENDROMTEAM Selection (Cristian Stegaru)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_ComboBox
BEGIN_MESSAGE_MAP(CTL_Editor_ComboBox, CComboBox)
//{{AFX_MSG_MAP(CTL_Editor_ComboBox)
ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CTL_Editor_ComboBox::CTL_Editor_ComboBox(CTL_tdeComboBoxType _eType,
long _lAdditionnalStyles,
CTL_Editor_Control *_pclControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_pri_eType = _eType;
//Creates control
DWORD lStyles = WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL;
lStyles |= _lAdditionnalStyles;
CRect crBidonRect(0,0,10,200);
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
//Sets the font
SetFont(_pclParentWnd->GetFont());
}
m_pri_p_td_fn_vSelChanged_CallBack = NULL;
m_pri_p_td_fn_vDropDown_CallBack = NULL;
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
m_iOldSelection = CB_ERR;
m_pfCanISelectThisItem = NULL;
//ENDROMTEAM Selection (Cristian Stegaru)
}
//***************************************************************************
CTL_Editor_ComboBox::~CTL_Editor_ComboBox()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_ComboBox message handlers
//***************************************************************************
void CTL_Editor_ComboBox::m_pub_fn_vSetSelChanged_CallBack(CTL_tdp_fn_vComboBoxSelChanged _p_fn_vCallBack)
{
ERROR_ASSERT( m_pri_p_td_fn_vSelChanged_CallBack == NULL );
m_pri_p_td_fn_vSelChanged_CallBack = _p_fn_vCallBack;
}
//****************************************************************************
void CTL_Editor_ComboBox::m_pub_fn_vSetDropDown_CallBack(CTL_tdp_fn_vComboBoxSelChanged _p_fn_vCallBack)
{
ERROR_ASSERT( m_pri_p_td_fn_vDropDown_CallBack == NULL );
m_pri_p_td_fn_vDropDown_CallBack = _p_fn_vCallBack;
}
//***************************************************************************
void CTL_Editor_ComboBox::OnSelchange()
{
short wIndex = GetCurSel();
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
if (m_pfCanISelectThisItem)
{
//get the data
CTL_Editor_EnumElement *pNewSelectedElement = (CTL_Editor_EnumElement *)GetItemDataPtr (wIndex);
ASSERT (pNewSelectedElement);
CTL_Editor_EnumControl *pEnumCtrl = (CTL_Editor_EnumControl *)m_pub_fn_pclGetParentControl ();
ASSERT (pEnumCtrl);
CTL_Editor_EnumData *pEnumData = (CTL_Editor_EnumData *)pEnumCtrl->m_fn_pclGetEditedData ();
ASSERT (pEnumData);
if (!(*m_pfCanISelectThisItem)(pEnumData, pNewSelectedElement))
{
SetCurSel (m_iOldSelection);
return;
}
}
//ENDROMTEAM Selection (Cristian Stegaru)
if ( wIndex != LB_ERR )
if ( m_pri_p_td_fn_vSelChanged_CallBack != NULL )
m_pri_p_td_fn_vSelChanged_CallBack(this,
m_pub_fn_pclGetParentControl(),
m_pri_eType,
m_pub_fn_lGetUserDefinedType(),
m_pub_fn_lGetUserDefinedCode());
}
//***************************************************************************
void CTL_Editor_ComboBox::OnDropdown()
{
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
m_iOldSelection = GetCurSel ();
//ENDROMTEAM Selection (Cristian Stegaru)
int iSize, iMaxSize = 0;
for (int iIndex = 0; iIndex < GetCount(); iIndex++)
{
iSize = GetLBTextLen(iIndex);
if (iSize > iMaxSize)
iMaxSize = iSize;
}
SetDroppedWidth(iMaxSize*7);
if ( m_pri_p_td_fn_vDropDown_CallBack != NULL )
m_pri_p_td_fn_vDropDown_CallBack(this,
m_pub_fn_pclGetParentControl(),
m_pri_eType,
m_pub_fn_lGetUserDefinedType(),
m_pub_fn_lGetUserDefinedCode());
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_ComboBox::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_ComboBox, "Combo Box", this);
#endif //CTL_WITH_NO_TUT
}

View File

@@ -0,0 +1,133 @@
// CPACChkB.cpp : implementation file
/////////////////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_WCkB.hpp"
#include "Controls\CTL_CtlB.hpp"
#include "Others\CTL_TTT.hpp"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_CheckBox
BEGIN_MESSAGE_MAP(CTL_Editor_CheckBox, CButton)
//{{AFX_MSG_MAP(CTL_Editor_CheckBox)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
CTL_Editor_CheckBox::CTL_Editor_CheckBox(CTL_tdeCarCheckBoxType _tdeType,
long _lAdditionnalStyles /*= 0*/,
CTL_Editor_Control *_pclControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/,
CString _csFalseText /*= ""*/,
CString _csTrueText /*= ""*/)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_pri_tdeType = _tdeType;
//Creates control
DWORD lStyles;
CRect crBidonRect(0,0,0,0);
lStyles = WS_CHILD | BS_AUTOCHECKBOX;
m_pri_csFalseText = _csFalseText.IsEmpty() ? "False" : _csFalseText;
m_pri_csTrueText = _csTrueText.IsEmpty() ? "True" : _csTrueText;
switch ( m_pri_tdeType )
{
case CTL_CHECK_BOX_TYPE__NORMAL :
lStyles |= BS_PUSHLIKE;
break;
}
lStyles |= _lAdditionnalStyles;
if ( Create("",
lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
m_pri_td_p_fn_vHasBeenClicked_CallBack = NULL;
}
//**************************************************************************
CTL_Editor_CheckBox::~CTL_Editor_CheckBox()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_CheckBox message handlers
//**************************************************************************
void CTL_Editor_CheckBox::m_pub_fn_vSetHasBeenClicked_CallBack(CTL_tdp_fn_vCheckBoxHasBeenClicked _p_fn_vCallBack)
{
ERROR_ASSERT( m_pri_td_p_fn_vHasBeenClicked_CallBack == NULL );
m_pri_td_p_fn_vHasBeenClicked_CallBack = _p_fn_vCallBack;
}
//**************************************************************************
void CTL_Editor_CheckBox::OnClicked()
{
switch ( m_pri_tdeType )
{
case CTL_CHECK_BOX_TYPE__NORMAL :
SetCheck( GetCheck() );
break;
}
if ( m_pri_td_p_fn_vHasBeenClicked_CallBack != NULL )
m_pri_td_p_fn_vHasBeenClicked_CallBack(this,
m_pub_fn_pclGetParentControl(),
m_pri_tdeType,
m_pub_fn_lGetUserDefinedType(),
m_pub_fn_lGetUserDefinedCode());
}
//**************************************************************************
void CTL_Editor_CheckBox::SetCheck(BOOL bCheck)
{
switch ( m_pri_tdeType )
{
case CTL_CHECK_BOX_TYPE__NORMAL :
//Sets button's text
SetWindowText(bCheck ? m_pri_csTrueText : m_pri_csFalseText);
break;
}
CButton::SetCheck(bCheck);
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_CheckBox::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Button, "Check Box", this);
#endif //CTL_WITH_NO_TUT
}

View File

@@ -0,0 +1,353 @@
// CPACSpEd.cpp : implementation file
///////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_WEdt.hpp"
#include "Controls\CTL_CtlI.hpp"
#include "Controls\CTL_CtlF.hpp"
#include "Controls\CTL_CtlV.hpp"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Edit
BEGIN_MESSAGE_MAP(CTL_Editor_Edit, CEdit)
//{{AFX_MSG_MAP(CTL_Editor_Edit)
ON_WM_KEYUP()
ON_WM_KILLFOCUS()
ON_WM_RBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//************************************************************************************
CTL_Editor_Edit::CTL_Editor_Edit(long _lMin,
long _lMax,
long _lAdditionnalStyles,
CTL_Editor_IntegerControl *_pclControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_pri_lMin = _lMin;
m_pri_lMax = _lMax;
m_pri_pclIntegerControl = _pclControl;
m_pri_pclDecimalControl = NULL;
m_pri_pclVectorControl = NULL;
m_pri_tdeType = CTL_EDIT_TYPE__INTEGER;
//Creates control
CRect crBidonRect(0,0,0,0);
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | /*ES_NUMBER |*/ ES_WANTRETURN;
lStyles |= _lAdditionnalStyles;
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
}
//************************************************************************************
CTL_Editor_Edit::CTL_Editor_Edit(long double _ldMin,
long double _ldMax,
long _lAdditionnalStyles,
CTL_Editor_DecimalControl *_pclControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_pri_ldMin = _ldMin;
m_pri_ldMax = _ldMax;
m_pri_pclDecimalControl = _pclControl;
m_pri_pclIntegerControl = NULL;
m_pri_pclVectorControl = NULL;
m_pri_tdeType = CTL_EDIT_TYPE__DECIMAL;
//Creates control
CRect crBidonRect(0,0,0,0);
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | ES_WANTRETURN;
lStyles |= _lAdditionnalStyles;
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
}
//************************************************************************************
CTL_Editor_Edit::CTL_Editor_Edit(long double _ldMin,
long double _ldMax,
long _lAdditionnalStyles,
CTL_Editor_VectorControl *_pclControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_pri_ldMin = _ldMin;
m_pri_ldMax = _ldMax;
m_pri_pclDecimalControl = NULL;
m_pri_pclIntegerControl = NULL;
m_pri_pclVectorControl = _pclControl;
m_pri_tdeType = CTL_EDIT_TYPE__VECTOR;
//Creates control
CRect crBidonRect(0,0,0,0);
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | ES_WANTRETURN;
lStyles |= _lAdditionnalStyles;
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
}
//************************************************************************************
CTL_Editor_Edit::~CTL_Editor_Edit()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Edit message handlers
//************************************************************************************
void CTL_Editor_Edit::m_fn_vSetCurrentValue(long lNewValue)
{
m_pri_lCurrent = lNewValue;
}
//************************************************************************************
void CTL_Editor_Edit::m_fn_vSetCurrentValue(long double ldNewValue)
{
m_pri_ldCurrent = ldNewValue;
}
//************************************************************************************
void CTL_Editor_Edit::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if ( nChar == 13 ) //'Enter' was pressed
{
//Gets the new value string
CString csNewValue;
GetWindowText(csNewValue);
switch ( m_pri_tdeType )
{
//-------------------------------------------------
case CTL_EDIT_TYPE__INTEGER:
{
m_pri_lCurrent = atol(LPCTSTR(csNewValue));
if ( m_pri_lCurrent < m_pri_lMin )
m_pri_lCurrent = m_pri_lMin;
else if ( m_pri_lCurrent > m_pri_lMax )
{
if ((m_pri_lMax == ULONG_MAX) && (m_pri_lMin >=0))
{
if ((unsigned long)m_pri_lCurrent > (unsigned long) m_pri_lMax)
m_pri_lCurrent = m_pri_lMax;
}
else
m_pri_lCurrent = m_pri_lMax;
}
csNewValue.Format("%ld", m_pri_lCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclIntegerControl->m_fn_vUpdateSpin(m_pri_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//-------------------------------------------------
case CTL_EDIT_TYPE__DECIMAL:
{
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
if ( m_pri_ldCurrent < m_pri_ldMin )
m_pri_ldCurrent = m_pri_ldMin;
else if ( m_pri_ldCurrent > m_pri_ldMax )
m_pri_ldCurrent = m_pri_ldMax;
csNewValue.Format("%.3f", m_pri_ldCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclDecimalControl->m_fn_vUpdateSpin(m_pri_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//-------------------------------------------------
case CTL_EDIT_TYPE__VECTOR:
{
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
if ( m_pri_ldCurrent < m_pri_ldMin )
m_pri_ldCurrent = m_pri_ldMin;
else if ( m_pri_ldCurrent > m_pri_ldMax )
m_pri_ldCurrent = m_pri_ldMax;
csNewValue.Format("%.3f", m_pri_ldCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclVectorControl->m_fn_vUpdateSpin(m_pri_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
}
}
CEdit::OnKeyUp(nChar, nRepCnt, nFlags);
}
//************************************************************************************
//To avoid default 'right clic' result in an Edit field
void CTL_Editor_Edit::OnRButtonUp(UINT nFlags, CPoint point)
{
//CEdit::OnRButtonUp(nFlags, point);
}
//**********************************************************************************
// To update contents when the edit loses focus
void CTL_Editor_Edit::OnKillFocus( CWnd* pNewWnd )
{
OnKeyUp(13,1,0);
CEdit::OnKillFocus(pNewWnd);
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
mfn_vRefreshMotorData ();
//ENDROMTEAM Selection (Cristian Stegaru)
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_Edit::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_TextEdit, "Edit", this);
#endif //CTL_WITH_NO_TUT
}
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vRefreshMotorData
// Date : 98-03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : I put here all the stuff from OnKeyUp, excepting the key check
// Author : Stegaru Cristian - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CTL_Editor_Edit::mfn_vRefreshMotorData ()
{
//Gets the new value string
CString csNewValue;
GetWindowText(csNewValue);
switch ( m_pri_tdeType )
{
//-------------------------------------------------
case CTL_EDIT_TYPE__INTEGER:
{
m_pri_lCurrent = atol(LPCTSTR(csNewValue));
if ( m_pri_lCurrent < m_pri_lMin )
m_pri_lCurrent = m_pri_lMin;
else if ( m_pri_lCurrent > m_pri_lMax )
{
if ((m_pri_lMax == ULONG_MAX) && (m_pri_lMin >=0))
{
if ((unsigned long)m_pri_lCurrent > (unsigned long) m_pri_lMax)
m_pri_lCurrent = m_pri_lMax;
}
else
m_pri_lCurrent = m_pri_lMax;
}
csNewValue.Format("%ld", m_pri_lCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclIntegerControl->m_fn_vUpdateSpin(m_pri_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//-------------------------------------------------
case CTL_EDIT_TYPE__DECIMAL:
{
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
if ( m_pri_ldCurrent < m_pri_ldMin )
m_pri_ldCurrent = m_pri_ldMin;
else if ( m_pri_ldCurrent > m_pri_ldMax )
m_pri_ldCurrent = m_pri_ldMax;
csNewValue.Format("%.3f", m_pri_ldCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclDecimalControl->m_fn_vUpdateSpin(m_pri_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//-------------------------------------------------
case CTL_EDIT_TYPE__VECTOR:
{
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
if ( m_pri_ldCurrent < m_pri_ldMin )
m_pri_ldCurrent = m_pri_ldMin;
else if ( m_pri_ldCurrent > m_pri_ldMax )
m_pri_ldCurrent = m_pri_ldMax;
csNewValue.Format("%.3f", m_pri_ldCurrent);
SetWindowText(csNewValue);
//Updates parent's slider and tree view
m_pri_pclVectorControl->m_fn_vUpdateSpin(m_pri_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
}
}
//ENDROMTEAM Selection (Cristian Stegaru)

View File

@@ -0,0 +1,367 @@
// CPACSpin.cpp : implementation file
////////////////////////////////////////////
#include "StdAfx.h"
//ANNECY CB
#if 0
#include "WControls\CTL_WSpn.hpp"
#include "Controls\CTL_CtlI.hpp"
#include "Controls\CTL_CtlF.hpp"
#include "Controls\CTL_CtlV.hpp"
#include "Controls\CTL_Cnst.hpp"
#include "Others\CTL_Pub.hpp"
//External Modules
#include "CTL_ErO.hpp"
#include "IncTUT.h"
//End of External Modules
short CTL_g_uwScreenHeight = 0;
UDACCEL g_a_struc_Accel[C_ACCEL_NB] =
{
{ 1, 1 },
{ 1, 2 },
{ 1, 3 },
{ 1, 4 },
{ 1, 5 },
};
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_SpinButton
BEGIN_MESSAGE_MAP(CTL_Editor_SpinButton, CSpinButtonCtrl)
//{{AFX_MSG_MAP(CTL_Editor_SpinButton)
ON_NOTIFY_REFLECT(UDN_DELTAPOS, OnDeltapos)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_IntegerControl *_pclControl,
long _lLower,
long _lUpper,
CWnd *_pclParentWnd)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd)
{
m_pclIntegerControl = _pclControl;
m_pclDecimalControl = NULL;
m_pclVectorControl = NULL;
ERROR_ASSERT(_lLower < _lUpper);
m_lLower = _lLower;
m_lUpper = _lUpper;
m_tdeType = EDCAR_SPIN_TYPE_INTEGER;
//Creates control
CRect crBidonRect(0,0,10,10);
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
SetRange(0, 100);
}
m_uwManualIntegerDelta = 1;
m_bManualPosIsOn = FALSE;
if ( CTL_g_uwScreenHeight == 0 )
{
//Gets screen's height
HDC hdc;
hdc = ::GetWindowDC(NULL);
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
::ReleaseDC(NULL,hdc);
}
}
//***************************************************************************
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_DecimalControl *_pclControl,
long double _ldLower,
long double _ldUpper,
CWnd *_pclParentWnd)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd)
{
m_pclIntegerControl = NULL;
m_pclDecimalControl = _pclControl;
m_pclVectorControl = NULL;
m_ldLower = _ldLower;
m_ldUpper = _ldUpper;
m_tdeType = EDCAR_SPIN_TYPE_DECIMAL;
//Creates control
CRect crBidonRect(0,0,10,10);
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
if ( Create(lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
SetRange(0, 100);
}
//Computes divisor value
char cCounter = C_SPIN_PRECISION;
m_ldDivisor = 1.0;
while ( cCounter != 0 )
{
m_ldDivisor *= 10.0;
cCounter --;
}
m_fManualDecimalDelta = (float)0.1;
m_bManualPosIsOn = FALSE;
if ( CTL_g_uwScreenHeight == 0 )
{
//Gets screen's height
HDC hdc;
hdc = ::GetWindowDC(NULL);
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
::ReleaseDC(NULL,hdc);
}
}
//***************************************************************************
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_VectorControl *_pclControl,
long double _ldLower,
long double _ldUpper,
CWnd *_pclParentWnd)
: CTL_BaseWindowsControl(_pclControl,
_pclParentWnd)
{
m_pclIntegerControl = NULL;
m_pclDecimalControl = NULL;
m_pclVectorControl = _pclControl;
m_ldLower = _ldLower;
m_ldUpper = _ldUpper;
m_tdeType = EDCAR_SPIN_TYPE_VECTOR;
//Creates control
CRect crBidonRect(0,0,10,10);
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
if ( Create( lStyles,
crBidonRect,
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl())
)
{
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
SetRange(0, 100);
}
//Computes divisor value
char cCounter = C_SPIN_PRECISION;
m_ldDivisor = 1.0;
while ( cCounter != 0 )
{
m_ldDivisor *= 10.0;
cCounter --;
}
m_fManualDecimalDelta = (float)0.1;
m_bManualPosIsOn = FALSE;
if ( CTL_g_uwScreenHeight == 0 )
{
//Gets screen's height
HDC hdc;
hdc = ::GetWindowDC(NULL);
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
::ReleaseDC(NULL,hdc);
}
}
//***************************************************************************
CTL_Editor_SpinButton::~CTL_Editor_SpinButton()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_SpinButton message handlers
//***************************************************************************
void CTL_Editor_SpinButton::OnDeltapos(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
switch ( m_tdeType )
{
//---------------------------------------------------------
case EDCAR_SPIN_TYPE_INTEGER:
{
m_lCurrent += pNMUpDown->iDelta;
if ( m_lCurrent > m_lUpper )
m_lCurrent = m_lUpper;
else if ( m_lCurrent < m_lLower )
m_lCurrent = m_lLower;
m_pclIntegerControl->m_fn_vUpdateEdit(m_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//---------------------------------------------------------
case EDCAR_SPIN_TYPE_DECIMAL:
{
m_ldCurrent += ((long double)(pNMUpDown->iDelta) / m_ldDivisor);
if ( m_ldCurrent > m_ldUpper )
m_ldCurrent = m_ldUpper;
else if ( m_ldCurrent < m_ldLower )
m_ldCurrent = m_ldLower;
m_pclDecimalControl->m_fn_vUpdateEdit(m_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
//---------------------------------------------------------
case EDCAR_SPIN_TYPE_VECTOR:
{
m_ldCurrent += ((long double)(pNMUpDown->iDelta) / m_ldDivisor);
if ( m_ldCurrent > m_ldUpper )
m_ldCurrent = m_ldUpper;
else if ( m_ldCurrent < m_ldLower )
m_ldCurrent = m_ldLower;
m_pclVectorControl->m_fn_vUpdateEdit(m_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
}
*pResult = 0;
}
//***************************************************************************
void CTL_Editor_SpinButton::m_fn_vSetCurrentPos(long lNewValue)
{
m_lCurrent = lNewValue;
}
//***************************************************************************
void CTL_Editor_SpinButton::m_fn_vSetCurrentPos(long double ldNewValue)
{
m_ldCurrent = ldNewValue;
}
//***************************************************************************
void CTL_Editor_SpinButton::OnLButtonDown(UINT nFlags, CPoint point)
{
SetCapture();
m_bManualPosIsOn = TRUE;
ClientToScreen(&point);
m_uwOldPosition = (unsigned short)point.y;
CSpinButtonCtrl::OnRButtonDown(nFlags, point);
}
//***************************************************************************
void CTL_Editor_SpinButton::OnMouseMove(UINT nFlags, CPoint point)
{
if ( m_bManualPosIsOn )
{
CPoint cpScreenPos = point;
ClientToScreen(&cpScreenPos);
if ( cpScreenPos.y == 0 )
{
SetCursorPos(cpScreenPos.x, CTL_g_uwScreenHeight-2);
cpScreenPos.y = m_uwOldPosition = CTL_g_uwScreenHeight-2;
}
if ( cpScreenPos.y == (CTL_g_uwScreenHeight-1) )
{
SetCursorPos(cpScreenPos.x, 1);
cpScreenPos.y = m_uwOldPosition = 1;
}
switch ( m_tdeType )
{
case EDCAR_SPIN_TYPE_INTEGER:
{
long lNewValue = (long)(m_lCurrent + (m_uwOldPosition - cpScreenPos.y) * m_uwManualIntegerDelta);
if ( lNewValue > m_lUpper )
lNewValue = m_lUpper;
else if ( lNewValue < m_lLower )
lNewValue = m_lLower;
m_fn_vSetCurrentPos(lNewValue);
m_pclIntegerControl->m_fn_vUpdateEdit(m_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
case EDCAR_SPIN_TYPE_DECIMAL:
{
long double ldNewValue = (long double)(m_ldCurrent + (m_uwOldPosition - cpScreenPos.y) * m_fManualDecimalDelta);
if ( ldNewValue > m_ldUpper )
ldNewValue = m_ldUpper;
else if ( ldNewValue < m_ldLower )
ldNewValue = m_ldLower;
m_fn_vSetCurrentPos(ldNewValue);
m_pclDecimalControl->m_fn_vUpdateEdit(m_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
case EDCAR_SPIN_TYPE_VECTOR:
{
long double ldNewValue = (long double)(m_ldCurrent + (m_uwOldPosition - cpScreenPos.y) * m_fManualDecimalDelta);
if ( ldNewValue > m_ldUpper )
ldNewValue = m_ldUpper;
else if ( ldNewValue < m_ldLower )
ldNewValue = m_ldLower;
m_fn_vSetCurrentPos(ldNewValue);
m_pclVectorControl->m_fn_vUpdateEdit(m_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
break;
}
m_uwOldPosition = (unsigned short)cpScreenPos.y ;
}
CSpinButtonCtrl::OnMouseMove(nFlags, point);
}
//***************************************************************************
void CTL_Editor_SpinButton::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
m_bManualPosIsOn = FALSE;
CSpinButtonCtrl::OnRButtonUp(nFlags, point);
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_SpinButton::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Spin, "Spin Control", this);
#endif //CTL_WITH_NO_TUT
}
#endif
//ENDANNECY CB

View File

@@ -0,0 +1,279 @@
// CPACStat.cpp : implementation file
//////////////////////////////////////////
#include "StdAfx.h"
#include "WControls\CTL_WSta.hpp"
#include "Others\CTL_Pub.hpp"
#include "Others\CTL_Pri.hpp"
//ANNECY CB
#include "WControls\CTL_VBas.hpp"
//END ANNECY
//External Modules
#include "IncTUT.h"
//End of External Modules
extern CBrush g_clWhiteBrush;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Colors for a value (not changeable in Setup)
COLORREF CTL_g_colref_ValueTextColor = RGB(0,0,0);
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Static
IMPLEMENT_DYNAMIC(CTL_Editor_Static, CStatic)
BEGIN_MESSAGE_MAP(CTL_Editor_Static, CStatic)
//{{AFX_MSG_MAP(CTL_Editor_Static)
ON_WM_RBUTTONUP()
ON_WM_LBUTTONDBLCLK()
ON_WM_PAINT()
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
//ANNECY CB
ON_WM_MOUSEMOVE()
//END ANNECY
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CTL_Editor_Static::CTL_Editor_Static(CString _csName,
CTL_tdeStaticType _tdeType,
long _lAdditionnalStyles,
CTL_Editor_Control *_pclParentControl,
CWnd *_pclParentWnd,
long _lUserDefinedType /*= 0*/,
long _lUserDefinedCode /*= 0*/)
: CTL_BaseWindowsControl(_pclParentControl,
_pclParentWnd,
_lUserDefinedType,
_lUserDefinedCode)
{
m_csTextToDisplay = _csName;
m_pri_tdeType = _tdeType;
m_pri_p_fnStaticHasBeenClicked_CallBack = CTL_g_p_fnDefaultCallBack_StaticHasBeenClicked;
m_pri_td_p_fn_vGetColor = CTL_g_p_fnDefaultCallBack_GetColor;
//Creates the control
DWORD lStyles = WS_CHILD | SS_NOTIFY | WS_BORDER;
switch ( m_pri_tdeType )
{
case CTL_STATIC_TYPE__FIELD_VALUE:
case CTL_STATIC_TYPE__NEUTRAL_FIELD:
lStyles |= (SS_CENTER);
break;
}
lStyles |= _lAdditionnalStyles;
m_pri_colBackGroundColor = RGB(132,132,132);
m_pri_colTextColor = RGB(0,0,0);
if ( Create(_csName,
lStyles,
CRect(0,0,0,0),
_pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
SetFont(_pclParentWnd->GetFont());
}
}
//***************************************************************************
CTL_Editor_Static::~CTL_Editor_Static()
{
}
/////////////////////////////////////////////////////////////////////////////
// CTL_Editor_Static message handlers
//***************************************************************************
void CTL_Editor_Static::m_fn_vSetTextToDisplay(CString csNewText,
BOOL _bMustRefresDisplay /*= FALSE*/)
{
m_csTextToDisplay = csNewText;
if ( _bMustRefresDisplay )
InvalidateRect(NULL);
}
//***************************************************************************
CTL_tdeStaticType CTL_Editor_Static::m_pub_fn_tdeGetType()
{
return m_pri_tdeType;
}
//***************************************************************************
CString CTL_Editor_Static::m_pub_fn_csGetDisplayedString()
{
return m_csTextToDisplay;
}
//***************************************************************************
COLORREF CTL_Editor_Static::m_pub_fn_colGetBackGroundColor()
{
return m_pri_colBackGroundColor;
}
//***************************************************************************
void CTL_Editor_Static::m_pub_fn_vSetBackGroundColor(COLORREF _colNewColor,
BOOL _bMustRefresDisplay /*= FALSE*/)
{
m_pri_colBackGroundColor = _colNewColor;
if ( _bMustRefresDisplay )
InvalidateRect(NULL);
}
//***************************************************************************
COLORREF CTL_Editor_Static::m_pub_fn_colGetTextColor()
{
return m_pri_colTextColor;
}
//***************************************************************************
void CTL_Editor_Static::m_pub_fn_vSetTextColor(COLORREF _colNewColor,
BOOL _bMustRefresDisplay /*= FALSE*/)
{
m_pri_colTextColor = _colNewColor;
if ( _bMustRefresDisplay )
InvalidateRect(NULL);
}
//***************************************************************************
void CTL_Editor_Static::m_pub_fn_vSetStaticHasBeenClicked_CallBack(
CTL_td_p_fn_vStaticHasBeenClicked _p_fnStaticHasBeenClicked_CallBack)
{
m_pri_p_fnStaticHasBeenClicked_CallBack = _p_fnStaticHasBeenClicked_CallBack;
}
//***************************************************************************
void CTL_Editor_Static::m_pub_fn_v_SetColRefGetColor_CallBack(CTL_tdp_fn_vGetColor _p_fn_CallBack)
{
m_pri_td_p_fn_vGetColor = _p_fn_CallBack;
}
//***************************************************************************
void CTL_Editor_Static::OnRButtonUp(UINT nFlags, CPoint point)
{
//CPA2 Stegaru Cristian 98/06/19
CTL_tdeClickType clickType = CTL_CLICK_TYPE__RIGHT_CLICK;
if (MK_SHIFT == (MK_SHIFT & nFlags))
clickType = CTL_CLICK_TYPE__SHIFT_RIGHT_CLICK;
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
m_pri_p_fnStaticHasBeenClicked_CallBack(this, clickType);
//End CPA2 Stegaru Cristian 98/06/19
CStatic::OnRButtonUp(nFlags, point);
}
//***************************************************************************
void CTL_Editor_Static::OnLButtonDblClk(UINT nFlags, CPoint point)
{
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK);
CStatic::OnMButtonDblClk(nFlags, point);
}
//***************************************************************************
void CTL_Editor_Static::OnLButtonUp(UINT nFlags, CPoint point)
{
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_CLICK);
CStatic::OnLButtonUp(nFlags, point);
}
//***************************************************************************
//ANNECY CB
void CTL_Editor_Static::OnMouseMove(UINT nFlags, CPoint point)
{
CTL_Editor_BaseFormView *pView = (CTL_Editor_BaseFormView *) GetParent();
ClientToScreen(&point);
pView->ScreenToClient(&point);
LPARAM lParam = point.x + (point.y << 16);
pView->SendMessage(WM_MOUSEMOVE, (WPARAM) nFlags, lParam);
}
//END ANNECY
void CTL_Editor_Static::OnLButtonDown(UINT nFlags, CPoint point)
{
//ANNECY CB
// if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
// m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_BUTTON_DOWN);
// else
{
CTL_Editor_BaseFormView *pView = (CTL_Editor_BaseFormView *) GetParent();
ClientToScreen(&point);
pView->ScreenToClient(&point);
LPARAM lParam = point.x + (point.y << 16);
pView->SendMessage(WM_LBUTTONDOWN, (WPARAM) nFlags, lParam);
}
//END ANNECY
CStatic::OnLButtonDown(nFlags, point);
}
//***************************************************************************
void CTL_Editor_Static::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect crClientRect;
GetClientRect(crClientRect);
if ( m_pri_td_p_fn_vGetColor != NULL )
m_pri_td_p_fn_vGetColor(this, m_pri_colBackGroundColor, m_pri_colTextColor);
//Fills the window's rect
dc.FillSolidRect(crClientRect, m_pri_colBackGroundColor);
//Displays the string
dc.SelectObject(GetFont());
dc.SetTextColor(m_pri_colTextColor);
dc.SetBkMode(TRANSPARENT);
UINT nFormat = DT_SINGLELINE | DT_VCENTER;
if ( (GetStyle() & SS_CENTER) != 0 )
nFormat |= DT_CENTER;
else
nFormat |= DT_LEFT;
crClientRect.left ++;
dc.DrawText(m_csTextToDisplay, crClientRect, nFormat);
// Do not call CStatic::OnPaint() for painting messages
}
//***************************************************************************
long CTL_Editor_Static::m_fn_lGetMinLength()
{
CClientDC dc(this);
CString csWindowText;
GetWindowText(csWindowText);
dc.SelectObject(GetFont());
return (dc.GetTextExtent(csWindowText).cx);
}
//**********************************************************************************
//For TUT registration
void CTL_Editor_Static::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
{
#ifndef CTL_WITH_NO_TUT
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Window, "Static", this);
#endif //CTL_WITH_NO_TUT
}

View File

@@ -0,0 +1,24 @@
#include "StdAfx.h"
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
static BOOL CTL_s_g_bModuleInitialized = FALSE;
#include "CTL_ErO.hpp"
#include "Others\CTL_Pri.hpp"
//========================================================================
// Get current CPA version
//========================================================================
void __declspec(dllexport) CTL_fn_vInitModule(HMODULE _hModule)
{
CTL_g_hModule = _hModule;
if ( !CTL_s_g_bModuleInitialized )
{
CTL_fn_vInternalInitModule();
CTL_s_g_bModuleInitialized = TRUE;
}
}

Binary file not shown.