Add rayman2 source files
This commit is contained in:
BIN
Rayman_X/cpa/tempgrp/Tut/TutLib/Doc/Présentation du tutorial.doc
Normal file
BIN
Rayman_X/cpa/tempgrp/Tut/TutLib/Doc/Présentation du tutorial.doc
Normal file
Binary file not shown.
18
Rayman_X/cpa/tempgrp/Tut/TutLib/Inc/StdAfx.h
Normal file
18
Rayman_X/cpa/tempgrp/Tut/TutLib/Inc/StdAfx.h
Normal file
@@ -0,0 +1,18 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
#ifndef __STDAAFX_H__
|
||||
#define __STDAAFX_H__
|
||||
|
||||
#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_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows 95 Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
#endif //__STDAAFX_H__
|
||||
|
716
Rayman_X/cpa/tempgrp/Tut/TutLib/Inc/Tut_Mngr.hpp
Normal file
716
Rayman_X/cpa/tempgrp/Tut/TutLib/Inc/Tut_Mngr.hpp
Normal file
@@ -0,0 +1,716 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* 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_
|
95
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/TutLib.dsp
Normal file
95
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/TutLib.dsp
Normal file
@@ -0,0 +1,95 @@
|
||||
# Microsoft Developer Studio Project File - Name="TutLib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=TutLib - Win32 Debug Glide with Editors
|
||||
!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 "TutLib.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 "TutLib.mak" CFG="TutLib - Win32 Debug Glide with Editors"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "TutLib - Win32 Debug Glide with Editors" (based on\
|
||||
"Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""$/CPA/TempGrp/Tut/TutLib/Make", NKKAAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
# PROP BASE Use_MFC 2
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Deubg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 2
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "x:\cpa\lib"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /I "..\inc" /I "..\..\..\public" /I "..\..\..\..\cpa\public" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_DM_MfcApp_" /D "CPA_WANTS_EXPORT" /D "_AFXDLL" /D "_____ACTIVE_EDITOR" /D "_____TUT_3D" /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "..\inc" /I "..\..\..\public" /I "\cpa\public" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_DM_MfcApp_" /D "CPA_WANTS_IMPORT" /D "_AFXDLL" /D "ACTIVE_EDITOR" /D "TUT_3D" /D "USE_ALTIMAPS" /FR /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\lib\Tut_d.lib"
|
||||
# ADD LIB32 /nologo /out:"x:\cpa\lib\Tut_d.lib"
|
||||
# Begin Target
|
||||
|
||||
# Name "TutLib - Win32 Debug Glide with Editors"
|
||||
# Begin Group "Src"
|
||||
|
||||
# PROP Default_Filter "c*"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Src\Tut_3d.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Src\Tut_Mngr.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Src\Tut_Mngr.cxx
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Src\Tut_Mngr.inc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Inc"
|
||||
|
||||
# PROP Default_Filter "h*"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Inc\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Inc\Tut_Mngr.hpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Doc"
|
||||
|
||||
# PROP Default_Filter "*.doc;*.txt;*.xls"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\Doc\Pr<50>sentation du tutorial.doc"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TutLib.mak
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
135
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/TutLib.vcproj
Normal file
135
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/TutLib.vcproj
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="TutLib"
|
||||
ProjectGUID="{7B87BF0D-3EF0-4C6F-B75A-637676F33403}"
|
||||
SccProjectName=""$/CPA/TempGrp/Tut/TutLib/Make", NKKAAAAA"
|
||||
SccLocalPath="."
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug Glide with Editors|Win32"
|
||||
OutputDirectory="x:\cpa\lib"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\inc,..\..\..\public,\cpa\public"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_DM_MfcApp_;CPA_WANTS_IMPORT;ACTIVE_EDITOR;TUT_3D;USE_ALTIMAPS"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/TutLib.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="1"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="x:\cpa\libd\Tut_d.lib"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Src"
|
||||
Filter="c*">
|
||||
<File
|
||||
RelativePath="..\Src\Tut_3d.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug Glide with Editors|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Src\Tut_Mngr.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug Glide with Editors|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Src\Tut_Mngr.cxx">
|
||||
<FileConfiguration
|
||||
Name="Debug Glide with Editors|Win32"
|
||||
ExcludedFromBuild="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Src\Tut_Mngr.inc">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Inc"
|
||||
Filter="h*">
|
||||
<File
|
||||
RelativePath="..\Inc\StdAfx.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Inc\Tut_Mngr.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Doc"
|
||||
Filter="*.doc;*.txt;*.xls">
|
||||
<File
|
||||
RelativePath="..\Doc\Pr<50>sentation du tutorial.doc">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="TutLib.mak">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
5
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/mssccprj.scc
Normal file
5
Rayman_X/cpa/tempgrp/Tut/TutLib/Make/mssccprj.scc
Normal file
@@ -0,0 +1,5 @@
|
||||
SCC = This is a source code control file
|
||||
|
||||
[TutLib.vcproj]
|
||||
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
|
||||
SCC_Project_Name = Perforce Project
|
918
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_3d.cpp
Normal file
918
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_3d.cpp
Normal file
@@ -0,0 +1,918 @@
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Tut_3d.cpp : definition of the TUT_CTutorialManager class *
|
||||
* *
|
||||
* Contains the methods of the class that are specific to the 3d view *
|
||||
* So it is dependant on the ACP. *
|
||||
* The symbol TUT_3D must be defined for this file to be compiled *
|
||||
* *
|
||||
* Author : Alexis Vaisse *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef TUT_3D
|
||||
#include "stdafx.h"
|
||||
#include "Tut_Mngr.hpp"
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetPosition (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dClic3dView (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsProtected (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dMove3d (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dSelectModel (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetModel (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetNumberOfModels (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsAvailable (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetPrefix (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsExistingModel (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetStatusBarText (char *) { return TUT_C_iError_FunctionNotCompiled; }
|
||||
// 3DView specific
|
||||
BOOL TUT_CTutorialManager::m_fn_bIsModelView (HWND _hWnd) { return FALSE; }
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonDown3DViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) { return FALSE;}
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonUp3DViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) { return FALSE;}
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonDownModelViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) { return FALSE;}
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonUpModelViewProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) { return FALSE;}
|
||||
#else
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ACP_Base.h"
|
||||
#include "ITF.h"
|
||||
#include "OGD.h"
|
||||
#include "IncOPD.h"
|
||||
#include "\CPA\Main\inc\_EditID.h"
|
||||
#include "Tut_Mngr.hpp"
|
||||
|
||||
#define TUT_M_GetCurrentWorld() (M_GetMainApp () -> fn_p_oGetMainWorld () -> M_GetWorld ())
|
||||
#define TUT_M_GetCurrentViewPort() ((DEV_ViewPort3D *) (DEV_ViewPort *) M_GetMainDevice2 () -> GetDevice (M_GetMainDevice2 () -> GetFocusDevice () -> GetNumber()) -> GetViewPort())
|
||||
#define TUT_M_GetCurrentEditor() (M_GetMainApp () -> fn_p_oGetMainWorld () -> GetCurrentEditor ())
|
||||
|
||||
MTH3D_tdstVector g_stInitialPoint;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fnp_oFindSuperObjectByName
|
||||
// Find a super objet which has an associated object of the given name
|
||||
// Return NULL if not found
|
||||
//-----------------------------------------------------------------------------
|
||||
CPA_SuperObject * fnp_oFindSuperObjectByName (char * _sz3dObjectName)
|
||||
{
|
||||
CPA_List<CPA_SuperObject> * pListOfSuperObject = TUT_M_GetCurrentWorld () -> GetListAllObjects ();
|
||||
ASSERT (pListOfSuperObject);
|
||||
|
||||
POSITION Pos = pListOfSuperObject -> GetHeadPosition ();
|
||||
while (Pos)
|
||||
{
|
||||
CPA_SuperObject * pSuperObject = (CPA_SuperObject *) pListOfSuperObject -> GetNext (Pos);
|
||||
CPA_BaseObject * pObject = pSuperObject -> GetObject ();
|
||||
|
||||
if (pObject && stricmp (pObject -> fn_p_szGetName () , _sz3dObjectName) == 0) return pSuperObject;
|
||||
}
|
||||
|
||||
return NULL; // Not found
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fnp_oFindSuperObjectByHandle
|
||||
// Find a super objet which has an associated object of the given engine handle
|
||||
// Return NULL if not found
|
||||
//-----------------------------------------------------------------------------
|
||||
CPA_SuperObject * fnp_oFindSuperObjectByHandle (HIE_tdxHandleToSuperObject _hSupObject)
|
||||
{
|
||||
CPA_List<CPA_SuperObject> * pListOfSuperObject = TUT_M_GetCurrentWorld () -> GetListAllObjects ();
|
||||
ASSERT (pListOfSuperObject);
|
||||
|
||||
POSITION Pos = pListOfSuperObject -> GetHeadPosition ();
|
||||
while (Pos)
|
||||
{
|
||||
CPA_SuperObject * pSuperObject = (CPA_SuperObject *) pListOfSuperObject -> GetNext (Pos);
|
||||
|
||||
if (pSuperObject -> GetData () == (void*)_hSupObject) return pSuperObject;
|
||||
}
|
||||
|
||||
return NULL; // Not found
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// fn_bGetPointOfSuperObject
|
||||
// Compute the coordinate of one point of the given super object
|
||||
// (hope we will select the object when clicking on this point)
|
||||
// Return FALSE if it cannot find one point
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL fn_bGetPointOfSuperObject (CPA_SuperObject * _pSuperObject , MTH3D_tdstVector * _p_stPosition)
|
||||
{
|
||||
POS_tdstCompletePosition * pGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (_pSuperObject -> GetStruct ());
|
||||
POS_fn_vGetTranslationVector (pGlobalMatrix , _p_stPosition); // Compute origine point in world coordinates
|
||||
|
||||
// Geometric object : we can found one point
|
||||
CPA_BaseObject * pObject = _pSuperObject -> GetObject ();
|
||||
if (pObject && (pObject -> fn_bIsOfType (C_szGeometricObjectTypeName) ||
|
||||
pObject -> fn_bIsOfType (C_szPhysicalObjectTypeName)))
|
||||
{
|
||||
ACP_tdxHandleOfObject hObject;
|
||||
if (pObject -> fn_bIsOfType (C_szGeometricObjectTypeName))
|
||||
hObject = (ACP_tdxHandleOfObject) pObject -> GetData ();
|
||||
else
|
||||
if (pObject -> fn_bIsOfType (C_szPhysicalObjectTypeName ))
|
||||
hObject = (ACP_tdxHandleOfObject) ((EditorPO *) pObject) -> m_fnp_oGetGeometricWithDistance (0.0) -> GetData ();
|
||||
else ASSERT (0);
|
||||
|
||||
if (GEO_xGetGeometricObjectNumberOfPoints (hObject) > 0)
|
||||
{
|
||||
// Compute barycenter
|
||||
MTH3D_tdstVector Total;
|
||||
MTH3D_M_vNullVector (& Total);
|
||||
for (ACP_tdxIndex xNumPoint = 0 ; xNumPoint < GEO_xGetGeometricObjectNumberOfPoints (hObject) ; xNumPoint++)
|
||||
{
|
||||
MTH3D_tdstVector Point;
|
||||
GEO_vGetPointOfObject (hObject , & Point, xNumPoint);
|
||||
MTH3D_M_vAddVector (& Total , & Total , & Point);
|
||||
}
|
||||
MTH3D_M_vDivScalarVector (& Total , & Total , GEO_xGetGeometricObjectNumberOfPoints (hObject));
|
||||
|
||||
POS_fn_vMulMatrixVertex(_p_stPosition , pGlobalMatrix , & Total); // Convert in world coordinates
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
CPA_SuperObject * pChildSuperObject = _pSuperObject -> GetSuperObjectFirstChild ();
|
||||
while (pChildSuperObject)
|
||||
{
|
||||
if (fn_bGetPointOfSuperObject (pChildSuperObject , _p_stPosition)) return TRUE;
|
||||
pChildSuperObject = _pSuperObject -> GetSuperObjectNextChild (pChildSuperObject);
|
||||
}
|
||||
|
||||
return FALSE; // Not found
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// gs_fn_p_oGetModelView
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
//-----------------------------------------------------------------------------
|
||||
C3ListView *gs_fn_p_oGetModelView()
|
||||
{
|
||||
C3ListView *p_oListView = NULL;
|
||||
CPA_EditorBase *p_oCurrentEditor = TUT_M_GetCurrentEditor ();
|
||||
|
||||
if( p_oCurrentEditor && p_oCurrentEditor -> GetCurrentEditorName() == C_szDLLMaterialName )
|
||||
{
|
||||
CSplitFrame * p_oBottomFrame = (CSplitFrame*)g_oFrameGest . ma_p_oWinArray [2] [3];
|
||||
ASSERT (p_oBottomFrame);
|
||||
p_oListView = (C3ListView*)p_oBottomFrame -> m_fn_p_oGetPane (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the model view
|
||||
FRMBase * p_oModelFrame = g_oFrameGest . ma_p_oWinArray [2] [3];
|
||||
ASSERT (p_oModelFrame);
|
||||
CPA_DialogInsert * p_oModelWnd = (CPA_DialogInsert *) p_oModelFrame -> GetWindow (GW_CHILD);
|
||||
ASSERT (p_oModelWnd);
|
||||
EDT_ModelView * p_oModelView = p_oModelWnd -> GetModelView ();
|
||||
ASSERT (p_oModelView);
|
||||
p_oListView = (C3ListView*) p_oModelView;
|
||||
}
|
||||
return p_oListView;
|
||||
}
|
||||
|
||||
CStatusBar *gs_fn_p_oGetStatusBar()
|
||||
{
|
||||
FRMBaseMenu *p_FRMBaseMenu = M_GetMainWnd2();
|
||||
|
||||
if( p_FRMBaseMenu )
|
||||
return & p_FRMBaseMenu -> m_oStatusBar;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dGetPosition
|
||||
// Execute a "get position" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetPosition (char * _szParameter)
|
||||
{
|
||||
// Get parameters : 3d object name and variable name for X, variable name for Y, variable name for Z
|
||||
int iNumberOfParameter;
|
||||
char * sz3dObjectName , * szVariableNameForX , * szVariableNameForY , * szVariableNameForZ;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 4 , 4 , & iNumberOfParameter , & sz3dObjectName ,
|
||||
& szVariableNameForX , & szVariableNameForY , & szVariableNameForZ);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
// Search the super object
|
||||
CPA_SuperObject * pSuperObject = fnp_oFindSuperObjectByName (sz3dObjectName);
|
||||
if (! pSuperObject) return TUT_C_iError_Unknown3dObject;
|
||||
|
||||
// Find the three variables
|
||||
TUT_tdstVariableDefinition * p_stVariableForX = m_fnp_stFindVariable (szVariableNameForX);
|
||||
TUT_tdstVariableDefinition * p_stVariableForY = m_fnp_stFindVariable (szVariableNameForY);
|
||||
TUT_tdstVariableDefinition * p_stVariableForZ = m_fnp_stFindVariable (szVariableNameForZ);
|
||||
if (p_stVariableForX == NULL || p_stVariableForY == NULL || p_stVariableForZ == NULL)
|
||||
return TUT_C_iError_UnknownVariable;
|
||||
|
||||
MTH3D_tdstVector stTranslationVector;
|
||||
fn_bGetPointOfSuperObject (pSuperObject , & stTranslationVector);
|
||||
|
||||
p_stVariableForX -> csValue . Format ("%.6g" , stTranslationVector . xX);
|
||||
p_stVariableForY -> csValue . Format ("%.6g" , stTranslationVector . xY);
|
||||
p_stVariableForZ -> csValue . Format ("%.6g" , stTranslationVector . xZ);
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dClic3dView
|
||||
// Execute a "clic 3d view" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dClic3dView (char * _szParameter)
|
||||
{
|
||||
// Get parameter : 3d object name or three coordinates
|
||||
int iNumberOfParameter;
|
||||
char * szParameter1 , * szParameter2 , * szParameter3;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 1 , 3 , & iNumberOfParameter ,
|
||||
& szParameter1 , & szParameter2 , & szParameter3);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
if (iNumberOfParameter == 2) return TUT_C_iError_ParameterRequired; // Only 1 or 3 parameters
|
||||
|
||||
MTH3D_tdstVector stTranslationVector;
|
||||
CPA_SuperObject * pSuperObject = NULL;
|
||||
double dX , dY , dZ;
|
||||
dX = dY = dZ = 0.0;
|
||||
|
||||
if (iNumberOfParameter == 1) // One parameter : this is the name of the 3d object
|
||||
{
|
||||
// Get the super object
|
||||
pSuperObject = fnp_oFindSuperObjectByName (szParameter1);
|
||||
if (! pSuperObject) return TUT_C_iError_Unknown3dObject;
|
||||
|
||||
// Get the position of the super object
|
||||
fn_bGetPointOfSuperObject (pSuperObject , & stTranslationVector);
|
||||
}
|
||||
else // Three parameters : this is the three coordinates
|
||||
{
|
||||
dX = m_fn_dConvertToDouble (szParameter1);
|
||||
dY = m_fn_dConvertToDouble (szParameter2);
|
||||
dZ = m_fn_dConvertToDouble (szParameter3);
|
||||
|
||||
if (dX == TUT_C_dErrorNotANumber || dY == TUT_C_dErrorNotANumber || dZ == TUT_C_dErrorNotANumber)
|
||||
return TUT_C_iError_InvalidNumber;
|
||||
|
||||
MTH3D_M_vSetVectorElements (& stTranslationVector , MTH_M_xDoubleToReal (dX) , MTH_M_xDoubleToReal (dY) , MTH_M_xDoubleToReal (dZ));
|
||||
}
|
||||
|
||||
// Convert this 3D position into a 2D position
|
||||
GLI_tdst2DVertex st2DPosition;
|
||||
DEV_ViewPort3D * pViewport3d = TUT_M_GetCurrentViewPort ();
|
||||
pViewport3d -> Convert3dTo2d (& st2DPosition , & stTranslationVector);
|
||||
CPoint Pos;
|
||||
Pos . x = (long) st2DPosition . xX;
|
||||
Pos . y = (long) st2DPosition . xY;
|
||||
if (GLI_lWhatIsGLI () == GLI_C_VersionGlide) pViewport3d -> VoodooToClient (Pos);
|
||||
|
||||
// Check if this 2D position is inside the 3D view
|
||||
CRect stViewport3dRect;
|
||||
pViewport3d -> GetClientRect (& stViewport3dRect);
|
||||
if (! stViewport3dRect . PtInRect (Pos))
|
||||
{
|
||||
// If not, zoom the camera to the object or the point and refresh the display
|
||||
if (iNumberOfParameter == 1)
|
||||
{
|
||||
pViewport3d -> GetCameraInterface () -> ZoomOnTarget (pViewport3d -> GetCamera () , pSuperObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPA_CameraCoords oCameraCoords (WorldCoordinates , (float) dX , (float) dY , (float) dZ);
|
||||
pViewport3d -> GetCameraInterface () -> SetTargetPoint (pViewport3d -> GetCamera () , & oCameraCoords);
|
||||
pViewport3d -> GetCameraInterface () -> SetTargetType (pViewport3d -> GetCamera () , tPoint);
|
||||
pViewport3d -> GetCameraInterface () -> Update (pViewport3d -> GetCamera ());
|
||||
pViewport3d -> GetCameraInterface () -> SetTargetType (pViewport3d -> GetCamera () , tNone);
|
||||
}
|
||||
pViewport3d -> GetCameraInterface () -> GetInterface () -> fn_vUpdateAll (E_mc_JustDraw);
|
||||
|
||||
// And compute the new 3D position
|
||||
pViewport3d -> Convert3dTo2d (& st2DPosition , & stTranslationVector);
|
||||
Pos . x = (long) st2DPosition . xX;
|
||||
Pos . y = (long) st2DPosition . xY;
|
||||
if (GLI_lWhatIsGLI () == GLI_C_VersionGlide) pViewport3d -> VoodooToClient (Pos);
|
||||
}
|
||||
|
||||
CPoint ScreenPos = Pos;
|
||||
pViewport3d -> ClientToScreen (& ScreenPos);
|
||||
m_fn_vMoveMouseCursor (ScreenPos , pViewport3d -> m_hWnd);
|
||||
|
||||
LPARAM lParam = MAKELPARAM (Pos . x , Pos . y);
|
||||
WPARAM wParam = (m_bUseShift ? MK_SHIFT : 0) | (m_bUseControl ? MK_CONTROL : 0);
|
||||
|
||||
if (m_bUseDrop)
|
||||
{
|
||||
//Sleep (0); // To be sure the last OnMouseMove message has been treated when making a drag and drop
|
||||
//m_fn_vSleep(10);
|
||||
Sleep(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bUseRightButton) pViewport3d -> PostMessage (WM_RBUTTONDOWN , wParam + MK_RBUTTON , lParam);
|
||||
else pViewport3d -> PostMessage (WM_LBUTTONDOWN , wParam + MK_LBUTTON , lParam);
|
||||
m_fn_vSleep (60);
|
||||
}
|
||||
|
||||
if (m_bUseRightButton) pViewport3d -> PostMessage (WM_RBUTTONUP , wParam , lParam);
|
||||
else pViewport3d -> PostMessage (WM_LBUTTONUP , wParam , lParam);
|
||||
m_fn_vSleep (60);
|
||||
|
||||
if (m_bUseDoubleClic)
|
||||
{
|
||||
if (m_bUseRightButton)
|
||||
{
|
||||
pViewport3d -> PostMessage (WM_RBUTTONDBLCLK , wParam + MK_RBUTTON , lParam);
|
||||
m_fn_vSleep (60);
|
||||
pViewport3d -> PostMessage (WM_RBUTTONUP , wParam , lParam);
|
||||
m_fn_vSleep (60);
|
||||
}
|
||||
else
|
||||
{
|
||||
pViewport3d -> PostMessage (WM_LBUTTONDBLCLK , wParam + MK_LBUTTON , lParam);
|
||||
m_fn_vSleep (60);
|
||||
pViewport3d -> PostMessage (WM_LBUTTONUP , wParam , lParam);
|
||||
m_fn_vSleep (60);
|
||||
}
|
||||
}
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dIsProtected
|
||||
// Execute a "is protected" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsProtected (char * _szParameter)
|
||||
{
|
||||
// Get parameters : 3d object name and variable name
|
||||
int iNumberOfParameter;
|
||||
char * sz3dObjectName , * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 2 , 2 , & iNumberOfParameter , & sz3dObjectName , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
// Search the super object
|
||||
CPA_SuperObject * pSuperObject = fnp_oFindSuperObjectByName (sz3dObjectName);
|
||||
if (! pSuperObject) return TUT_C_iError_Unknown3dObject;
|
||||
|
||||
// Find the variable
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
p_stVariableDef -> csValue = pSuperObject -> fn_bIsEditProtected () ? TUT_C_szTrue : TUT_C_szFalse;
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dMove3d
|
||||
// Execute a "move 3D" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dMove3d (char * _szParameter)
|
||||
{
|
||||
// Get parameters : 3d object name, (X,Y) translation coordinates
|
||||
int iNumberOfParameter;
|
||||
char * sz3dObjectName , * szDeltaX , * szDeltaY;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 3 , 3 , & iNumberOfParameter , & sz3dObjectName ,
|
||||
& szDeltaX , & szDeltaY);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
// Search the super object
|
||||
CPA_SuperObject * pSuperObject = fnp_oFindSuperObjectByName (sz3dObjectName);
|
||||
if (! pSuperObject) return TUT_C_iError_Unknown3dObject;
|
||||
|
||||
// Get the coordinates
|
||||
double dDeltaX = m_fn_dConvertToDouble (szDeltaX);
|
||||
double dDeltaY = m_fn_dConvertToDouble (szDeltaY);
|
||||
if (dDeltaX == TUT_C_dErrorNotANumber || dDeltaY == TUT_C_dErrorNotANumber) return TUT_C_iError_InvalidNumber;
|
||||
|
||||
// Get the position of the super object
|
||||
MTH3D_tdstVector stTranslationVector;
|
||||
fn_bGetPointOfSuperObject (pSuperObject , & stTranslationVector);
|
||||
|
||||
// Convert this 3D position into a 2D position
|
||||
GLI_tdst2DVertex st2DPosition;
|
||||
DEV_ViewPort3D * pViewport3d = TUT_M_GetCurrentViewPort ();
|
||||
pViewport3d -> Convert3dTo2d (& st2DPosition , & stTranslationVector);
|
||||
CPoint Pos;
|
||||
|
||||
Pos . x = (long) st2DPosition . xX;
|
||||
Pos . y = (long) st2DPosition . xY;
|
||||
if (GLI_lWhatIsGLI () == GLI_C_VersionGlide) pViewport3d -> VoodooToClient (Pos);
|
||||
|
||||
// Send a LBUTTONDOWN message
|
||||
WPARAM wParam = (m_bUseShift ? MK_SHIFT : 0) | (m_bUseControl ? MK_CONTROL : 0);
|
||||
CPoint ScreenPos = Pos;
|
||||
pViewport3d -> ClientToScreen (& ScreenPos);
|
||||
m_fn_vMoveMouseCursor (ScreenPos , pViewport3d -> m_hWnd);
|
||||
pViewport3d -> SendMessage (WM_LBUTTONDOWN , wParam + MK_LBUTTON , MAKELPARAM (Pos . x , Pos . y));
|
||||
|
||||
// Compute the final position
|
||||
CPA_SuperObject * pCameraSuperObject = pViewport3d -> GetCameraSO ();
|
||||
POS_tdxHandleToPosition hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (pCameraSuperObject -> GetStruct ());
|
||||
MTH3D_tdstVector stVectorX , stVectorY , stVectorZ;
|
||||
POS_fn_vGetRotationMatrix (hGlobalMatrix , & stVectorX , & stVectorY , & stVectorZ);
|
||||
|
||||
MTH3D_M_vMulScalarVector (& stVectorX , MTH_M_xDoubleToReal (- dDeltaX) , & stVectorX);
|
||||
MTH3D_M_vMulScalarVector (& stVectorY , MTH_M_xDoubleToReal (- dDeltaY) , & stVectorY);
|
||||
|
||||
MTH3D_tdstVector stDelta;
|
||||
MTH3D_M_vAddVector (& stDelta , & stVectorX , & stVectorY);
|
||||
MTH3D_M_vAddVector (& stTranslationVector , & stDelta , & stTranslationVector);
|
||||
|
||||
// Compute the final 3D position into a 2D position
|
||||
pViewport3d -> Convert3dTo2d (& st2DPosition , & stTranslationVector);
|
||||
Pos . x = (long) st2DPosition . xX;
|
||||
Pos . y = (long) st2DPosition . xY;
|
||||
if (GLI_lWhatIsGLI () == GLI_C_VersionGlide) pViewport3d -> VoodooToClient (Pos);
|
||||
|
||||
// Send a LBUTTONUP message
|
||||
ScreenPos = Pos;
|
||||
pViewport3d -> ClientToScreen (& ScreenPos);
|
||||
m_fn_vMoveMouseCursor (ScreenPos , pViewport3d -> m_hWnd);
|
||||
pViewport3d -> SendMessage (WM_LBUTTONUP , wParam , MAKELPARAM (Pos . x , Pos . y));
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dSelectModel
|
||||
// Execute a "select model" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dSelectModel (char * _szParameter)
|
||||
{
|
||||
// Get parameter : model name
|
||||
int iNumberOfParameter;
|
||||
char * szModelName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 1 , 1 , & iNumberOfParameter , & szModelName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
C3ListView *p_oListView = gs_fn_p_oGetModelView ();
|
||||
ASSERT( p_oListView );
|
||||
|
||||
// Find the model into the view
|
||||
long lIndex = p_oListView -> m_fn_lFindName (-1 , szModelName , p_oListView -> m_fn_cGetOrder ());
|
||||
if (lIndex == TSL_cItemNotFound) return TUT_C_iError_ModelNotFound;
|
||||
|
||||
// To be sure the model will be visible
|
||||
p_oListView -> m_vScrollToMakeItemVisible ((short) lIndex);
|
||||
|
||||
// Get the position of the model
|
||||
CRect stRect;
|
||||
p_oListView -> m_fn_vGetCaseRect ((short) lIndex , & stRect);
|
||||
POINT stCenter = stRect . CenterPoint ();
|
||||
|
||||
// Move the mouse cursor to the model
|
||||
p_oListView -> ClientToScreen (& stRect);
|
||||
m_fn_vMoveMouseCursor (stRect . CenterPoint ());
|
||||
|
||||
WPARAM wParam = (m_bUseShift ? MK_SHIFT : 0) | (m_bUseControl ? MK_CONTROL : 0);
|
||||
// Clic to select the model
|
||||
PostMessage (p_oListView -> m_hWnd , WM_LBUTTONDOWN , wParam + MK_LBUTTON , MAKELPARAM (stCenter . x , stCenter . y));
|
||||
// Release the button if this is not a drag & drop
|
||||
if (! m_bUseDrag)
|
||||
PostMessage (p_oListView -> m_hWnd , WM_LBUTTONUP , wParam , MAKELPARAM (stCenter . x , stCenter . y));
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dGetModel
|
||||
// Execute a "get model" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetModel (char * _szParameter)
|
||||
{
|
||||
// Get parameter : variable name
|
||||
int iNumberOfParameter;
|
||||
char * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 1 , 1 , & iNumberOfParameter , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
C3ListView *p_oListView = gs_fn_p_oGetModelView ();
|
||||
ASSERT( p_oListView );
|
||||
|
||||
// Find the variable
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
// Get the selected item
|
||||
long lIndex = p_oListView -> m_fn_lGetSelectedItem (p_oListView -> m_fn_cGetOrder ());
|
||||
|
||||
// Get the name of the item and fill the variable
|
||||
if (lIndex == TSL_cItemNotFound) p_stVariableDef -> csValue = "";
|
||||
else p_stVariableDef -> csValue = p_oListView -> m_fn_csGetName (lIndex , p_oListView -> m_fn_cGetOrder ());
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dGetNumberOfModels
|
||||
// Execute a "get number of models" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetNumberOfModels (char * _szParameter)
|
||||
{
|
||||
// Get parameter : variable name
|
||||
int iNumberOfParameter;
|
||||
char * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 1 , 1 , & iNumberOfParameter , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
C3ListView *p_oListView = gs_fn_p_oGetModelView ();
|
||||
ASSERT( p_oListView );
|
||||
|
||||
// Get the number of models
|
||||
long lNumberOfModel = p_oListView -> m_fn_lGetCount ();
|
||||
|
||||
// Find the variable and fill it
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
m_fn_vSetValueToVariable (p_stVariableDef , lNumberOfModel);
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dIsAvailable
|
||||
// Execute a "is available" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsAvailable (char * _szParameter)
|
||||
{
|
||||
// Get parameters : object name, type name and variable name
|
||||
int iNumberOfParameter;
|
||||
char * szObjectName , * szTypeName , * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 3 , 3 , & iNumberOfParameter ,
|
||||
& szObjectName , & szTypeName , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
CPA_BaseObject * pObject = M_GetMainApp () -> fn_p_oGetMainWorld () ->
|
||||
fn_p_oFindObject (szObjectName , szTypeName , NO_CRITERIA , E_rc_AllObjects);
|
||||
if (! pObject) return TUT_C_iError_UnknownObject;
|
||||
|
||||
p_stVariableDef -> csValue = pObject -> fn_bIsAvailable () ? TUT_C_szTrue : TUT_C_szFalse;
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dGetPrefix
|
||||
// Execute a "get prefix" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetPrefix (char * _szParameter)
|
||||
{
|
||||
// Get parameters : variable name
|
||||
int iNumberOfParameter;
|
||||
char * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 1 , 1 , & iNumberOfParameter , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
p_stVariableDef -> csValue = M_GetMainApp () -> GetInterface () -> GetUserPrefix ();
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dIsExistingModel
|
||||
// Execute a "Is Existing Model" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dIsExistingModel (char * _szParameter)
|
||||
{
|
||||
// Get parameters : variable name
|
||||
int iNumberOfParameter;
|
||||
char * szModelName , * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 2 , 2 , & iNumberOfParameter , & szModelName , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
C3ListView *p_oListView = gs_fn_p_oGetModelView ();
|
||||
ASSERT( p_oListView );
|
||||
|
||||
// Find the model into the view
|
||||
long lIndex = p_oListView -> m_fn_lFindName (-1 , szModelName , p_oListView -> m_fn_cGetOrder ());
|
||||
p_stVariableDef -> csValue = lIndex == TSL_cItemNotFound ? TUT_C_szFalse : TUT_C_szTrue;
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_iExecute3dGetStatusBarText
|
||||
// Execute a "Is Existing Model" tutorial script action
|
||||
// Return 0 if no error
|
||||
//-----------------------------------------------------------------------------
|
||||
int TUT_CTutorialManager::m_fn_iExecute3dGetStatusBarText (char * _szParameter)
|
||||
{
|
||||
// Get parameters : variable name
|
||||
int iNumberOfParameter;
|
||||
char * szPaneNumber , * szVariableName;
|
||||
|
||||
int iReturnValue = m_fn_iGetParameters (_szParameter , 2 , 2 , & iNumberOfParameter , & szPaneNumber , & szVariableName);
|
||||
if (iReturnValue != TUT_C_iNoError) return iReturnValue;
|
||||
|
||||
TUT_tdstVariableDefinition * p_stVariableDef = m_fnp_stFindVariable (szVariableName);
|
||||
if (p_stVariableDef == NULL) return TUT_C_iError_UnknownVariable;
|
||||
|
||||
CStatusBar *p_oStatusBar = gs_fn_p_oGetStatusBar ();
|
||||
ASSERT( p_oStatusBar );
|
||||
|
||||
CStatusBarCtrl &rStat = p_oStatusBar -> GetStatusBarCtrl ();
|
||||
|
||||
char szText[512];
|
||||
int iPane = m_fn_iConvertToInt (szPaneNumber);
|
||||
int iType;
|
||||
|
||||
rStat . GetText (szText , iPane , &iType);
|
||||
p_stVariableDef -> csValue = szText;
|
||||
|
||||
return TUT_C_iNoError;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_bIsModelView
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bIsModelView (HWND _hWnd)
|
||||
{
|
||||
C3ListView *p_oListView = NULL;
|
||||
CPA_EditorBase *p_oCurrentEditor = TUT_M_GetCurrentEditor ();
|
||||
|
||||
if( p_oCurrentEditor && p_oCurrentEditor -> GetCurrentEditorName() == C_szDLLMaterialName )
|
||||
{
|
||||
CSplitFrame * p_oBottomFrame = (CSplitFrame*)g_oFrameGest . ma_p_oWinArray [2] [3];
|
||||
if (p_oBottomFrame)
|
||||
{
|
||||
p_oListView = (C3ListView*)p_oBottomFrame -> m_fn_p_oGetPane (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the model view
|
||||
FRMBase * p_oModelFrame = g_oFrameGest . ma_p_oWinArray [2] [3];
|
||||
if (p_oModelFrame)
|
||||
{
|
||||
CPA_DialogInsert * p_oModelWnd = (CPA_DialogInsert *) p_oModelFrame -> GetWindow (GW_CHILD);
|
||||
if (p_oModelWnd)
|
||||
{
|
||||
EDT_ModelView * p_oModelView = p_oModelWnd -> GetModelView ();
|
||||
if (p_oModelView)
|
||||
p_oListView = (C3ListView*) p_oModelView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (p_oListView && p_oListView -> m_hWnd == _hWnd);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_bLButtonDown3DViewProc
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonDown3DViewProc(int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CString csText;
|
||||
CPoint oPoint(LOWORD(lParam),HIWORD(lParam));
|
||||
DEV_ViewPort3D * pViewport3d = TUT_M_GetCurrentViewPort ();
|
||||
tdstMousePos stMousePos;
|
||||
HIE_tdxHandleToSuperObject hSupObject;
|
||||
HIE_aDEF_stTabOfPickInfo a_stPickInfo;
|
||||
ACP_tdxIndex xNbPicked;
|
||||
|
||||
pViewport3d -> PointToMousePos (oPoint, &stMousePos);
|
||||
|
||||
//try to pick an object
|
||||
hSupObject = pViewport3d -> GetParentMultiDevice3D()->GetEngineWorld();
|
||||
if (hSupObject != NULL)
|
||||
{
|
||||
xNbPicked = HIE_xIsSuperObjectPick(GLI_C_ModePickingFace,pViewport3d -> m_hDisplayDevice,
|
||||
pViewport3d -> m_hDisplayViewport, &stMousePos.stPos2D, hSupObject, a_stPickInfo);
|
||||
|
||||
if (xNbPicked > 0)
|
||||
{
|
||||
m_lDragDrop = 1;
|
||||
m_eDragDropType = TUT_eMove3d;
|
||||
MTH3D_M_vCopyVector (&g_stInitialPoint , &((((a_stPickInfo[0]).stPickedObject).aDEF_stDataOfElement[0]).stHit));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_bLButtonUp3DViewProc
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonUp3DViewProc(int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CString csText;
|
||||
CPoint oPoint(LOWORD(lParam),HIWORD(lParam));
|
||||
DEV_ViewPort3D * pViewport3d = TUT_M_GetCurrentViewPort ();
|
||||
tdstMousePos stMousePos;
|
||||
HIE_tdxHandleToSuperObject hSupObject;
|
||||
HIE_aDEF_stTabOfPickInfo a_stPickInfo;
|
||||
ACP_tdxIndex xNbPicked;
|
||||
|
||||
pViewport3d -> PointToMousePos (oPoint, &stMousePos);
|
||||
|
||||
//try to pick an object
|
||||
hSupObject = pViewport3d -> GetParentMultiDevice3D()->GetEngineWorld();
|
||||
if (hSupObject != NULL)
|
||||
{
|
||||
xNbPicked = HIE_xIsSuperObjectPick(GLI_C_ModePickingFace,pViewport3d -> m_hDisplayDevice,
|
||||
pViewport3d -> m_hDisplayViewport, &stMousePos.stPos2D, hSupObject, a_stPickInfo);
|
||||
|
||||
if (xNbPicked > 0)
|
||||
{
|
||||
switch (m_eDragDropType)
|
||||
{
|
||||
case TUT_eMove3d:
|
||||
{
|
||||
if (m_lDragDrop > 1 && !TUT_M_GetCurrentWorld () -> GetListSelected () -> IsEmpty ())
|
||||
{
|
||||
MTH3D_tdstVector stDeplacement;
|
||||
CPA_SuperObject * pCameraSuperObject = pViewport3d -> GetCameraSO ();
|
||||
POS_tdxHandleToPosition hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (pCameraSuperObject -> GetStruct ());
|
||||
MTH3D_tdstVector stVectorX , stVectorY , stVectorZ;
|
||||
MTH_tdxReal xDeltaX , xDeltaY;
|
||||
CPA_SuperObject * p_oSuperObject = TUT_M_GetCurrentWorld () -> GetListSelected () -> GetTail ();
|
||||
CPA_BaseObject * pObject = p_oSuperObject -> GetObject ();
|
||||
|
||||
POS_fn_vGetRotationMatrix (hGlobalMatrix , & stVectorX , & stVectorY , & stVectorZ);
|
||||
MTH3D_M_vSubVector (&stDeplacement , &((((a_stPickInfo[0]).stPickedObject).aDEF_stDataOfElement[0]).stHit) , &g_stInitialPoint);
|
||||
|
||||
xDeltaX = MTH3D_M_xDotProductVector (&stDeplacement , &stVectorX);
|
||||
xDeltaY = MTH3D_M_xDotProductVector (&stDeplacement , &stVectorY);
|
||||
|
||||
if (MTH_M_bIsNullWithEpsilon(xDeltaX,MTH_M_xDoubleToReal(0.01)) && MTH_M_bIsNullWithEpsilon(xDeltaY,MTH_M_xDoubleToReal(0.01)))
|
||||
{
|
||||
csText . Format ("%s(\"%s\")" , TUT_C_sz3DClic3dView , pObject -> fn_p_szGetName ());
|
||||
}
|
||||
else
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%.6f\" , \"%.6f\")" , TUT_C_sz3DMove3d , pObject -> fn_p_szGetName () , - xDeltaX , - xDeltaY);
|
||||
}
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TUT_M_GetCurrentWorld () -> GetListSelected () -> IsEmpty ())
|
||||
{
|
||||
CPA_SuperObject *p_oSuperObject = TUT_M_GetCurrentWorld () -> GetListSelected () -> GetTail ();
|
||||
if (p_oSuperObject)
|
||||
{
|
||||
CPA_BaseObject * pObject = p_oSuperObject -> GetObject ();
|
||||
if (pObject)
|
||||
{
|
||||
csText . Format ("%s(\"%s\")" , TUT_C_sz3DClic3dView , pObject -> fn_p_szGetName ());
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MTH3D_tdstVector *p_stHitPoint = &((((a_stPickInfo[0]).stPickedObject).aDEF_stDataOfElement[0]).stHit);
|
||||
|
||||
csText . Format ("%s(\"%.6f\",\"%.6f\",\"%.6f\")" , TUT_C_sz3DClic3dView , p_stHitPoint->xX ,
|
||||
p_stHitPoint->xY ,
|
||||
p_stHitPoint->xZ);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (m_eDragDropType)
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_bLButtonDownModelViewProc
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonDownModelViewProc(int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
C3ListView *p_oListView = gs_fn_p_oGetModelView ();
|
||||
|
||||
ASSERT(p_oListView);
|
||||
|
||||
// Get the selected item
|
||||
long lIndex = p_oListView -> m_fn_lGetSelectedItem (p_oListView -> m_fn_cGetOrder ());
|
||||
|
||||
// Get the name of the item and fill the variable
|
||||
if (lIndex == TSL_cItemNotFound)
|
||||
{
|
||||
m_csDragDropElement = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_csDragDropElement = p_oListView -> m_fn_csGetName (lIndex , p_oListView -> m_fn_cGetOrder ());
|
||||
m_lDragDrop = 1;
|
||||
m_eDragDropType = TUT_eSelectModel;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TUT_CTutorialManager - m_fn_bLButtonUpModelViewProc
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonUpModelViewProc(int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CString csText;
|
||||
CPoint oPoint(LOWORD(lParam),HIWORD(lParam));
|
||||
DEV_ViewPort3D * pViewport3d = TUT_M_GetCurrentViewPort ();
|
||||
tdstMousePos stMousePos;
|
||||
HIE_tdxHandleToSuperObject hSupObject;
|
||||
HIE_aDEF_stTabOfPickInfo a_stPickInfo;
|
||||
ACP_tdxIndex xNbPicked;
|
||||
|
||||
pViewport3d -> PointToMousePos (oPoint, &stMousePos);
|
||||
|
||||
//try to pick an object
|
||||
hSupObject = pViewport3d -> GetParentMultiDevice3D()->GetEngineWorld();
|
||||
if (hSupObject != NULL)
|
||||
{
|
||||
xNbPicked = HIE_xIsSuperObjectPick(GLI_C_ModePickingFace,pViewport3d -> m_hDisplayDevice,
|
||||
pViewport3d -> m_hDisplayViewport, &stMousePos.stPos2D, hSupObject, a_stPickInfo);
|
||||
|
||||
if (xNbPicked > 0)
|
||||
{
|
||||
switch (m_eDragDropType)
|
||||
{
|
||||
case TUT_eSelectModel:
|
||||
{
|
||||
if (m_lDragDrop > 1)
|
||||
{
|
||||
MTH3D_tdstVector *p_stHitPoint = &((((a_stPickInfo[0]).stPickedObject).aDEF_stDataOfElement[0]).stHit);
|
||||
|
||||
m_fn_vRemoveToPause ();
|
||||
|
||||
// drag
|
||||
csText . Format ("%s()" , TUT_C_szDrag);
|
||||
m_fn_vAddCommand (csText);
|
||||
// select model
|
||||
csText . Format ("%s(\"%s\")" , TUT_C_sz3DSelectModel , m_csDragDropElement);
|
||||
m_fn_vAddCommand (csText);
|
||||
// drop
|
||||
csText . Format ("%s()" , TUT_C_szDrop);
|
||||
m_fn_vAddCommand (csText);
|
||||
// clic3dView
|
||||
csText . Format ("%s(\"%.6f\",\"%.6f\",\"%.6f\")" , TUT_C_sz3DClic3dView , p_stHitPoint->xX ,
|
||||
p_stHitPoint->xY ,
|
||||
p_stHitPoint->xZ);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (m_eDragDropType)
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // ifdef TUT_3D
|
3670
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.cpp
Normal file
3670
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
850
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.cxx
Normal file
850
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.cxx
Normal file
@@ -0,0 +1,850 @@
|
||||
const CString TUT_gs_csPause = ";";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vStartRecord (HMODULE _hModule, DWORD _dThreadID)
|
||||
{
|
||||
m_oListOfCommands . RemoveAll ();
|
||||
m_fn_bStartStopHook (_hModule , _dThreadID , TRUE);
|
||||
m_xLastCommandTime = clock ();
|
||||
m_bInPause = TRUE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vStopRecord (HMODULE _hModule, DWORD _dThreadID, LPCTSTR _szFileName)
|
||||
{
|
||||
m_fn_bStartStopHook (_hModule , _dThreadID , FALSE);
|
||||
|
||||
m_fn_vDeleteLastCommand ();
|
||||
|
||||
if (_szFileName)
|
||||
{
|
||||
FILE *pFile = fopen (_szFileName , "wt");
|
||||
if (pFile)
|
||||
{
|
||||
while (m_oListOfCommands . GetCount ())
|
||||
{
|
||||
CString csCommand = m_oListOfCommands . RemoveHead ();
|
||||
/*if (csCommand != TUT_gs_csPause)*/ fprintf (pFile , "%s\n" , csCommand);
|
||||
}
|
||||
fclose (pFile);
|
||||
}
|
||||
}
|
||||
// remove list
|
||||
while (m_oListOfCommands . GetCount ()) m_oListOfCommands . RemoveHead ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define TUT_M_vSetHookProc(hFunc,iHookType,szHookFuncName,hModule,hThreadID)\
|
||||
if (!hFunc)\
|
||||
{\
|
||||
if (!(hFunc = SetWindowsHookEx(iHookType,(HOOKPROC)GetProcAddress(hModule, szHookFuncName), hModule, hThreadID)))\
|
||||
{\
|
||||
return FALSE;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define TUT_M_vUnsetHookProc(hFunc)\
|
||||
if (hFunc)\
|
||||
{\
|
||||
UnhookWindowsHookEx(hFunc);\
|
||||
hFunc = NULL;\
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bStartStopHook (HMODULE _hModule, DWORD _dThreadID, BOOL _bStart)
|
||||
{
|
||||
static HHOOK hhkGetMessage = NULL;
|
||||
static HHOOK hhkCallWndProc = NULL;
|
||||
static HHOOK hhkCallWndProcRet = NULL;
|
||||
|
||||
if (_bStart)
|
||||
{
|
||||
TUT_M_vSetHookProc(hhkGetMessage, WH_GETMESSAGE, "SpyGetMsgProc", _hModule,_dThreadID);
|
||||
TUT_M_vSetHookProc(hhkCallWndProc, WH_CALLWNDPROC, "SpyGetWndProc", _hModule,_dThreadID);
|
||||
TUT_M_vSetHookProc(hhkCallWndProcRet, WH_CALLWNDPROCRET, "SpyGetWndProcRet", _hModule,_dThreadID);
|
||||
}
|
||||
else
|
||||
{
|
||||
TUT_M_vUnsetHookProc(hhkGetMessage);
|
||||
TUT_M_vUnsetHookProc(hhkCallWndProc);
|
||||
TUT_M_vUnsetHookProc(hhkCallWndProcRet);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define TUT_M_HandleMsg(iType,uiMess,Func) case uiMess: return Func(iType, hwnd , uiMessage , wParam , lParam);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bHookMsgProc (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_fn_vHandlePause ();
|
||||
|
||||
switch (uiMessage)
|
||||
{
|
||||
TUT_M_HandleMsg(WH_GETMESSAGE, WM_RBUTTONDOWN, m_fn_bRButtonMsgProc)
|
||||
TUT_M_HandleMsg(WH_GETMESSAGE, WM_LBUTTONUP, m_fn_bLButtonMsgProc)
|
||||
TUT_M_HandleMsg(WH_GETMESSAGE, WM_LBUTTONDOWN, m_fn_bLButtonMsgProc)
|
||||
TUT_M_HandleMsg(WH_GETMESSAGE, WM_LBUTTONDBLCLK, m_fn_bLButtonMsgProc)
|
||||
TUT_M_HandleMsg(WH_GETMESSAGE, WM_MOUSEMOVE, m_fn_bMouseMsgProc)
|
||||
|
||||
default : break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bHookWndProc (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_fn_vHandlePause ();
|
||||
|
||||
switch (uiMessage)
|
||||
{
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_COMMAND, m_fn_bCommandMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_KILLFOCUS, m_fn_bFocusMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_NOTIFY, m_fn_bNotifyMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_INITMENU, m_fn_bMenuMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_INITMENUPOPUP, m_fn_bMenuMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_MENUSELECT, m_fn_bMenuMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_EXITMENULOOP, m_fn_bMenuMsgProc)
|
||||
TUT_M_HandleMsg(WH_CALLWNDPROC, WM_MOUSEMOVE, m_fn_bMouseMsgProc)
|
||||
default : break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bHookWndProcRet (HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_fn_vHandlePause ();
|
||||
|
||||
switch (uiMessage)
|
||||
{
|
||||
default : break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vHandlePause ()
|
||||
{
|
||||
clock_t xDuration = clock () - m_xLastCommandTime;
|
||||
|
||||
if (!m_bInPause && xDuration > TUT_C_xPauseIntervall)
|
||||
{
|
||||
xDuration = TUT_C_xPauseIntervall;
|
||||
m_fn_vAddPause ();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vAddCommand (CString csCommand)
|
||||
{
|
||||
m_oListOfCommands . AddTail (csCommand);
|
||||
m_bInPause = FALSE;
|
||||
m_xLastCommandTime = clock ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vInsertAfterPause (CString csCommand)
|
||||
{
|
||||
POSITION xPos;
|
||||
|
||||
xPos = m_oListOfCommands . GetTailPosition ();
|
||||
|
||||
while (xPos && m_oListOfCommands . GetAt (xPos) != TUT_gs_csPause)
|
||||
{
|
||||
m_oListOfCommands . GetPrev (xPos);
|
||||
}
|
||||
|
||||
if (xPos)
|
||||
{
|
||||
m_oListOfCommands . InsertBefore (xPos , csCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oListOfCommands . AddTail (csCommand);
|
||||
}
|
||||
m_bInPause = FALSE;
|
||||
m_xLastCommandTime = clock ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vAddPause (void)
|
||||
{
|
||||
m_oListOfCommands . AddTail (TUT_gs_csPause);
|
||||
m_bInPause = TRUE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vRemoveToPause (void)
|
||||
{
|
||||
while (!m_oListOfCommands . IsEmpty () && m_oListOfCommands . GetTail () != TUT_gs_csPause)
|
||||
{
|
||||
m_oListOfCommands . RemoveTail ();
|
||||
}
|
||||
|
||||
m_bInPause = TRUE;
|
||||
m_xLastCommandTime = clock ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bHaveSomethingAfterPause (void)
|
||||
{
|
||||
return (m_oListOfCommands . GetCount () && m_oListOfCommands . GetTail () != TUT_gs_csPause);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TUT_CTutorialManager::m_fn_vDeleteLastCommand (void)
|
||||
{
|
||||
// delete last Pause commands
|
||||
while (!m_oListOfCommands . IsEmpty () && m_oListOfCommands . GetTail () == TUT_gs_csPause)
|
||||
{
|
||||
m_oListOfCommands . RemoveTail ();
|
||||
}
|
||||
|
||||
// delete last command
|
||||
m_fn_vRemoveToPause ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define TUT_M_bWND_VALID_AND_USABLE(p_stWndDefinition)\
|
||||
( (p_stWndDefinition) && (p_stWndDefinition) -> hWnd && IsWindowVisible((p_stWndDefinition) -> hWnd) )
|
||||
|
||||
#define TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition)\
|
||||
if (!TUT_M_bWND_VALID_AND_USABLE(p_stWndDefinition)) return FALSE;
|
||||
|
||||
#define TUT_M_ASSERT_CURSOR_UNDER_CONTROL(hwnd)\
|
||||
{\
|
||||
RECT stRect;\
|
||||
POINT xPoint;\
|
||||
GetWindowRect (hwnd , &stRect);\
|
||||
GetCursorPos (&xPoint);\
|
||||
if (!PtInRect (&stRect , xPoint)) return FALSE;\
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bCommandMsgProc (int /*iHookType*/, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = lParam ? m_fnp_stFindWndDefinition ((HWND)lParam) : NULL;
|
||||
UINT uiNotification = HIWORD(wParam);
|
||||
CString csText;
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_eButton:
|
||||
{
|
||||
if (uiNotification == BN_CLICKED)
|
||||
{
|
||||
csText . Format ("%s(\"%s\")" , TUT_C_szClic , p_stWndDefinition -> csName);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TUT_eListBox:
|
||||
{
|
||||
switch (uiNotification)
|
||||
{
|
||||
case LBN_SELCHANGE:
|
||||
{
|
||||
long lType = GetWindowLong (p_stWndDefinition -> hWnd, GWL_STYLE);
|
||||
if (! (lType & LBS_MULTIPLESEL) )
|
||||
{
|
||||
int iCurSel = SendMessage (p_stWndDefinition -> hWnd, LB_GETCURSEL, 0, 0);
|
||||
if (iCurSel != LB_ERR)
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
SendMessage (p_stWndDefinition -> hWnd, LB_GETTEXT, iCurSel, (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LBN_DBLCLK:
|
||||
{
|
||||
if (m_oListOfCommands . GetCount () > 0)
|
||||
{
|
||||
csText . Format ("%s()" , TUT_C_szDoubleClic);
|
||||
m_fn_vInsertAfterPause (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (uiNotification)
|
||||
}
|
||||
break;
|
||||
|
||||
case TUT_eComboBox:
|
||||
{
|
||||
switch (uiNotification)
|
||||
{
|
||||
case CBN_SELCHANGE:
|
||||
{
|
||||
int iCurSel = SendMessage (p_stWndDefinition -> hWnd, CB_GETCURSEL, 0, 0);
|
||||
if (iCurSel != CB_ERR)
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
SendMessage (p_stWndDefinition -> hWnd, CB_GETLBTEXT, iCurSel, (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CBN_DBLCLK:
|
||||
{
|
||||
if (m_oListOfCommands . GetCount () > 0)
|
||||
{
|
||||
csText . Format ("%s()" , TUT_C_szDoubleClic);
|
||||
m_fn_vInsertAfterPause (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (uiNotification)
|
||||
}
|
||||
break;
|
||||
} // switch (p_stWndDefinition -> eType)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
CString gs_fn_csHandleQuoteInString (char *_szSourceText)
|
||||
{
|
||||
CString csResult;
|
||||
char *p_cBegin = _szSourceText;
|
||||
|
||||
csResult . Empty ();
|
||||
|
||||
while (*p_cBegin)
|
||||
{
|
||||
if (*p_cBegin == '\"')
|
||||
{
|
||||
csResult += "''";
|
||||
}
|
||||
else
|
||||
{
|
||||
csResult += *p_cBegin;
|
||||
}
|
||||
p_cBegin ++;
|
||||
}
|
||||
return csResult;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bFocusMsgProc (int /*iHookType*/, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uiMessage == WM_KILLFOCUS)
|
||||
{
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = hwnd ? m_fnp_stFindWndDefinition (hwnd) : NULL;
|
||||
CString csText;
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_eListBox:
|
||||
{
|
||||
long lType = GetWindowLong (p_stWndDefinition -> hWnd , GWL_STYLE);
|
||||
if (lType & LBS_MULTIPLESEL)
|
||||
{
|
||||
int iNbSel = SendMessage (p_stWndDefinition -> hWnd , LB_GETSELCOUNT , 0 , 0);
|
||||
if (iNbSel != LB_ERR)
|
||||
{
|
||||
int *a_iSelItems = (int*) alloca (iNbSel * sizeof (int));
|
||||
|
||||
if (SendMessage (p_stWndDefinition -> hWnd , LB_GETSELITEMS , iNbSel , (DWORD)a_iSelItems))
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
SendMessage (p_stWndDefinition -> hWnd , LB_GETTEXT , a_iSelItems [0] , (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
|
||||
for (int i=1 ; i<iNbSel ; i++)
|
||||
{
|
||||
SendMessage (p_stWndDefinition -> hWnd , LB_GETTEXT , a_iSelItems [i] , (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szAddSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TUT_eTextEdit:
|
||||
{
|
||||
long lType = GetWindowLong (p_stWndDefinition -> hWnd , GWL_STYLE);
|
||||
if (lType & ES_MULTILINE)
|
||||
{
|
||||
int iSize = GetWindowTextLength (p_stWndDefinition -> hWnd);
|
||||
char *szText = (char *) alloca (iSize+1);
|
||||
char szEndOfLine [3] = { 13 , 10 , 0 };
|
||||
char *p_cBegin , *p_cEnd;
|
||||
int iLineNumber;
|
||||
|
||||
// clear control
|
||||
csText . Format ("%s(0,0,0,0)" , TUT_C_szSelectText);
|
||||
m_fn_vAddCommand (csText);
|
||||
|
||||
GetWindowText (p_stWndDefinition -> hWnd , szText , iSize + 1);
|
||||
p_cBegin = szText;
|
||||
|
||||
iLineNumber = 0;
|
||||
p_cEnd = strstr (p_cBegin , szEndOfLine);
|
||||
while (p_cEnd)
|
||||
{
|
||||
*p_cEnd = 0;
|
||||
if (p_cEnd != p_cBegin)
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%s\" , %d)" , TUT_C_szSetEditText , p_stWndDefinition -> csName , gs_fn_csHandleQuoteInString (p_cBegin) , iLineNumber);
|
||||
m_fn_vAddCommand (csText);
|
||||
}
|
||||
|
||||
//
|
||||
p_cBegin = p_cEnd + 2;
|
||||
iLineNumber ++;
|
||||
p_cEnd = strstr (p_cBegin , szEndOfLine);
|
||||
}
|
||||
|
||||
if (*p_cBegin)
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%s\" , %d)" , TUT_C_szSetEditText , p_stWndDefinition -> csName , gs_fn_csHandleQuoteInString (p_cBegin) , iLineNumber);
|
||||
m_fn_vAddCommand (csText);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int iSize = GetWindowTextLength (p_stWndDefinition -> hWnd);
|
||||
char *szText = (char *) alloca (iSize+1);
|
||||
|
||||
if (GetWindowText (p_stWndDefinition -> hWnd , szText , iSize+1))
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSetEditText , p_stWndDefinition -> csName , gs_fn_csHandleQuoteInString (szText));
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (p_stWndDefinition -> eType)
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bNotifyMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LPNMHDR pnmh = (LPNMHDR) lParam;
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = (pnmh && pnmh -> hwndFrom) ? m_fnp_stFindWndDefinition (pnmh -> hwndFrom) : NULL;
|
||||
CString csText;
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
TUT_M_ASSERT_CURSOR_UNDER_CONTROL(p_stWndDefinition -> hWnd);
|
||||
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_eListBox:
|
||||
{
|
||||
uiMessage = uiMessage;
|
||||
}
|
||||
break;
|
||||
|
||||
case TUT_eListCtrl:
|
||||
{
|
||||
NM_LISTVIEW *pnmv = (NM_LISTVIEW *) lParam;
|
||||
if (pnmv -> hdr . code == LVN_ITEMCHANGED)
|
||||
{
|
||||
if (pnmv -> iItem && pnmv -> uNewState == (LVIS_SELECTED|LVIS_FOCUSED))
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
ListView_GetItemText (p_stWndDefinition -> hWnd , pnmv -> iItem , 0 , szText , 255);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TUT_eTreeCtrl:
|
||||
{
|
||||
NM_TREEVIEW *pnmtv = (NM_TREEVIEW *) lParam;
|
||||
switch (pnmtv -> hdr . code)
|
||||
{
|
||||
case TVN_SELCHANGED:
|
||||
{
|
||||
if (pnmtv -> itemNew . mask & TVIF_STATE && pnmtv -> itemNew . state & TVIS_SELECTED)
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
pnmtv -> itemNew . pszText = szText;
|
||||
pnmtv -> itemNew . cchTextMax = 255;
|
||||
pnmtv -> itemNew . mask = TVIF_TEXT;
|
||||
|
||||
if (TreeView_GetItem (p_stWndDefinition -> hWnd , & pnmtv -> itemNew))
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TVN_ITEMEXPANDED:
|
||||
{
|
||||
if (pnmtv -> itemNew . mask & TVIF_STATE)
|
||||
{
|
||||
BOOL bExpanded = (pnmtv -> itemNew . state & TVIS_EXPANDED) ? TRUE : FALSE;
|
||||
char szText[255];
|
||||
|
||||
pnmtv -> itemNew . pszText = szText;
|
||||
pnmtv -> itemNew . cchTextMax = 255;
|
||||
pnmtv -> itemNew . mask = TVIF_TEXT;
|
||||
|
||||
if (TreeView_GetItem (p_stWndDefinition -> hWnd , & pnmtv -> itemNew))
|
||||
{
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , bExpanded ? TUT_C_szExpand : TUT_C_szCollapse , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (pnmtv -> hdr . code)
|
||||
}
|
||||
break;
|
||||
} // switch (p_stWndDefinition -> eType)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bLButtonMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (iHookType)
|
||||
{
|
||||
case WH_CALLWNDPROCRET:
|
||||
case WH_GETMESSAGE:
|
||||
{
|
||||
switch (uiMessage)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = hwnd ? m_fnp_stFindWndDefinition (hwnd) : NULL;
|
||||
|
||||
if (p_stWndDefinition == NULL && m_fn_bIsModelView (hwnd))
|
||||
{
|
||||
return m_fn_bLButtonDownModelViewProc (iHookType, hwnd, uiMessage, wParam, lParam);
|
||||
}
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
|
||||
m_csDragDropElement . Empty ();
|
||||
m_lDragDrop = 0;
|
||||
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_e3DView:
|
||||
{
|
||||
return m_fn_bLButtonDown3DViewProc (iHookType, hwnd, uiMessage, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = hwnd ? m_fnp_stFindWndDefinition (hwnd) : NULL;
|
||||
|
||||
if (p_stWndDefinition == NULL && m_fn_bIsModelView (hwnd))
|
||||
{
|
||||
return m_fn_bLButtonUpModelViewProc (iHookType, hwnd, uiMessage, wParam, lParam);
|
||||
}
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_e3DView:
|
||||
{
|
||||
return m_fn_bLButtonUp3DViewProc (iHookType, hwnd, uiMessage, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_csDragDropElement . Empty ();
|
||||
m_lDragDrop = 0;
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
if (m_fn_bHaveSomethingAfterPause ())
|
||||
{
|
||||
CString csText;
|
||||
|
||||
csText . Format ("%s()" , TUT_C_szDoubleClic);
|
||||
m_fn_vInsertAfterPause (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // switch (uiMessage)
|
||||
}
|
||||
break;
|
||||
} // switch (iHookType)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bMouseMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uiMessage)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (m_lDragDrop > 0) m_lDragDrop++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bRButtonMsgProc (int iHookType, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uiMessage)
|
||||
{
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
TUT_tdstWndDefinition *p_stWndDefinition = hwnd ? m_fnp_stFindWndDefinition (hwnd) : NULL;
|
||||
CString csText;
|
||||
|
||||
TUT_M_ASSERT_WND_VALID_AND_USABLE(p_stWndDefinition);
|
||||
|
||||
switch (p_stWndDefinition -> eType)
|
||||
{
|
||||
case TUT_e3DView:
|
||||
{
|
||||
csText . Format ("%s()" , TUT_C_szRightButton);
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case TUT_eListBox:
|
||||
{
|
||||
long lType = GetWindowLong (p_stWndDefinition -> hWnd , GWL_STYLE);
|
||||
if (lType & LBS_MULTIPLESEL)
|
||||
{
|
||||
int iNbSel = SendMessage (p_stWndDefinition -> hWnd , LB_GETSELCOUNT , 0 , 0);
|
||||
if (iNbSel != LB_ERR)
|
||||
{
|
||||
int *a_iSelItems = (int*) alloca (iNbSel * sizeof (int));
|
||||
|
||||
if (SendMessage (p_stWndDefinition -> hWnd , LB_GETSELITEMS , iNbSel , (DWORD)a_iSelItems))
|
||||
{
|
||||
char szText[255];
|
||||
|
||||
SendMessage (p_stWndDefinition -> hWnd , LB_GETTEXT , a_iSelItems [0] , (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
|
||||
for (int i=1 ; i<iNbSel ; i++)
|
||||
{
|
||||
SendMessage (p_stWndDefinition -> hWnd , LB_GETTEXT , a_iSelItems [i] , (DWORD)szText);
|
||||
csText . Format ("%s(\"%s\" , \"%s\")" , TUT_C_szAddSelect , p_stWndDefinition -> csName , szText);
|
||||
m_fn_vAddCommand (csText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// no break here
|
||||
default:
|
||||
{
|
||||
csText . Format ("%s()" , TUT_C_szRightButton);
|
||||
m_fn_vAddCommand (csText);
|
||||
csText . Format ("%s(\"%s\")" , TUT_C_szClic , p_stWndDefinition -> csName);
|
||||
m_fn_vAddCommand (csText);
|
||||
}
|
||||
break;
|
||||
} // switch (p_stWndDefinition -> eType)
|
||||
|
||||
//
|
||||
}
|
||||
break;
|
||||
} // switch (uiMessage)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void gs_fn_vCleanMenuName(char *_szName)
|
||||
{
|
||||
char *p_cSource = _szName;
|
||||
char *p_cTarget = _szName;
|
||||
|
||||
while (*p_cSource)
|
||||
{
|
||||
if (*p_cSource == '\t') break;
|
||||
if (*p_cSource != '&')
|
||||
{
|
||||
*p_cTarget++ = *p_cSource;
|
||||
}
|
||||
p_cSource++;
|
||||
}
|
||||
*p_cTarget = 0;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BOOL TUT_CTutorialManager::m_fn_bMenuMsgProc (int /*iHookType*/, HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static CStringList s_oListOfMenuNames;
|
||||
static CList<HMENU,HMENU> s_oListOfMenuHandles;
|
||||
static char s_oCurrentMenuName[255];
|
||||
static HMENU hCurrentMenu;
|
||||
static HMENU hNextMenu;
|
||||
static BOOL bLastIsAnEntry;
|
||||
CString csText;
|
||||
|
||||
switch (uiMessage)
|
||||
{
|
||||
case WM_INITMENU:
|
||||
{
|
||||
s_oListOfMenuNames . RemoveAll ();
|
||||
s_oListOfMenuHandles . RemoveAll ();
|
||||
*s_oCurrentMenuName = 0;
|
||||
hCurrentMenu = (HMENU)wParam;
|
||||
hNextMenu = NULL;
|
||||
bLastIsAnEntry = FALSE;
|
||||
}
|
||||
break;
|
||||
case WM_INITMENUPOPUP:
|
||||
{
|
||||
hNextMenu = (HMENU) wParam;
|
||||
}
|
||||
break;
|
||||
case WM_MENUSELECT:
|
||||
{
|
||||
UINT uItem = (UINT) LOWORD(wParam); // menu item or submenu index
|
||||
UINT fuFlags = (UINT) HIWORD(wParam); // menu flags
|
||||
HMENU hmenu = (HMENU) lParam; // handle of menu clicked
|
||||
UINT uiFlag = (fuFlags & MF_POPUP) ? MF_BYPOSITION : MF_BYCOMMAND;
|
||||
|
||||
csText = "WM_MENUSELECT : ";
|
||||
if (fuFlags == 0xFFFF)
|
||||
{
|
||||
if (!bLastIsAnEntry)
|
||||
{
|
||||
while (s_oListOfMenuNames . GetCount()) s_oListOfMenuNames . RemoveHead ();
|
||||
while (s_oListOfMenuHandles . GetCount()) s_oListOfMenuHandles . RemoveHead ();
|
||||
*s_oCurrentMenuName = 0;
|
||||
csText += "Clear all";
|
||||
}
|
||||
else
|
||||
{
|
||||
s_oListOfMenuNames . AddTail (s_oCurrentMenuName);
|
||||
csText += "End";
|
||||
}
|
||||
}
|
||||
else if (hmenu == hCurrentMenu)
|
||||
{
|
||||
GetMenuString (hmenu , uItem , s_oCurrentMenuName , 255 , uiFlag);
|
||||
gs_fn_vCleanMenuName (s_oCurrentMenuName);
|
||||
bLastIsAnEntry = (fuFlags & MF_POPUP) ? FALSE : TRUE;
|
||||
csText += "Current => " + CString(s_oCurrentMenuName);
|
||||
}
|
||||
else if (hmenu == hNextMenu)
|
||||
{
|
||||
s_oListOfMenuHandles . AddTail (hCurrentMenu);
|
||||
s_oListOfMenuNames . AddTail (s_oCurrentMenuName);
|
||||
GetMenuString (hmenu , uItem , s_oCurrentMenuName , 255 , uiFlag);
|
||||
gs_fn_vCleanMenuName (s_oCurrentMenuName);
|
||||
hCurrentMenu = hNextMenu;
|
||||
hNextMenu = NULL;
|
||||
bLastIsAnEntry = (fuFlags & MF_POPUP) ? FALSE : TRUE;
|
||||
csText += "Next => " + CString(s_oCurrentMenuName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_oListOfMenuNames . GetCount()) s_oListOfMenuNames . RemoveTail ();
|
||||
while (s_oListOfMenuHandles . GetCount() && (s_oListOfMenuHandles . GetTail () != hmenu))
|
||||
{
|
||||
s_oListOfMenuHandles . RemoveTail ();
|
||||
if (s_oListOfMenuNames . GetCount()) s_oListOfMenuNames . RemoveTail ();
|
||||
}
|
||||
if (s_oListOfMenuHandles . GetCount()) s_oListOfMenuHandles . RemoveTail ();
|
||||
hCurrentMenu = hmenu;
|
||||
hNextMenu = NULL;
|
||||
GetMenuString (hmenu , uItem , s_oCurrentMenuName , 255 , uiFlag);
|
||||
gs_fn_vCleanMenuName (s_oCurrentMenuName);
|
||||
bLastIsAnEntry = (fuFlags & MF_POPUP) ? FALSE : TRUE;
|
||||
csText += "Back => " + CString(s_oCurrentMenuName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_EXITMENULOOP:
|
||||
{
|
||||
while (s_oListOfMenuHandles . GetCount()) s_oListOfMenuHandles . RemoveHead ();
|
||||
|
||||
if (s_oListOfMenuNames . GetCount())
|
||||
{
|
||||
ASSERT(bLastIsAnEntry);
|
||||
csText . Format ("%s(\"%s\"" , wParam ? TUT_C_szPopupMenu : TUT_C_szMenu , s_oListOfMenuNames . RemoveHead ());
|
||||
while (s_oListOfMenuNames . GetCount())
|
||||
{
|
||||
csText = csText + " , \"" + s_oListOfMenuNames . RemoveHead () + "\"";
|
||||
}
|
||||
csText += ")";
|
||||
m_fn_vAddCommand (csText);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
1617
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.inc
Normal file
1617
Rayman_X/cpa/tempgrp/Tut/TutLib/Src/Tut_Mngr.inc
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user