reman3/Rayman_X/cpa/tempgrp/Tut/TutLib/Inc/Tut_Mngr.hpp

717 lines
38 KiB
C++

/******************************************************************************
* *
* Tut_Mngr.hpp : declaration of the TUT_CTutorialManager class *
* *
* This class can take the control of all windows of the application *
* to create a tutorial or an automatic test *
* *
* Author : Alexis Vaisse *
* *
******************************************************************************/
#ifndef _TUT_MNGR_HPP_
#define _TUT_MNGR_HPP_
#pragma once
#include <afxtempl.h>
//--------------------------- error codes -------------------------------------
#define TUT_C_iNoError 0
#define TUT_C_iError_FileNotFound 1
#define TUT_C_iError_UnknownCommand 2
#define TUT_C_iError_TooManyParameters 3
#define TUT_C_iError_ParameterRequired 4
#define TUT_C_iError_UnknownButton 5
#define TUT_C_iError_ButtonRequired 6
#define TUT_C_iError_InvalidCoordinates 7
#define TUT_C_iError_NoWindowToWriteText 8
#define TUT_C_iError_InvalidNumber 9
#define TUT_C_iError_UnknownTextEdit 10
#define TUT_C_iError_TextEditRequired 11
#define TUT_C_iError_UnknownWindow 12
#define TUT_C_iError_UnknownComboBox 13
#define TUT_C_iError_ListOrComboRequired 14
#define TUT_C_iError_UnknownMdiWindow 15
#define TUT_C_iError_MdiWindowRequired 16
#define TUT_C_iError_UnknownColor 17
#define TUT_C_iError_UnknownControl 18
#define TUT_C_iError_SelectCtrlRequired 19
#define TUT_C_iError_InvalidTextAlignment 20
#define TUT_C_iError_UnknownTreeBox 21
#define TUT_C_iError_TreeBoxRequired 22
#define TUT_C_iError_FunctionNotCompiled 23
#define TUT_C_iError_Unknown3dObject 24
#define TUT_C_iError_NoMenuAvailable 25
#define TUT_C_iError_UnknownMenuName 26
#define TUT_C_iError_NotASubMenu 27
#define TUT_C_iError_EndLoopWithoutLoop 28
#define TUT_C_iError_TestOperatorRequired 29
#define TUT_C_iError_OrIfWithoutAnIf 30
#define TUT_C_iError_ElseWithoutAnIf 31
#define TUT_C_iError_ElseInTheWrongPlace 32
#define TUT_C_iError_EndIfWithoutAnIf 33
#define TUT_C_iError_DebugWndAlreadyOpen 34
#define TUT_C_iError_DebugWndNotOpen 35
#define TUT_C_iError_InvalidMdiHandle 36
#define TUT_C_iError_InvalidParentMdiHandle 37
#define TUT_C_iError_InvalidListBoxHandle 38
#define TUT_C_iError_InvalidComboBoxHandle 39
#define TUT_C_iError_InvalidTreeBoxHandle 40
#define TUT_C_iError_InvalidMenuHandle 41
#define TUT_C_iError_InvalidMenuWndHandle 42
#define TUT_C_iError_InvalidButtonHandle 43
#define TUT_C_iError_InvalidTextEditHandle 44
#define TUT_C_iError_WindowOrMdiRequired 45
#define TUT_C_iError_InvalidWndOrMdiHandle 46
#define TUT_C_iError_CtrlWithTextRequired 47
#define TUT_C_iError_InvalidHandle 48
#define TUT_C_iError_BooleanValueRequired 49
#define TUT_C_iError_ItemNotFoundInTree 50
#define TUT_C_iError_ItemHasNoChild 51
#define TUT_C_iError_InvalidChildNumber 52
#define TUT_C_iError_NotANumericVariable 53
#define TUT_C_iError_DivisionByZero 54
#define TUT_C_iError_EmptyVariable 55
#define TUT_C_iError_LogFileAlreadyOpen 56
#define TUT_C_iError_UnableToOpenLogFile 57
#define TUT_C_iError_LogFileNotOpen 58
#define TUT_C_iError_InvalidXBorder 59
#define TUT_C_iError_InvalidYBorder 60
#define TUT_C_iError_InvalidNumberOrPercent 61
#define TUT_C_iError_InvalidListCtrlHandle 62
#define TUT_C_iError_LabelsWithSameName 63
#define TUT_C_iError_LabelNotFound 64
#define TUT_C_iError_ModelNotFound 65
#define TUT_C_iError_DragAtTheWrongPlace 66
#define TUT_C_iError_DropAtTheWrongPlace 67
#define TUT_C_iError_InvisibleControl 68
#define TUT_C_iError_DisabledControl 69
#define TUT_C_iError_NoMultipleSelection 70
#define TUT_C_iError_UnknownListBox 71
#define TUT_C_iError_ListBoxRequired 72
#define TUT_C_iError_UnknownObject 73
#define TUT_C_iError_UnknownVariable 74
#define TUT_C_iError_CountCtrlRequired 75
#define TUT_C_iError_UnknownMessageBoxCtrl 76
#define TUT_C_iError_MessageBoxCtrlNotFound 77
#define TUT_C_iError_NoReturnValue 78
#define TUT_C_iError_UnknownKey 79
#define TUT_C_iError_MultiLineRequired 80
#define TUT_C_iError_InvalidLineNumber 81
#define TUT_C_iError_LocalVariableExist 82
#define TUT_C_iError_GlobalVariableExist 83
#define TUT_C_iError_ListViewRequired 84
#define TUT_C_iError_UncoherentSelectionLimits 85
#define TUT_C_iQuitImmediately 255
//----------- error codes for the GetLastError variable -----------------------
#define TUT_C_iError_ListBoxItemNotFound 1
#define TUT_C_iError_ComboBoxItemNotFound 2
#define TUT_C_iError_ListCtrlItemNotFound 3
#define TUT_C_iError_ListBoxInvalidLine 4
#define TUT_C_iError_ComboBoxInvalidLine 5
#define TUT_C_iError_ListCtrlInvalidLine 6
#define TUT_C_iError_TreeCtrlItemNotFound 7
#define TUT_C_iError_SoundError 8
#define TUT_C_iError_UnregisteredWindow 9
//--------------------------- action names ------------------------------------
// tutorial text windows
#define TUT_C_szOpenWindow "OpenWindow"
#define TUT_C_szCloseWindow "CloseWindow"
#define TUT_C_szSelectWindow "SelectWindow"
#define TUT_C_szSetText "SetText"
#define TUT_C_szWriteText "Write"
// debug and log file
#define TUT_C_szOpenDebugWindow "OpenDebugWindow"
#define TUT_C_szCloseDebugWindow "CloseDebugWindow"
#define TUT_C_szOpenLogFile "OpenLogFile"
#define TUT_C_szCloseLogFile "CloseLogFile"
#define TUT_C_szClearLogFile "ClearLogFile"
#define TUT_C_szOpenDebugLogFile "OpenDebugLogFile"
#define TUT_C_szClearDebugLogFile "ClearDebugLogFile"
#define TUT_C_szCloseDebugLogFile "CloseDebugLogFile"
// context
#define TUT_C_szSaveContext "SaveContext"
#define TUT_C_szRestoreContext "RestoreContext"
// miscellaneous
#define TUT_C_szPause "Pause"
#define TUT_C_szSetMouseSpeed "SetMouseSpeed"
#define TUT_C_szSetKeySpeed "SetKeySpeed"
#define TUT_C_szListAllControl "ListAllControl" // Used for debugging
#define TUT_C_szExit "Exit" // Quit the current file
#define TUT_C_szHalt "Halt" // Stop the current process
#define TUT_C_szMessageBox "MessageBox" // To clic into a message box
#define TUT_C_szBeep "Beep"
#define TUT_C_szPlay "Play"
// special actions
#define TUT_C_szRightButton "RightButton" // Tell to use the right button for the next action
#define TUT_C_szDoubleClic "DoubleClic" // Tell to use a double clic for the next action
#define TUT_C_szPosition "Position" // To clic on a specific position of a control
#define TUT_C_szDrag "Drag" // To begin a drag and drop
#define TUT_C_szDrop "Drop" // To end a drag and drop
// buttons
#define TUT_C_szIsChecked "IsChecked"
// all controls
#define TUT_C_szSetFocus "SetFocus"
#define TUT_C_szIsExisting "IsExisting"
#define TUT_C_szIsVisible "IsVisible"
#define TUT_C_szIsEnabled "IsEnabled"
#define TUT_C_szClic "Clic"
#define TUT_C_szGetFocusWindow "GetFocusWindow"
#define TUT_C_szHasFocus "HasFocus"
// variables
#define TUT_C_szVar "Var" // to declare a local variable
#define TUT_C_szGlobalVar "GlobalVar" // to declare a global variable
#define TUT_C_szSet "Set"
#define TUT_C_szFree "Free" // delete a variable
// windows
#define TUT_C_szGetTitle "GetTitle"
#define TUT_C_szMinimizeWindow "MinimizeWindow" // mdi windows only
#define TUT_C_szMaximizeWindow "MaximizeWindow" // mdi windows only
#define TUT_C_szRestoreWindow "RestoreWindow" // mdi windows only
// controls with selection (list, combo, tree)
#define TUT_C_szGetSelection "GetSelection"
#define TUT_C_szSelectLine "SelectLine" // only for lists and combo
#define TUT_C_szSelect "Select"
#define TUT_C_szUnselect "Unselect"
#define TUT_C_szGetCount "GetCount" // only for lists and combo and text edit
#define TUT_C_szIsSelected "IsSelected"
#define TUT_C_szIsInList "IsInList" // only for lists and combo
#define TUT_C_szAddSelect "AddSelect" // only for multiple select list
#define TUT_C_szAddSelectLine "AddSelectLine" // only for multiple select list
// trees
#define TUT_C_szExpand "Expand"
#define TUT_C_szCollapse "Collapse"
#define TUT_C_szGetNumberOfChildren "GetNumberOfChildren"
#define TUT_C_szGetChild "GetChild"
#define TUT_C_szGetParent "GetParent"
// text edits
#define TUT_C_szGetText "GetText" // for text edit and button
#define TUT_C_szSetEditText "SetEditText"
#define TUT_C_szSelectText "SelectText"
// menu
#define TUT_C_szMenu "Menu"
#define TUT_C_szPopupMenu "PopupMenu"
#define TUT_C_szGetMenuItem "GetMenuItem"
#define TUT_C_szGetPopupMenuItem "GetPopupMenuItem"
// loop
#define TUT_C_szLoop "Loop"
#define TUT_C_szEndLoop "EndLoop"
// test
#define TUT_C_szIf "If"
#define TUT_C_szOrIf "OrIf"
#define TUT_C_szElse "Else"
#define TUT_C_szEndIf "EndIf"
// keys
#define TUT_C_szKey "Key"
#define TUT_C_szPress "Press"
#define TUT_C_szRelease "Release"
// string
#define TUT_C_szGetLength "GetLength"
#define TUT_C_szFindString "FindString"
#define TUT_C_szExtractString "ExtractString"
// arithmetic operations
#define TUT_C_szAdd "Add"
#define TUT_C_szSub "Sub"
#define TUT_C_szMul "Mul"
#define TUT_C_szDiv "Div"
// functions
#define TUT_C_szCall "Call"
#define TUT_C_szGetParameters "GetParameters"
#define TUT_C_szSetResult "SetResult"
#define TUT_C_szGetResult "GetResult"
// jumps
#define TUT_C_szLabel "Label"
#define TUT_C_szGoto "Goto"
// 3d view (specific)
#define TUT_C_sz3DGetPosition "GetPosition"
#define TUT_C_sz3DClic3dView "Clic3dView"
#define TUT_C_sz3DIsProtected "IsProtected" // To know if a super object is protected or not
#define TUT_C_sz3DMove3d "Move3d"
#define TUT_C_sz3DSelectModel "SelectModel" // To select a model into the model window
#define TUT_C_sz3DGetModel "GetModel" // Get the selected model
#define TUT_C_sz3DGetNumberOfModels "GetNumberOfModels"
#define TUT_C_sz3DIsAvailable "IsAvailable" // Return if a object is available or not
#define TUT_C_sz3DGetPrefix "GetPrefix" // Return the prefix of the user
#define TUT_C_sz3DIsExistingModel "IsExistingModel"
#define TUT_C_sz3DGetStatusBarText "GetStatusBarText"
//----------------------------color names -------------------------------------
typedef struct TUT_stColorDefinition_
{
char * szColorName;
COLORREF xColor;
} TUT_tdstColorDefinition;
const TUT_tdstColorDefinition g_a_stColorDefinition [] = {
{ "Black" , RGB ( 0 , 0 , 0) } ,
{ "Red" , RGB (128 , 0 , 0) } ,
{ "Green" , RGB ( 0 , 128 , 0) } ,
{ "Blue" , RGB ( 0 , 0 , 128) } ,
{ "Brown" , RGB (128 , 128 , 0) } ,
{ "Magenta" , RGB (128 , 0 , 128) } ,
{ "Cyan" , RGB ( 0 , 128 , 128) } ,
{ "Gray" , RGB (128 , 128 , 128) } ,
{ "LightRed" , RGB (255 , 0 , 0) } ,
{ "LightGreen" , RGB ( 0 , 255 , 0) } ,
{ "LightBlue" , RGB ( 0 , 0 , 255) } ,
{ "Yellow" , RGB (255 , 255 , 0) } ,
{ "LightMagenta", RGB (255 , 0 , 255) } ,
{ "LightCyan" , RGB ( 0 , 255 , 255) } ,
{ "White" , RGB (255 , 255 , 255) } ,
{ NULL , 0 } }; // End of array : do not remove
#define TUT_C_szOk "Ok"
#define TUT_C_szCancel "Cancel"
#define TUT_C_szAbort "Abort"
#define TUT_C_szRetry "Retry"
#define TUT_C_szIgnore "Ignore"
#define TUT_C_szYes "Yes"
#define TUT_C_szNo "No"
//-----------------------------------------------------------------------------
#define TUT_C_cBeginningOfVariable '@'
#define TUT_C_cDeclarationOfVariable '!'
#define TUT_C_cControl '^'
#define TUT_C_cAlt '&'
#define TUT_C_cShift '#'
#define TUT_C_szTextAlignment_Left "Left"
#define TUT_C_szTextAlignment_Right "Right"
#define TUT_C_szTextAlignment_Center "Center"
#define TUT_C_szTrue "TRUE"
#define TUT_C_szFalse "FALSE"
#define TUT_C_szBorderLeft "Left"
#define TUT_C_szBorderRight "Right"
#define TUT_C_szBorderTop "Top"
#define TUT_C_szBorderBottom "Bottom"
#define TUT_C_szGetLastError "GetLastError"
#define TUT_C_szGetLastErrorMessage "GetLastErrorMessage"
#define TUT_C_iErrorNotANumber ((int) 2020202020 )
#define TUT_C_dErrorNotANumber ((double) 2020202020.0)
//-----------------------------------------------------------------------------
#define TUT_C_xPauseIntervall ((clock_t)(CLOCKS_PER_SEC / 10))
//-----------------------------------------------------------------------------
typedef enum TUT_eWndType_ { TUT_eWindow , TUT_eMdiWindow ,
TUT_eButton , TUT_eTextEdit ,
TUT_eListBox , TUT_eComboBox ,
TUT_eTreeCtrl , TUT_eListCtrl ,
TUT_eSpin , TUT_eSlider , TUT_eScrollBar ,
TUT_eUserWindow, TUT_e3DView } TUT_tdeWndType;
typedef struct TUT_stWndDefinition_
{
HWND hWnd;
CString csName;
TUT_tdeWndType eType;
} TUT_tdstWndDefinition;
typedef struct TUT_stMenuDefinition_
{
HMENU hMenu;
HWND hWindow;
int iX , iY;
} TUT_tdstMenuDefinition;
typedef struct TUT_stVariableDefinition_
{
CString csName;
CString csValue;
int iContextNumber;
} TUT_tdstVariableDefinition;
typedef struct TUT_stLoopDefinition_
{
TUT_tdstVariableDefinition * p_stVariable;
long lCurrentValue; // Current value of the loop variable
long lEndValue; // End value of the loop variable
long lStep; // Step of the loop variable
fpos_t xPosInFile; // Position of the first command inside the loop in the file
} TUT_tdstLoopDefinition;
typedef enum TUT_ePositionInTest_ { TUT_eAfterIf , TUT_eBeforeElse , TUT_eAfterElse } TUT_tdePositionInTest;
typedef struct TUT_stTestDefinition_
{
TUT_tdePositionInTest ePositionInTest;
BOOL bTestVerified;
int iNumberOfSkippedTest; // Number of tests which are inside a not executed block of a test
} TUT_tdstTestDefinition;
typedef struct TUT_stLabelDefinition_
{
CString csName; // Name of the label
fpos_t xPosInFile; // Position of the first command after the label in the file
int iContextNumber; // Number of the context (= file) where the label is declared
} TUT_tdstLabelDefinition;
typedef struct TUT_stContextDefinition_
{
CString csFileName; // Name of the executed file
int iLineNumber;
} TUT_tdstContextDefinition;
typedef struct TUT_stLogFileDefinition_
{
BOOL bOpen; // Is Log File Opened
CString csName; // Name of Log File
FILE * pFile; // FILE pointer
} TUT_tdstLogFileDefinition;
typedef enum TUT_eArithmeticOperation { TUT_eAdd , TUT_eSub , TUT_eMul , TUT_eDiv } TUT_tdeArithmeticOperation;
typedef enum TUT_eDragDropType { TUT_eNone , TUT_eMove3d , TUT_eSelectModel } TUT_tdeDragDropType;
typedef CArray<TUT_tdstWndDefinition * , TUT_tdstWndDefinition *> TUT_td_CArrayOfWnd;
typedef CList <TUT_tdstVariableDefinition * , TUT_tdstVariableDefinition *> TUT_td_CListOfVariable;
typedef CList <TUT_tdstLoopDefinition * , TUT_tdstLoopDefinition *> TUT_td_CListOfLoop;
typedef CList <TUT_tdstTestDefinition * , TUT_tdstTestDefinition *> TUT_td_CListOfTest;
typedef CList <TUT_tdstLabelDefinition * , TUT_tdstLabelDefinition *> TUT_td_CListOfLabel;
typedef CList <TUT_tdstContextDefinition * , TUT_tdstContextDefinition *> TUT_td_CListOfContext;
//-----------------------------------------------------------------------------
class TUT_CTutorialManager
{
// ***** public functions (Tut_Mngr.cpp) *****
public:
TUT_CTutorialManager (); // Constructor
~TUT_CTutorialManager (); // Destructor
void m_fn_vRegisterWnd (HWND _hWnd , const CString _csName , TUT_tdeWndType _eType);
BOOL m_fn_bUnregisterWnd (HWND _hWnd);
void m_fn_vRegisterMenu (HWND _hWnd , HMENU _hMenu , int _iX , int _iY);
void m_fn_vLaunchScript (const CString _csFileName); // Call this function to execute a script file
int m_fn_iExecuteScript (const CString _csFileName); // and not this one
void m_fn_vSetBackGroundActive (BOOL _bActive);
void m_fn_vSetRunMode (BOOL _bRun);
BOOL m_fn_bNotInBackGround (void);
BOOL m_fn_bIsRunning (void);
////////////////////////
void m_fn_vStartRecord (HMODULE _hModule, DWORD _dThreadID);
void m_fn_vStopRecord (HMODULE _hModule, DWORD _dThreadID, LPCTSTR _szFileName);
BOOL m_fn_bHookMsgProc (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bHookWndProc (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bHookWndProcRet (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
// ***** private functions : execution of a command (Tut_Mngr.cpp) *****
private:
int m_fn_iExecuteScriptAction (char * _szLine , FILE * pFile);
int m_fn_iExecuteClic (char * _szParameter);
int m_fn_iExecuteOpenWindow (char * _szParameter);
int m_fn_iExecuteWriteText (char * _szParameter);
int m_fn_iExecutePause (char * _szParameter);
int m_fn_iExecuteSetEditText (char * _szParameter);
int m_fn_iExecuteCloseWindow (char * _szParameter);
int m_fn_iExecuteSetFocus (char * _szParameter);
int m_fn_iExecuteSelectWindow (char * _szParameter);
int m_fn_iExecuteSelectLine (char * _szParameter , BOOL _bAddToSelection);
int m_fn_iExecuteChangeWindowState (char * _szParameter , char * _szAction);
int m_fn_iExecuteSetMouseSpeed (char * _szParameter);
int m_fn_iExecuteSetText (char * _szParameter);
int m_fn_iExecuteSet (char * _szParameter);
int m_fn_iExecuteGetSelection (char * _szParameter);
int m_fn_iExecuteSelect (char * _szParameter , BOOL _bAddToSelection);
int m_fn_iExecuteCall (char * _szParameter);
int m_fn_iExecuteExpandOrCollapse (char * _szParameter , BOOL _bExpand);
int m_fn_iExecuteListAllControl (char * _szParameter);
int m_fn_iExecuteMenu (char * _szParameter , BOOL _bPopupMenu);
int m_fn_iExecuteLoop (char * _szParameter , FILE * _pFile);
int m_fn_iExecuteEndLoop (char * _szParameter , FILE * _pFile);
int m_fn_iExecuteIf (char * _szParameter);
int m_fn_iExecuteOrIf (char * _szParameter);
int m_fn_iExecuteElse (char * _szParameter);
int m_fn_iExecuteEndIf (char * _szParameter);
int m_fn_iExecuteRightButton (char * _szParameter);
int m_fn_iExecuteDoubleClic (char * _szParameter);
int m_fn_iExecuteOpenDebugWindow (char * _szParameter);
int m_fn_iExecuteCloseDebugWindow (char * _szParameter);
int m_fn_iExecuteGetTitle (char * _szParameter);
int m_fn_iExecuteGetText (char * _szParameter);
int m_fn_iExecuteIsVisible (char * _szParameter);
int m_fn_iExecuteExit (char * _szParameter , FILE * _pFile);
int m_fn_iExecuteHalt (char * _szParameter);
int m_fn_iExecuteGetNumberOfChildren (char * _szParameter);
int m_fn_iExecuteGetChild (char * _szParameter);
int m_fn_iExecuteGetParent (char * _szParameter);
int m_fn_iExecuteArithmeticOperation (char * _szParameter , TUT_tdeArithmeticOperation _eOperation);
int m_fn_iExecuteGetParameters (char * _szParameter);
int m_fn_iExecuteOpenLogFile (char * _szParameter , TUT_tdstLogFileDefinition * _p_stLogFile);
int m_fn_iExecuteCloseLogFile (char * _szParameter , TUT_tdstLogFileDefinition * _p_stLogFile);
int m_fn_iExecuteClearLogFile (char * _szParameter , TUT_tdstLogFileDefinition * _p_stLogFile);
int m_fn_iExecutePosition (char * _szParameter);
int m_fn_iExecuteLabel (char * _szParameter , FILE * _pFile);
int m_fn_iExecuteGoto (char * _szParameter , FILE * _pFile);
int m_fn_iExecuteIsChecked (char * _szParameter);
int m_fn_iExecuteIsEnabled (char * _szParameter);
int m_fn_iExecuteDrag (char * _szParameter);
int m_fn_iExecuteDrop (char * _szParameter);
int m_fn_iExecuteUnselect (char * _szParameter);
int m_fn_iExecuteGetMenuItem (char * _szParameter , BOOL _bPopupMenu);
int m_fn_iExecuteFree (char * _szParameter);
int m_fn_iExecuteGetCount (char * _szParameter);
int m_fn_iExecuteMessageBox (char * _szParameter);
int m_fn_iExecuteSetResult (char * _szParameter);
int m_fn_iExecuteGetResult (char * _szParameter);
int m_fn_iExecuteKey (char * _szParameter);
int m_fn_iExecutePressOrRelease (char * _szParameter , BOOL _bKeyPressed);
int m_fn_iExecuteSetKeySpeed (char * _szParameter);
int m_fn_iExecuteIsExisting (char * _szParameter);
int m_fn_iExecuteGetLength (char * _szParameter);
int m_fn_iExecuteFindString (char * _szParameter);
int m_fn_iExecuteExtractString (char * _szParameter);
int m_fn_iExecuteBeep (char * _szParameter);
int m_fn_iExecutePlay (char * _szParameter);
int m_fn_iExecuteIsSelected (char * _szParameter);
int m_fn_iExecuteVar (char * _szParameter);
int m_fn_iExecuteGlobalVar (char * _szParameter);
int m_fn_iExecuteIsInList (char * _szParameter);
int m_fn_iExecuteSaveContext (char * _szParameter);
int m_fn_iExecuteRestoreContext (char * _szParameter);
int m_fn_iExecuteGetFocusWindow (char * _szParameter);
int m_fn_iExecuteHasFocus (char * _szParameter);
int m_fn_iExecuteSelectText (char * _szParameter);
// 3d view specific
int m_fn_iExecute3dGetPosition (char * _szParameter);
int m_fn_iExecute3dClic3dView (char * _szParameter);
int m_fn_iExecute3dIsProtected (char * _szParameter);
int m_fn_iExecute3dMove3d (char * _szParameter);
int m_fn_iExecute3dSelectModel (char * _szParameter);
int m_fn_iExecute3dGetModel (char * _szParameter);
int m_fn_iExecute3dGetNumberOfModels (char * _szParameter);
int m_fn_iExecute3dIsAvailable (char * _szParameter);
int m_fn_iExecute3dGetPrefix (char * _szParameter);
int m_fn_iExecute3dIsExistingModel (char * _szParameter);
int m_fn_iExecute3dGetStatusBarText (char * _szParameter);
// ***** private variables *****
private:
TUT_td_CArrayOfWnd m_oArrayOfWnd;
TUT_td_CListOfVariable m_oListOfVariable;
TUT_td_CListOfLoop m_oListOfLoop;
TUT_td_CListOfTest m_oListOfTest;
TUT_td_CListOfLabel m_oListOfLabel;
TUT_td_CListOfContext m_oListOfContext;
TUT_tdstWndDefinition * m_p_stCurrentUserWindow;
// Parameters for the mouse move
int m_lCurrentMaxDuration;
int m_lCurrentMinSpeed;
int m_lCurrentAcceleration;
// Parameter for the keyboard
int m_iDurationBetweenKeys;
BOOL m_bUseShift;
BOOL m_bUseAlt;
BOOL m_bUseControl;
// Parameters for the text attributes
COLORREF m_xCurrentColor;
long m_lCurrentHeight;
long m_lCurrentAlignment;
// Parameters for the selection
BOOL m_bUseRightButton;
BOOL m_bUseDoubleClic;
BOOL m_bUseDrag;
BOOL m_bUseDrop;
BOOL m_bUsePosition;
int m_iXPosition;
int m_iYPosition;
BOOL m_bRightBorder;
BOOL m_bBottomBorder;
BOOL m_bPercentForX;
BOOL m_bPercentForY;
// Paramater for the menu
TUT_tdstMenuDefinition m_stCurrentPopupMenu;
// The debug window
HWND m_hDebugWnd;
// The timer
UINT m_uiTimerNumber;
BOOL m_bBackGroundActive;
// The ID of the main thread
UINT m_uiMainThreadID;
BOOL m_bRunMode;
// The parameters (used by "Call") and the result
int m_iNumberOfParameter;
CString m_a_csParameter [9];
int m_iNumberOfResult;
CString m_a_csResult [9];
// The log file
TUT_tdstLogFileDefinition m_stLogFile;
// The Debug Log File
TUT_tdstLogFileDefinition m_stDebugLogFile;
// The jumps
BOOL m_bInsideAGoto;
CString m_csLabelToFind;
// The record of script
CStringList m_oListOfCommands;
BOOL m_bInPause;
clock_t m_xLastCommandTime;
long m_lDragDrop;
CString m_csDragDropElement;
TUT_tdeDragDropType m_eDragDropType;
// ***** private functions : low level functions (Tut_Mngr.inc)
private:
CString m_fn_csGetTreeCtrlItemText(HWND _hTreeCtrl , HTREEITEM _hItem);
// Get the text of one item of a tree ctrl
UINT m_fn_uiGetTreeCtrlState (HWND _hTreeCtrl , HTREEITEM _hItem , UINT _uiFlag);
// Get the state of one item of a tree ctrl
HTREEITEM m_fn_hFindStringInTree (HWND _hTreeCtrl , HTREEITEM _hRootItem , CString _csText);
// Search a string into a tree (recursiv function)
BOOL m_fn_bIsItemVisibleInTree (HWND _hTreeCtrl , HTREEITEM _hItem);
BOOL m_fn_bSearchWndDefinition (const CString _csName , int * _p_iIndex = NULL);
BOOL m_fn_bSearchWndDefinition (HWND _hWnd , int * _p_iIndex = NULL);
TUT_tdstWndDefinition * m_fnp_stFindWndDefinition (const CString _csName); // Search a window name into the list
public:
// This function must be public, because it is called by the callback timer function
TUT_tdstWndDefinition * m_fnp_stFindWndDefinition (HWND _hWnd); // Search a window handle into the list
private:
TUT_tdstLabelDefinition * m_fnp_stFindLabel (char * _szName); // Search a label name into the list
void m_fn_vSetValueToVariable (TUT_tdstVariableDefinition * , long);
void m_fn_vSetGetLastError (long _lErrorNumber);
int m_fn_iConvertToInt (char * _szString); // Convert a string into a integer.
// Return TUT_C_iErrorNotANumber if error
double m_fn_dConvertToDouble (char * _szString); // Convert a string into a double
// Return TUT_C_dErrorNotANumber if error
BOOL m_fn_bAreParametersEqual (char * _szParameter1 , char * _szParameter2);
BOOL m_fn_bIsParameter1LessThanParameter2
(char * _szParameter1 , char * _szParameter2);
BOOL m_fn_bIsParameterTrue (char * _szParameter , int * _p_iReturnValue);
BOOL m_fn_bIsTestVerified (char * _szTestOperator , char * _szParameter1 ,
char * _szParameter2 , int * _p_iReturnValue);
BOOL m_fn_bMustActionBeExecuted (); // Return if the current action must be executed
void m_fn_vAddAnActionForTheTest (); // Called each time an action is executed
void m_fn_vTestRightButtonDoubleClicAndPosition ();
BOOL m_fn_vPreprocessString (char * & _szString);
char * m_fn_szStrtok (char * _szString , char _cDelimiter);
int m_fn_iGetParameters (char * , int _iMinNumberOfParameter , int _iMaxNumberOfParameter ,
int * _p_iNumberOfParameter , ...);
void m_fn_vShowError (int _iErrorCode , const CString _csFileName , int _iLineNumber , char * _szLine);
void m_fn_vPumpMessage ();
void m_fn_vSleep (int _iDuration);
void m_fn_vActivateWindow (HWND _hWnd);
HWND m_fn_hOpenUserWindow (char * _szWindowName , int _iLeft , int _iTop , int _iRight , int _iBottom);
void m_fn_vCloseUserWindow (int _iIndex);
void m_fn_vDeleteLocalLabelAndVariable ();
void m_fn_vCloseLogFile (TUT_tdstLogFileDefinition * _p_stLogFile);
public:
// These functions must be public because they are called by the TUT_fn_dwBeginThread function
void m_fn_vClearAllList (BOOL _bUnregisterControl);
void m_fn_vCloseAllUserWindow ();
void m_fn_vCloseAllLogFiles ();
// This function must be public because it is called by the callback timer function
TUT_tdstVariableDefinition * m_fnp_stFindVariable (char * _szName); // Search a variable name into the list
char * m_fn_szGetWndNameType (TUT_tdeWndType _eType);
HWND m_fn_hGetDebugWindowHandle() { return m_hDebugWnd; }
private:
TUT_tdstVariableDefinition * m_fnp_stFindOrCreateVariable (char * _szName);
BOOL m_fn_bFindColor (char * _szColorName , COLORREF * _p_xColor);
int m_fn_iFindVirtualKeyCode (char * _szVirtualKeyCode);
int m_fn_iFindIdForMessageBox (char * _szControlName);
void m_fn_vMoveMouseCursor (CPoint _stDestination , HWND _hWnd = NULL);
void m_fn_vMoveMouseCursor (HWND _hWnd);
void m_fn_vClickOnControl (HWND _hButton); // Simulate a click on a button
void m_fn_vSetTextInEdit (HWND _hTextEdit , const CString); // Simulate an edition of text,
void m_fn_vSelectLineInComboBox (HWND _hComboBox , int _iLineNumber);
void m_fn_vSelectLineInListBox (HWND _hListBox , int _iLineNumber , BOOL _bAddToSelection = FALSE );
void m_fn_vSelectLineInListCtrl (HWND _hListCtrl , int _iLineNumber);
void m_fn_vEnsureVisibleInTree (HWND _hTreeCtrl , HTREEITEM _hItem ,
BOOL _bEnsureVisible = TRUE);
BOOL m_fn_bSelectItemInTreeBox (HWND _hTreeCtrl , CString _csTextToSelect);
void m_fn_vWriteText (HWND _hEditView , CString _csText);
void m_fn_vSendKey (int _iVirtualKeyCode , BOOL _bKeyPressed);
char *m_fn_szHandleQuote (char * _szString);
////////////////////////
BOOL m_fn_bStartStopHook (HMODULE _hModule, DWORD _dThreadID, BOOL _bStart);
BOOL m_fn_bCommandMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bLButtonMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bRButtonMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bFocusMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bNotifyMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bMenuMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bMouseMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
// Record List
void m_fn_vHandlePause (void);
void m_fn_vAddCommand (CString csCommand);
void m_fn_vInsertAfterPause (CString csCommand);
void m_fn_vAddPause (void);
void m_fn_vRemoveToPause (void);
BOOL m_fn_bHaveSomethingAfterPause (void);
void m_fn_vDeleteLastCommand (void);
// 3DView specific
BOOL m_fn_bIsModelView (HWND _hWnd);
BOOL m_fn_bLButtonUp3DViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bLButtonDown3DViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bLButtonUpModelViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
BOOL m_fn_bLButtonDownModelViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
};
//-----------------------------------------------------------------------------
extern TUT_CTutorialManager TUT_g_oTutorialManager;
#endif // #ifndef _TUT_MNGR_HPP_