Add rayman2 source files

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

Binary file not shown.

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

View File

@@ -0,0 +1,182 @@
// (c) Ubi Studios 1996
// See Vincent Greco for any comment or question
#ifndef __CAMERA_HPP__
#define __CAMERA_HPP__
//**************************************
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
//**************************************
#include "incITF.h"
#include "dialogba.hpp"
typedef enum {InertCamera, ActorCamera} tdeCameraType;
class Camera : public CPA_BaseObject,
public CPA_EdMot<GLI_tdxHandleToCamera>
{
public:
Camera(tdeCameraType eType, CPA_ObjectDLLBase *p_oDLL,CPA_MainWorld* p_oMainWorld,GLI_tdxHandleToCamera hObj,
CString csName = "",CString csFileName = "",CString csSectionName = "");
Camera(tdeCameraType eType, CPA_ObjectDLLBase *p_oDLL,CPA_MainWorld* p_oMainWorld,CString csName = "",
CString csFileName = "",CString csSectionName = "");
//copy constructor
Camera(Camera& src);
~Camera();
void *GetEngineStruct() { return GetStruct(); };
void SetEngineStruct (GLI_tdxHandleToCamera hObj) { SetStruct(hObj); }
// void ReInit(GLI_tdxHandleToCamera hCamera);
// members
private:
tdeCameraType m_eCameraType;
tdeAxisSystem m_eRotationAxisSystem;
tdeAxisSystem m_eTranslationAxisSystem;
tdeRotationCenterType m_eRotationCenterType;
tdeTargetType m_eTargetType;
MTH3D_tdstVector m_stRotationCenterPoint;
tdeCoordsType m_eRotationCenterPointCoordsType;
CPA_SuperObject *m_p_oRotationCenterSuperObject;
MTH3D_tdstVector m_stTargetPoint; // world coordinates always
CPA_SuperObject *m_p_oTargetSuperObject;
POS_tdstCompletePosition m_stCameraMatrix;
BOOL m_bActive; // tells wether the m_hDevice and m_hViewport are valid or not
DEV_ViewPort3D *m_p_oViewPort;
CPA_Object *m_p_oActor; //if it's an actor camera, this is the actor
CPA_SuperObject *m_p_oActorSO; // and this is the actor SuperObject
DialogBar m_oDialogBar;
double m_dTwistAngle;
long m_lTwistRemoveCount;
BOOL m_bPrivilegeMode;
// methods
public:
static void StaticInit();
long GetDataType () { return 0; }
void * GetData () { return GetStruct(); }
DEV_ViewPort3D *GetViewport() {return m_p_oViewPort;};
POS_tdstCompletePosition *GetCameraMatrix() {return &m_stCameraMatrix;};
DialogBar *GetDialogBar() {return &m_oDialogBar;};
void OnToolBarCommand(UINT nID);
void Preferences();
void CompletePreferences();
void FrontView();
void BackView();
void LeftView();
void RightView();
void TopView();
void BottomView();
BOOL IsActive() {return m_bActive;};
BOOL IsInPrivilegeMode() {return m_bPrivilegeMode;};
void SetPrivilegeMode(BOOL bMode);
tdeCameraType GetCameraType() { return m_eCameraType; };
void Activate( DEV_ViewPort3D *p_oViewPort, CPA_DialogBar *p_oPopUpParent, CPoint oPos);
void Disactivate();
void SetRotationAxisSystem(tdeAxisSystem eSystem);
void SetTranslationAxisSystem(tdeAxisSystem eSystem);
tdeAxisSystem GetRotationAxisSystem();
tdeAxisSystem GetTranslationAxisSystem();
BOOL SetRotationCenterType(tdeRotationCenterType eRotCenterType);
tdeRotationCenterType GetRotationCenterType();
tdeRotationCenterType GetEffectiveRotationCenterType();
BOOL SetTargetType(tdeTargetType eTargetType);
tdeTargetType GetTargetType();
void SetRotationCenterPoint(CPA_CameraCoords *p_oRotationCenter, tdeCoordsType eType = Absolute);
BOOL SetRotationCenterSuperObject(CPA_SuperObject *p_oSuperObject);
CPA_SuperObject *GetRotationCenterSuperObject() {return m_p_oRotationCenterSuperObject;};
BOOL GetRotationCenter(MTH3D_tdstVector &r_stCenter);
void GetRotationCenterPoint(MTH3D_tdstVector &r_stPoint, tdeCoordsType &r_eType);
void GetTargetPoint(MTH3D_tdstVector &r_stPoint);
void SetTargetPoint(CPA_CameraCoords *p_oRotationCenter);
BOOL SetTargetSuperObject(CPA_SuperObject *p_oSuperObject);
CPA_SuperObject *GetTargetSuperObject() {return m_p_oTargetSuperObject;};
BOOL GetTarget(MTH3D_tdstVector &r_stTarget);
void Translate(CPA_CameraCoords *p_oOffset, BOOL bUserDefinedAxis = FALSE);
void SetPosition(CPA_CameraCoords *p_oPos = NULL);
void Rotate(tdeAxis eAxis, double dAngle);
void SetRotation(double dAngleX = 0, double dAngleY = 0, double dAngleZ = 0);
void GetMatrix(POS_tdstCompletePosition *p_oMatrix);
void SetMatrix(POS_tdstCompletePosition *p_oMatrix);
void ZoomOnTarget(CPA_SuperObject *p_oSuperObject = NULL);
void Update();
void UpdateFromEngine();
void ShowDialogBar() {m_oDialogBar.Show();};
void HideDialogBar() {m_oDialogBar.Hide();};
void CameraToWorldCoordinates_Point(MTH3D_tdstVector &r_stVector);
void CameraToWorldCoordinates_Vector(MTH3D_tdstVector &r_stVector);
void WorldToCameraCoordinates_Point(MTH3D_tdstVector &r_stVector);
void WorldToCameraCoordinates_Vector(MTH3D_tdstVector &r_stVector);
private:
void ResetCameraRotationMatrix();
void ResetCamera();
void InternalUpdate();
void InternalBackUpdate();
void CameraOriginalToWorldCoordinates(MTH3D_tdstVector &r_stVector);
void WorldToCameraOriginalCoordinates(MTH3D_tdstVector &r_stVector);
void BuildRotationMatrix_X(POS_tdstCompletePosition &r_stMatrix, double xXAngle);
void BuildRotationMatrix_Y(POS_tdstCompletePosition &r_stMatrix, double xXAngle);
void BuildRotationMatrix_Z(POS_tdstCompletePosition &r_stMatrix, double xXAngle);
void RotateCameraToSeePoint(MTH3D_tdstVector *p_stTarget);
void RemoveTwist();
void SetTwist();
void ResetTwist();
double GetRealTwistAngle();
// toolbar
void InitInertCameraToolBar();
};
#endif //__CAMERA_HPP__

View File

@@ -0,0 +1,243 @@
//**************************************
// This is the base class of your DLL interface
// All methods of CPA_BaseObjectDLLBase are
// present in that class.
//**************************************
#ifndef __MYINTERF_HPP__
#define __MYINTERF_HPP__
#include "itf.h"
#include "camera.hpp"
// if you want only one instance of your DLL
// activate the next line
#define DLL_ONLY_ONE_INSTANCE
class Geometry3D;
//----------------------------------------------------------
// Object DLL interface class
//----------------------------------------------------------
class Camera_Interface : public CPA_CameraDLLBase
{
private:
// CPA_Ed_1 MP BEGIN
// mouse handler
BOOL m_bRotateOn;
BOOL m_bIsMoving;
tdstMousePos m_stMousePos;
HCURSOR hcursorM, hcursorR;
// CPA_Ed_1 MP END
// keyboard handler
CPA_KeyActionConfiguration *m_p_oKeyConfiguration;
Geometry3D *m_p_oInertCameraGeomObject;
float m_fTranslationStep;
float m_fRotationStep;
GLI_tdxHandleToCamera m_hLastEngineCamera;
BOOL m_bFirstTime;
long m_lSlotForEngineCamera;
long m_lSlotForLastEditorCamera;
// ANNECY MT NewInterface 26/03/98 {
tdeDisplayReferential m_eReferentialDisplayMode;
// ENDANNECY MT NewInterface }
BOOL m_bCameraTargetMode;
public:
Camera_Interface(void);
Geometry3D *GetInertCameraGeomObject() { return m_p_oInertCameraGeomObject;};
void SetTranslationStep(float fStep) { m_fTranslationStep = fStep;};
void SetRotationStep(float fStep) { m_fRotationStep = fStep;};
float GetTranslationStep() { return m_fTranslationStep;};
float GetRotationStep() { return m_fRotationStep;};
void fn_vInitListByType (CPA_World *pWorld);
CPA_SuperObject *AssociateSuperObject(Camera *p_oCamera);
BOOL fn_bAcceptModifCopy (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return (eStatus != C_AsConcernedDLL); }
// ACP MEssages Functions overload
// BOOL fn_bPreTranslateMessage(MSG *);
void fn_vJustAfterRegistered(void);
void fn_vConstruct(void);
// void fn_vRefreshDatas(void);
void fn_vAddObjectsToDraw(GLD_tdstViewportAttributes *, GLI_tdstLight *, DEV_ViewPort* p3);
// void fn_vAddObjectsToDraw2(GLD_tdstViewportAttributes *, GLI_tdstLight *);
// BOOL fn_bAcceptToRunEngine(void);
void fn_vBeforeEngine(void);
void fn_vBeforeEditor(void);
// void fn_vHasLostFocus(void);
// BOOL fn_bHasGainedFocus(void);
// BOOL fn_bAcceptToExit(void);
// void fn_vJustBeforeClosing(void);
// long OnQueryAction(CPA_DLLBase*, WPARAM, LPARAM);
// long OnQueryInfos(CPA_DLLBase*, WPARAM, LPARAM);
// long OnQueryOpen(CPA_DLLBase*, WPARAM, LPARAM);
// long OnQueryClose(CPA_DLLBase*, WPARAM, LPARAM);
// Windows MEssages Functions overload
// BOOL _OnKeyUp (UINT, UINT, UINT, void *);
// BOOL _OnKeyDown (UINT, UINT, UINT, void *);
// BOOL _OnUpdateCommandUI (unsigned int, CCmdUI *, void *);
// BOOL _OnMouseMove (UINT, tdstMousePos *, void *);
// BOOL _OnLButtonDblClk (UINT, tdstMousePos *, ACP_tdxIndex, void *);
// BOOL _OnLButtonDown (UINT, tdstMousePos *, ACP_tdxIndex, void *);
// BOOL _OnLButtonUp (UINT, tdstMousePos *, void *);
// BOOL _OnRButtonDblClk (UINT, tdstMousePos *, ACP_tdxIndex, void *);
// BOOL _OnRButtonDown (UINT, tdstMousePos *, ACP_tdxIndex, void *);
// BOOL _OnRButtonUp (UINT, tdstMousePos *, void *);
// BOOL _OnDragDropEnd (WPARAM, LPARAM);
// BOOL _OnDragDropMove(WPARAM, LPARAM);
// BOOL _OnDragDropLooseFocus(WPARAM, LPARAM);
// BOOL _OnDragDropGainFocus(WPARAM, LPARAM);
// SHAITAN -> Editor Messages Functions overload
// BOOL fn_bAcceptAsParent (CPA_BaseObject *pChild, CPA_BaseObject *pParent) { return TRUE; }
// BOOL fn_bAcceptAsChild (CPA_BaseObject *pParent, CPA_BaseObject *pChild) { return TRUE; }
BOOL fn_bAcceptModifDelete (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
// BOOL fn_bAcceptModifParent (CPA_List<CPA_SuperObject> *pListObjects) { return TRUE; }
// BOOL fn_bAcceptModifCopy (CPA_List<CPA_SuperObject> *pListObjects) { return TRUE; }
// BOOL fn_bAcceptModifMove (CPA_List<CPA_SuperObject> *pListObjects) { return TRUE; }
// BOOL fn_bAcceptModifInsert (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent) { return TRUE; }
// BOOL fn_bAcceptModifName (CPA_SuperObject *pEdObj) { return TRUE; }
// BOOL fn_bAcceptSelect (CPA_SuperObject *pEdObj) { return TRUE; }
// void fn_vOnModifDelete (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType) { }
// void fn_vOnModifParent (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType) { }
// void fn_vOnModifCopy (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType) { }
// void fn_vOnModifMove (CPA_List<EDT_SavePos> *pListObjects, tdeTypeModif eType) { }
// void fn_vOnModifInsert (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, tdeTypeModif eType) { }
// void fn_vOnModifName (CPA_SuperObject *pEdObj, char *szInitalName, char *szFinalName, tdeTypeModif eType) { }
// void fn_vOnSelect (CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus eStatus);
// ObjectDLL special functions overload
// CPA_BaseObject *GetNewObject (char *p_cObjectFile, char*p_cObjectName, FILE *p_fFile);
BOOL fn_bDefinePopupMenu(EDT_PopUpMenu *pPopup, CPA_List<CPA_SuperObject> *pSelection, BOOL bIsAlone);
void _OnPopUpMenuCommand(UINT m_IDCmdMsg);
ACP_tdxHandleOfObject fn_hGetBoundingVolume(CPA_BaseObject *pObject);
void fn_vComputeBoundingVolume(CPA_BaseObject *pObject);
void SendDialogBarCommandToCamera(CPA_BaseObject *p_oCamera,UINT nID);
//=========================================================================================
//=========================================================================================
//=========================================================================================
//=========================================================================================
//=========================================================================================
void Activate(CPA_BaseObject *_p_oCamera, DEV_ViewPort3D *p_oViewPort, CPA_DialogBar *p_oPopUpParent, CPoint oPos);
void Disactivate(CPA_BaseObject *_p_oCamera);
void SetRotationAxisSystem(CPA_BaseObject *p_oCamera, tdeAxisSystem eSystem);
void SetTranslationAxisSystem(CPA_BaseObject *p_oCamera, tdeAxisSystem eSystem);
tdeAxisSystem GetRotationAxisSystem(CPA_BaseObject *p_oCamera);
tdeAxisSystem GetTranslationAxisSystem(CPA_BaseObject *p_oCamera);
BOOL SetRotationCenterType(CPA_BaseObject *p_oCamera, tdeRotationCenterType eRotCenterType);
tdeRotationCenterType GetRotationCenterType(CPA_BaseObject *p_oCamera);
tdeRotationCenterType GetEffectiveRotationCenterType(CPA_BaseObject *p_oCamera);
BOOL SetTargetType(CPA_BaseObject *p_oCamera, tdeTargetType eTargetType);
tdeTargetType GetTargetType(CPA_BaseObject *p_oCamera);
BOOL ZoomOnTarget (CPA_BaseObject *p_oCamera, CPA_SuperObject *pTarget);
void SetRotationCenterPoint(CPA_BaseObject *p_oCamera, CPA_CameraCoords *p_oRotationCenter, tdeCoordsType eType = Absolute);
BOOL SetRotationCenterSuperObject(CPA_BaseObject *p_oCamera, CPA_SuperObject *p_oSuperObject);
BOOL GetRotationCenter(CPA_BaseObject *p_oCamera, MTH3D_tdstVector &r_stCenter);
void SetTargetPoint(CPA_BaseObject *p_oCamera, CPA_CameraCoords *p_oRotationCenter);
BOOL SetTargetSuperObject(CPA_BaseObject *p_oCamera, CPA_SuperObject *p_oSuperObject);
BOOL GetTarget(CPA_BaseObject *p_oCamera, MTH3D_tdstVector &r_stTarget);
void Translate(CPA_BaseObject *p_oCamera, CPA_CameraCoords *p_oOffset, BOOL bUserDefinedAxis = FALSE);
void SetPosition(CPA_BaseObject *p_oCamera, CPA_CameraCoords *p_oPos = NULL);
void Rotate(CPA_BaseObject *p_oCamera, tdeAxis eAxis, double dAngle);
void SetRotation(CPA_BaseObject *p_oCamera, double dAngleX = 0, double dAngleY = 0, double dAngleZ = 0);
void Update(CPA_BaseObject *p_oCamera);
CPA_SuperObject *CreateDefaultCamera();
void InsertCameraInHierarchy(CPA_SuperObject *p_oCameraSO);
void ShowDialogBar(CPA_BaseObject *p_oCamera);
void HideDialogBar(CPA_BaseObject *p_oCamera);
CPA_BaseObject *CopySlotCamera(CPA_BaseObject* p_oCamera);
void PutCameraInViewPort(CPA_BaseObject *_p_oCamera,DEV_ViewPort3D *p_oViewPort, BOOL bWithPrevCam = TRUE);
void GetMatrix(CPA_BaseObject *_p_oCamera, POS_tdstCompletePosition *p_oMatrix);
void SetMatrix(CPA_BaseObject *_p_oCamera, POS_tdstCompletePosition *p_oMatrix);
// camera - viewport communication specific functions
BOOL SendKeyDownToCamera (CPA_BaseObject *p_oCamera, UINT nChar, UINT nRepCnt, UINT nFlags);
// BOOL SendKeyUpToCamera (CPA_BaseObject *p_oCamera, UINT nChar, UINT nRepCnt, UINT nFlags);
// BOOL SendMouseMoveToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, MTH3D_tdstVector *p_stVect);
// BOOL SendLButtonDblClkToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
// BOOL SendRButtonDblClkToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
// CPA_Ed_1 MP BEGIN - enabled mouse functions
BOOL SendMouseMoveToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, MTH3D_tdstVector *p_stVect);
BOOL SendLButtonDownToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
BOOL SendRButtonDownToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
BOOL SendLButtonUpToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos);
BOOL SendRButtonUpToCamera (CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos);
// CPA_Ed_1 MP END
void DestroyCamera (CPA_SuperObject *p_oCameraSO);
BOOL OnToolTipNotify (CPA_BaseObject *_p_oCamera, TOOLTIPTEXT *p_TTT, UINT nID);
void CameraToWorldCoordinates_Point(CPA_BaseObject *_p_oCamera, MTH3D_tdstVector &r_stVector);
void CameraToWorldCoordinates_Vector(CPA_BaseObject *_p_oCamera, MTH3D_tdstVector &r_stVector);
void WorldToCameraCoordinates_Point(CPA_BaseObject *_p_oCamera, MTH3D_tdstVector &r_stVector);
void WorldToCameraCoordinates_Vector(CPA_BaseObject *_p_oCamera, MTH3D_tdstVector &r_stVector);
// ANNECY MT NewInterface 26/03/98 {
void SetReferentialDisplayMode (tdeDisplayReferential eDisplayMode);
tdeDisplayReferential GetReferentialDisplayMode ();
// ENDANNECY MT NewInterface }
//CPA2 Corneliu Babiuc 04-05-98
//functions to store and restore camera positions from slots
void SaveSlotsPositions();
void LoadSlotsPositions(CPA_BaseObject * p_oCamera);
//CPA2 Corneliu Babiuc 04-05-98
private:
BOOL KeyOtherActions(Camera *p_oCamera, UINT nChar);
BOOL KeyMoveCamera(Camera *p_oCamera, UINT nChar, BOOL bRepeat = FALSE);
BOOL KeyRotateCamera(Camera *p_oCamera, UINT nChar, BOOL bRepeat = FALSE);
BOOL KeyViewCamera(Camera *p_oCamera, UINT nChar);
void InitKeyboard();
CPA_SuperObject *CreateInertCamera(GLI_tdxHandleToCamera hObj = NULL,CString csName = "",
CString csFileName = "",CString csSectionName = "");
// CPA_Ed_1 MP BEGIN
void UpdatePosition( Camera *p_oCamera,tdstMousePos *p_stPos );
BOOL MouseRotateCamera( Camera *p_oCamera, tdstMousePos *p_stPos ); // MIRCEA
BOOL MouseMoveCamera( Camera *p_oCamera, tdstMousePos *p_stPos ); // MIRCEA
// CPA_Ed_1 MP END
BOOL fn_bAddEntriesToTreePopup (CPA_DialogList *pDialog, CString csListName, CMenu *pMenu, UINT uiCustomEntriesStart);
BOOL fn_bAddEntriesToListPopup (CPA_DialogList *pDialog, CString csListName, CMenu *pMenu, UINT uiCustomEntriesStart);
void fn_vOnCommandInTreePopup (CPA_DialogList *pDialog, CString csListName, UINT uiCustomEntry);
void fn_vOnCommandInListPopup (CPA_DialogList *pDialog, CString csListName, UINT uiCustomEntry);
void ChangeCameraTarget (void);
};
extern tdstDLLIdentity g_stCameraIdentity;
#endif // __MYINTERF_HPP__

View File

@@ -0,0 +1,41 @@
#ifndef __CAMSLOTS_HPP__
#define __CAMSLOTS_HPP__
#include "itf.h"
#include "camera.hpp"
class Camera_Interface;
//typedef enum {MakeACopy = 0,DontMakeACopy} tdeMakeCopy;
class Camera_Slots
{
private:
CArray<Camera*,Camera*> m_oCameraSlots;
CArray<CString,CString> m_oNameSlots;
Camera_Interface *m_p_oInterface;
public:
Camera_Slots(void);
void SaveCameraInSlot(long lNum,CStrin csName,Camera *p_oCamera,tdeMakeCopy = MakeACopy);
void RestoreCameraFromSlot(long lNum,DEV_ViewPort3D *p_oViewport);
void PutCameraInViewPort(Camera *p_oCamera,DEV_ViewPort3D *p_oViewPort,tdeMakeCopy = MakeACopy);
void SetInterface(Camera_Interface *p_oInterface) { m_p_oInterface = p_oInterface;};
long GetNbBusySlots();
CString GetNameOfSlotIfBusy(long lNum);
Camera *GetCameraFromPopUpMenu(CWnd *p_oParent, tdeMakeCopy eCopy = MakeACopy);
long GetSlotFromPopUpMenu(CWnd *p_oParent);
BOOL IsEmpty(long lNum) { return (m_oCameraSlots[lNum] == NULL);};
};
#endif // __CAMSLOTS_HPP__

View File

@@ -0,0 +1,72 @@
#ifndef AFX_COMPPROP_HPP
#define AFX_COMPPROP_HPP
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// compprop.hpp : header file
//
#include "pagebase.hpp"
#include "pagetarget.hpp"
#include "pagerotcenter.hpp"
#include "pagegeneral.hpp"
/////////////////////////////////////////////////////////////////////////////
// CompleteProperties dialog
class Camera;
class CompleteProperties : public CDialog
{
typedef enum {TargetPage = 0, RotCenterPage, GeneralPage }tdePages;
// Construction
public:
CompleteProperties(Camera* p_oCamera, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CompleteProperties)
enum { IDD = IDD_COMPLETEPROPERTIES };
CTabCtrl m_oTabControl;
CString m_csTypeName;
CString m_csCameraName;
//}}AFX_DATA
private:
PageTarget m_oTargetPage;
PageRotationCenter m_oRotCenterPage;
PageGeneral m_oGeneralPage;
Camera *m_p_oCamera;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CompleteProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CompleteProperties)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangingTabProperties(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSelchangeTabProperties(NMHDR* pNMHDR, LRESULT* pResult);
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COMPPROP_HPP__CC24C3C7_DC14_11D0_BE57_00609775AC86__INCLUDED_)

View File

@@ -0,0 +1,101 @@
#ifndef __DIALOGBA_HPP__
#define __DIALOGBA_HPP__
//**************************************
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
//**************************************
#include "itf.h"
#include "camresrc.h"
class Camera;
class Camera_Interface;
class DialogBar
{
private:
Camera *m_p_oCamera;
Camera_Interface *m_p_oInterface;
CPA_DialogBar *m_p_oParentWnd;
CPA_PopUpToolBar m_oToolBar;
public:
DialogBar(void);
DialogBar(DialogBar& r_src);
void SetCamera(Camera *p_oCamera);
CPA_DialogBar *GetCPA_DialogBar() {return m_p_oParentWnd;};
CPA_PopUpToolBar *GetToolBar() {return (m_p_oParentWnd == NULL) ? NULL : &m_oToolBar;};
void InitInertCameraDialogBar(Camera* p_oCamera);
void Show();
void Hide();
void UpdateToolBar();
BOOL GetToolTipText(TOOLTIPTEXT *p_TTT, UINT nID);
void Create(CPA_DialogBar *p_oPopUpParent, CPoint oPos);
void Destroy();
void OnCommand(UINT nID);
};
class Camera_NewSlot : public CDialog
{
// Construction
protected:
CString m_csName;
BOOL m_bDefault;
public:
// parent editor
CString GetName (void) { return m_csName; }
// standard constructor
Camera_NewSlot (CWnd* pParent = NULL);
// Dialog
int fn_iDoDialog (CString _csName, BOOL bDefault = FALSE);
// Dialog Data
//{{AFX_DATA(Camera_NewSlot)
enum { IDD = IDD_NEW_SLOT };
CEdit m_cNewName;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(Camera_NewSlot)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(Camera_NewSlot)
virtual BOOL OnInitDialog();
afx_msg void OnOK();
afx_msg void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // __CAMSLOTS_HPP__

View File

@@ -0,0 +1,29 @@
#ifndef PAGEBASE_HPP
#define PAGEBASE_HPP
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
//---------------------------------------------------------------
//---------------------------------------------------------------
//---------------------------------------------------------------
//---------------------------------------------------------------
// base class for all property page:
class PageBase : public CDialog
{
public:
PageBase(UINT IDD) : CDialog(IDD) {};
virtual void MakeChangesAvailable() {};
virtual BOOL IsPageValid() {return FALSE;};
virtual void DoUpdate() {};
};
#endif

View File

@@ -0,0 +1,87 @@
#ifndef AFX_PAGEGENERAL_HPP__
#define AFX_PAGEGENERAL_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// pagegeneral.hpp : header file
//
#include "camera.hpp"
#include "pagebase.hpp"
/////////////////////////////////////////////////////////////////////////////
// PageGeneral dialog
class PageGeneral : public PageBase
{
// Construction
public:
PageGeneral(Camera *p_oCameraL); // standard constructor
void MakeChangesAvailable();
BOOL IsPageValid();
void DoUpdate();
float GetTrans() { return m_fTransValue; };
float GetRot() { return m_fRotValue; };
tdeAxisSystem GetTransAxis() {return m_eTranslationAxis; };
tdeAxisSystem GetRotAxis() {return m_eRotationAxis; };
// Dialog Data
//{{AFX_DATA(PageGeneral)
enum { IDD = IDD_PROPPAGE_GENERAL };
int m_iTranslationAxis;
int m_iRotationAxis;
CString m_csRotationValue;
CString m_csTranslationValue;
int m_iTranslationStep;
int m_iRotationStep;
BOOL m_bPrivilegeMode;
//}}AFX_DATA
private:
long m_lIDofCurrentEdit;
Camera *m_p_oCamera;
float m_fTransValue;
float m_fRotValue;
tdeAxisSystem m_eRotationAxis;
tdeAxisSystem m_eTranslationAxis;
BOOL UpdateTransRadioButtons(float fTransValue = -1);
BOOL UpdateRotRadioButtons(float fRotValue = -1);
void UpdateRotText();
void UpdateTransText();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(PageGeneral)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(PageGeneral)
afx_msg void OnSetfocusEditRotvalue();
afx_msg void OnKillfocusEditRotvalue();
afx_msg void OnKillfocusEditTransvalue();
afx_msg void OnSetfocusEditTransvalue();
afx_msg void OnBtReturn();
virtual BOOL OnInitDialog();
afx_msg void OnRbTranslationStep();
afx_msg void OnRbTranslationstep();
afx_msg void OnRbRotationStep();
afx_msg void OnChkPrivilegemode();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PAGEGENERAL_HPP__2DF0418B_DCB9_11D0_BE58_00609775AC86__INCLUDED_)

View File

@@ -0,0 +1,93 @@
#if !defined(AFX_PAGEROTCENTER_HPP__CC24C3C9_DC14_11D0_BE57_00609775AC86__INCLUDED_)
#define AFX_PAGEROTCENTER_HPP__CC24C3C9_DC14_11D0_BE57_00609775AC86__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// pagerotcenter.hpp : header file
//
#include "pagebase.hpp"
#include "incitf.h"
class Camera;
class CPA_SuperObject;
/////////////////////////////////////////////////////////////////////////////
// PageRotationCenter dialog
class PageRotationCenter : public PageBase
{
// Construction
public:
PageRotationCenter(Camera* p_oCamera);
~PageRotationCenter();
BOOL IsPageValid();
void MakeChangesAvailable();
void DoUpdate();
private:
BOOL CheckComboSO();
BOOL CheckRotationCenterType();
// Dialog Data
//{{AFX_DATA(PageRotationCenter)
enum { IDD = IDD_PROPPAGE_ROTATIONCENTER };
CComboBox m_oComboSO;
CString m_csPointX;
CString m_csPointY;
CString m_csPointZ;
CString m_csSuperObjectX;
CString m_csSuperObjectY;
CString m_csSuperObjectZ;
int m_iRotationCenterType;
int m_iPointCoords;
CString m_csComboEdit;
BOOL m_bPointRelative;
//}}AFX_DATA
private:
Camera *m_p_oCamera;
long m_lIDofCurrentEdit;
CPA_CameraCoords m_oRotationCenterPoint;
CPA_SuperObject *m_p_oRotationCenterSuperObject;
tdeRotationCenterType m_eRotationCenterType;
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(PageRotationCenter)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(PageRotationCenter)
afx_msg void OnBtCopytopoint();
afx_msg void OnBtReturn();
afx_msg void OnKillfocusEditPointx();
afx_msg void OnSetfocusEditPointx();
afx_msg void OnKillfocusEditPointy();
afx_msg void OnSetfocusEditPointy();
afx_msg void OnKillfocusEditPointz();
afx_msg void OnSetfocusEditPointz();
virtual BOOL OnInitDialog();
afx_msg void OnRbPointCoords();
afx_msg void OnSelChangeComboSO();
afx_msg void OnEditChangeComboSO();
afx_msg void OnSetfocusComboso();
afx_msg void OnKillfocusComboso();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PAGEROTCENTER_HPP__CC24C3C9_DC14_11D0_BE57_00609775AC86__INCLUDED_)

View File

@@ -0,0 +1,96 @@
#ifndef PAGETARGET_HPP
#define PAGETARGET_HPP
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// pagetarget.hpp : header file
//
/////////////////////////////////////////////////////////////////////////////
// PageTarget dialog
#include "pagebase.hpp"
#include "incITF.h"
class Camera;
class CPA_SuperObject;
class PageTarget : public PageBase
{
// Construction
public:
PageTarget(Camera* p_oCamera);
~PageTarget();
BOOL IsPageValid();
void MakeChangesAvailable();
void DoUpdate();
private:
BOOL CheckComboSO();
BOOL CheckTargetType();
// Dialog Data
//{{AFX_DATA(PageTarget)
enum { IDD = IDD_PROPPAGE_TARGET };
CComboBox m_oComboSO;
CString m_csPointX;
CString m_csPointY;
CString m_csPointZ;
CString m_csSuperObjectX;
CString m_csSuperObjectY;
CString m_csSuperObjectZ;
int m_iTargetType;
int m_iPointCoords;
CString m_csComboEdit;
//}}AFX_DATA
private:
Camera *m_p_oCamera;
long m_lIDofCurrentEdit;
CPA_CameraCoords m_oTargetPoint;
CPA_SuperObject *m_p_oTargetSuperObject;
tdeTargetType m_eTargetType;
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(PageTarget)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(PageTarget)
afx_msg void OnBtCopytopoint();
afx_msg void OnBtReturn();
afx_msg void OnKillfocusEditPointx();
afx_msg void OnSetfocusEditPointx();
afx_msg void OnKillfocusEditPointy();
afx_msg void OnSetfocusEditPointy();
afx_msg void OnKillfocusEditPointz();
afx_msg void OnSetfocusEditPointz();
virtual BOOL OnInitDialog();
afx_msg void OnRbPointCoords();
afx_msg void OnSelChangeComboSO();
afx_msg void OnEditChangeComboSO();
afx_msg void OnSetfocusComboso();
afx_msg void OnKillfocusComboso();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PAGETARGET_HPP__CC24C3C8_DC14_11D0_BE57_00609775AC86__INCLUDED_)

View File

@@ -0,0 +1,79 @@
#if !defined(AFX_PROPERT_HPP)
#define AFX_PROPERT_HPP
#include "camresrc.h"
/////////////////////////////////////////////////////////////////////////////
// Properties dialog
class Properties : public CDialog
{
// Construction
public:
Properties(Camera* p_oCamera,CWnd* pParent = NULL); // standard constructor
BOOL WantToOpenCompleteProperties() {return m_bWantToOpenMore;};
void DoUpdate();
private:
BOOL UpdateTransRadioButtons(float fTransValue = -1);
BOOL UpdateRotRadioButtons(float fVRotValue = -1);
void UpdateRotText();
void UpdateTransText();
public:
// Dialog Data
//{{AFX_DATA(Properties)
enum { IDD = IDD_PROPERTIES };
int m_iRotationAxis;
int m_iTranslationAxis;
int m_iRotationStep;
CString m_csRotationValue;
CString m_csTranslationValue;
int m_iTranslationStep;
BOOL m_bPrivilegeMode;
//}}AFX_DATA
private:
float m_fTransValue;
float m_fRotValue;
tdeAxisSystem m_eRotationAxis;
tdeAxisSystem m_eTranslationAxis;
BOOL m_bWantToOpenMore;
Camera *m_p_oCamera;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(Properties)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(Properties)
virtual BOOL OnInitDialog();
afx_msg void OnKillfocusTransvalue();
afx_msg void OnKillfocusRotvalue();
afx_msg void OnRbRotationStep();
afx_msg void OnRbTranslationStep();
virtual void OnOK();
afx_msg void OnBtMore();
afx_msg void OnChkPrivilege();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROPERT_HPP__23B05615_BFC3_11D0_BE2B_00609775AC86__INCLUDED_)

View File

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

View File

@@ -0,0 +1,203 @@
# Microsoft Developer Studio Project File - Name="OCA" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=OCA - 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 "oca.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 "oca.mak" CFG="OCA - Win32 Debug Glide with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "OCA - Win32 Debug Glide with Editors" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/CPA/TempGrp/oca", EXFAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug Glide with Editors"
# PROP BASE Intermediate_Dir "Debug Glide with Editors"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\CPA\EXE\main\EDT_Data\Objects"
# PROP Intermediate_Dir "Tmp\OCADFEvd"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "inc" /I "src" /I "X:\CPA\Public" /I "res" /D "CPA_WANTS_IMPORT" /D "ACTIVE_EDITOR" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "CPA_VISUAL" /D "CPA_DEBUG" /D "_WINDLL" /D "_AFXDLL" /D "USE_ALTIMAPS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /i "res" /i "inc" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"x:\CPA\EXE\main\EDT_Data\Objects/OCAdfevd.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# Begin Target
# Name "OCA - Win32 Debug Glide with Editors"
# Begin Group "Source Files"
# PROP Default_Filter "cpp"
# Begin Source File
SOURCE=.\src\_camera.def
# End Source File
# Begin Source File
SOURCE=.\src\camdllco.cpp
# End Source File
# Begin Source File
SOURCE=.\src\camera.cpp
# End Source File
# Begin Source File
SOURCE=.\src\caminter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\compprop.cpp
# End Source File
# Begin Source File
SOURCE=.\src\dialogba.cpp
# End Source File
# Begin Source File
SOURCE=.\src\keyboard.cpp
# End Source File
# Begin Source File
SOURCE=.\src\pagegeneral.cpp
# End Source File
# Begin Source File
SOURCE=.\src\pagerotcenter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\pagetarget.cpp
# End Source File
# Begin Source File
SOURCE=.\src\popupmen.cpp
# End Source File
# Begin Source File
SOURCE=.\src\propert.cpp
# End Source File
# Begin Source File
SOURCE=.\src\StdAfx.cpp
# End Source File
# End Group
# Begin Group "Include Files"
# PROP Default_Filter "hpp,h"
# Begin Source File
SOURCE=.\inc\camera.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\caminter.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\camslots.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\compprop.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\dialogba.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\pagebase.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\pagegeneral.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\pagerotcenter.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\pagetarget.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\propert.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\res\camera.rc
# End Source File
# Begin Source File
SOURCE=.\res\camresrc.h
# End Source File
# Begin Source File
SOURCE=.\res\toolbar1.bmp
# End Source File
# End Group
# Begin Group "others"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_Data\Objects\camera\camera.ini
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_Data\Objects\camera\camera.mod
# End Source File
# End Group
# Begin Group "libs debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Exe\Main\MaiDFEvd.lib
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_Data\Objects\OGDDFEvd.lib
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="OCA"
ProjectGUID="{C3664BCB-1827-4C4D-9553-0E527269596F}"
SccProjectName="&quot;$/CPA/TempGrp/oca&quot;, EXFAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain"
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug Glide with Editors|Win32"
OutputDirectory="x:\CPA\EXE\main\EDT_Data\Objects"
IntermediateDirectory=".\Tmp\OCADFEvd"
ConfigurationType="2"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="inc,src,X:\CPA\Public,res"
PreprocessorDefinitions="CPA_WANTS_IMPORT;ACTIVE_EDITOR;WIN32;_DEBUG;_WINDOWS;CPA_VISUAL;CPA_DEBUG;USE_ALTIMAPS"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Tmp\OCADFEvd/oca.pch"
AssemblerListingLocation=".\Tmp\OCADFEvd/"
ObjectFile=".\Tmp\OCADFEvd/"
ProgramDataBaseFileName=".\Tmp\OCADFEvd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="maidfevd.lib ogddfevd.lib"
OutputFile="x:\CPA\EXE\main\EDT_Data\Objects/OCAdfevd.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="X:\cpa\exe\main\edt_data\objects;X:\cpa\exe\main\edt_data;X:\cpa\exe\main;X:\cpa\libd"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\src\_camera.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="x:\CPA\EXE\main\EDT_Data\Objects/OCAdfevd.pdb"
SubSystem="2"
ImportLibrary="x:\CPA\EXE\main\EDT_Data\Objects/OCAdfevd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName="x:\CPA\EXE\main\EDT_Data\Objects/oca.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"
AdditionalIncludeDirectories="res;inc"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp">
<File
RelativePath="src\_camera.def">
</File>
<File
RelativePath="src\camdllco.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\camera.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\caminter.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\compprop.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\dialogba.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\keyboard.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\pagegeneral.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\pagerotcenter.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\pagetarget.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\popupmen.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\propert.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\StdAfx.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Include Files"
Filter="hpp,h">
<File
RelativePath="inc\camera.hpp">
</File>
<File
RelativePath="inc\caminter.hpp">
</File>
<File
RelativePath="inc\camslots.hpp">
</File>
<File
RelativePath="inc\compprop.hpp">
</File>
<File
RelativePath="inc\dialogba.hpp">
</File>
<File
RelativePath="inc\pagebase.hpp">
</File>
<File
RelativePath="inc\pagegeneral.hpp">
</File>
<File
RelativePath="inc\pagerotcenter.hpp">
</File>
<File
RelativePath="inc\pagetarget.hpp">
</File>
<File
RelativePath="inc\propert.hpp">
</File>
<File
RelativePath="inc\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="res\camera.rc">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories=""/>
</FileConfiguration>
</File>
<File
RelativePath="res\camresrc.h">
</File>
<File
RelativePath="res\toolbar1.bmp">
</File>
</Filter>
<Filter
Name="others"
Filter="">
<File
RelativePath="..\..\Exe\Main\EDT_Data\Objects\camera\camera.ini">
</File>
<File
RelativePath="..\..\Exe\Main\EDT_Data\Objects\camera\camera.mod">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,413 @@
//Microsoft Developer Studio generated resource script.
//
#include "camresrc.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_PROPPAGE_TARGET DIALOG DISCARDABLE 0, 0, 200, 141
STYLE DS_3DLOOK | WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Point",IDC_STATIC,7,41,85,90
EDITTEXT IDC_EDIT_POINTX,27,82,47,12,ES_AUTOHSCROLL
LTEXT "X :",IDC_STATIC,17,84,10,8
CONTROL "World Coordinates",IDC_RB_WORLDCOORDS,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,11,53,70,10
CONTROL "Camera Coordinates",IDC_RB_CAMERACOORDS,"Button",
BS_AUTORADIOBUTTON,11,65,80,10
EDITTEXT IDC_EDIT_POINTY,27,98,47,12,ES_AUTOHSCROLL
LTEXT "Y :",IDC_STATIC,17,100,10,8
EDITTEXT IDC_EDIT_POINTZ,27,113,47,12,ES_AUTOHSCROLL
LTEXT "Z :",IDC_STATIC,17,116,10,8
GROUPBOX "SuperObject",IDC_STATIC,102,41,85,90
PUSHBUTTON "",IDC_BT_COPYTOPOINT,106,118,8,8
LTEXT "Copy to Point",IDC_STATIC,118,118,50,8
COMBOBOX IDC_COMBOSO,110,52,71,82,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EDIT_SOX,122,70,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "X :",IDC_STATIC,112,73,10,8
EDITTEXT IDC_EDIT_SOY,122,86,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Y :",IDC_STATIC,112,89,10,8
EDITTEXT IDC_EDIT_SOZ,122,102,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Z :",IDC_STATIC,112,103,10,8
CONTROL "Target is a Point",IDC_RB_TARGPOINT,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,11,6,74,10
CONTROL "Target is a SuperObject",IDC_RB_TARGSO,"Button",
BS_AUTORADIOBUTTON,11,17,94,10
CONTROL "No Target",IDC_RB_NOTARG,"Button",BS_AUTORADIOBUTTON,11,
28,49,10
DEFPUSHBUTTON "",IDC_BT_RETURN,130,15,6,6,NOT WS_VISIBLE | NOT
WS_TABSTOP
END
IDD_PROPPAGE_ROTATIONCENTER DIALOG DISCARDABLE 0, 0, 200, 141
STYLE DS_3DLOOK | WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Point",IDC_STATIC,7,41,85,95
EDITTEXT IDC_EDIT_POINTX,27,74,47,12,ES_AUTOHSCROLL
LTEXT "X :",IDC_STATIC,17,76,10,8
CONTROL "World Coordinates",IDC_RB_WORLDCOORDS,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,11,51,70,10
CONTROL "Camera Coordinates",IDC_RB_CAMERACOORDS,"Button",
BS_AUTORADIOBUTTON,11,61,80,10
EDITTEXT IDC_EDIT_POINTY,27,90,47,12,ES_AUTOHSCROLL
LTEXT "Y :",IDC_STATIC,17,92,10,8
EDITTEXT IDC_EDIT_POINTZ,27,105,47,12,ES_AUTOHSCROLL
LTEXT "Z :",IDC_STATIC,17,108,10,8
GROUPBOX "SuperObject",IDC_STATIC,106,41,85,95
PUSHBUTTON "",IDC_BT_COPYTOPOINT,110,124,8,8
LTEXT "Copy to Point",IDC_STATIC,122,124,50,8
COMBOBOX IDC_COMBO_SUPEROBJECT,114,55,71,82,CBS_DROPDOWN |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EDIT_SOX,126,75,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "X :",IDC_STATIC,116,78,10,8
EDITTEXT IDC_EDIT_SOY,126,91,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Y :",IDC_STATIC,116,94,10,8
EDITTEXT IDC_EDIT_SOZ,126,107,47,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Z :",IDC_STATIC,116,108,10,8
CONTROL "Relative values",IDC_CHK_RELATIVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,124,64,8
CONTROL "a Point",IDC_RB_ROTPOINT,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,20,28,38,10
CONTROL "a SuperObject",IDC_RB_ROTSO,"Button",BS_AUTORADIOBUTTON,
110,17,61,10
CONTROL "the Target",IDC_RB_ROTTARGET,"Button",
BS_AUTORADIOBUTTON,20,17,49,10
DEFPUSHBUTTON "",IDC_BT_RETURN,85,20,6,6,NOT WS_VISIBLE | NOT
WS_TABSTOP
GROUPBOX "Rotation Center is...",IDC_STATIC,7,5,183,35
END
IDD_PROPPAGE_GENERAL DIALOG DISCARDABLE 0, 0, 200, 141
STYLE DS_3DLOOK | WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_EDIT_ROTVALUE,15,60,40,12,ES_AUTOHSCROLL
CONTROL "PI / 4",IDC_RB_PION4,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,11,80,34,9
CONTROL "PI / 8",IDC_RB_PION8,"Button",BS_AUTORADIOBUTTON,50,80,
34,9
CONTROL "PI / 16",IDC_RB_PION16,"Button",BS_AUTORADIOBUTTON,11,
91,34,9
CONTROL "PI / 32",IDC_RB_PION32,"Button",BS_AUTORADIOBUTTON,50,
90,34,9
GROUPBOX "Rotation step",IDC_STATIC,5,50,85,55
EDITTEXT IDC_EDIT_TRANSVALUE,110,61,40,12,ES_AUTOHSCROLL
CONTROL "10 cm",IDC_RB_10CM,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,108,80,34,9
CONTROL "1 m",IDC_RB_50CM,"Button",BS_AUTORADIOBUTTON,150,80,34,
9
CONTROL "10 m",IDC_RB_1M,"Button",BS_AUTORADIOBUTTON,108,91,34,9
CONTROL "100 m",IDC_RB_10M,"Button",BS_AUTORADIOBUTTON,150,90,34,
9
GROUPBOX "Translation step",IDC_STATIC,102,50,90,55
GROUPBOX "Rotation Axis system",IDC_STATIC,5,5,77,40
CONTROL "Camera",IDC_RB_ROTAXISCAMERA,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,15,16,39,8
CONTROL "World",IDC_RB_ROTAXISWORLD,"Button",BS_AUTORADIOBUTTON,
15,30,39,8
GROUPBOX "Translation Axis system",IDC_STATIC,110,5,82,40
CONTROL "Camera",IDC_RB_TRANSAXISCAMERA,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,120,16,39,8
CONTROL "World",IDC_RB_TRANSAXISWORLD,"Button",
BS_AUTORADIOBUTTON,120,30,39,8
DEFPUSHBUTTON "",IDC_BT_RETURN,90,15,5,5,NOT WS_VISIBLE | NOT
WS_TABSTOP
CONTROL "Privileged mode",IDC_CHK_PRIVILEGEMODE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,65,115,66,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_PROPPAGE_TARGET, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 193
TOPMARGIN, 7
BOTTOMMARGIN, 134
END
IDD_PROPPAGE_ROTATIONCENTER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 193
TOPMARGIN, 7
BOTTOMMARGIN, 134
END
IDD_PROPPAGE_GENERAL, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 193
TOPMARGIN, 7
BOTTOMMARGIN, 134
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_PROPERTIES DIALOG DISCARDABLE 0, 0, 135, 206
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE |
WS_CAPTION
CAPTION "Camera Properties"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,90,184,33,14
PUSHBUTTON "Cancel",IDCANCEL,5,184,33,14
EDITTEXT IDC_ROTVALUE,17,20,40,12,ES_AUTOHSCROLL
CONTROL "PI / 4",IDC_RB_ROTATIONSTEP,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,14,40,34,9
CONTROL "PI / 8",IDC_PION8,"Button",BS_AUTORADIOBUTTON,14,52,34,
9
CONTROL "PI / 16",IDC_PION16,"Button",BS_AUTORADIOBUTTON,14,64,
34,9
CONTROL "PI / 32",IDC_PION32,"Button",BS_AUTORADIOBUTTON,14,76,
34,9
GROUPBOX "Rotation step",IDC_STATIC,8,10,57,82
EDITTEXT IDC_TRANSVALUE,78,20,40,12,ES_AUTOHSCROLL
CONTROL "10 cm",IDC_RB_TRANSLATIONSTEP,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,75,40,34,9
CONTROL "1 m",IDC_50CM,"Button",BS_AUTORADIOBUTTON,75,52,34,9
CONTROL "10 m",IDC_1M,"Button",BS_AUTORADIOBUTTON,75,64,34,9
CONTROL "100 m",IDC_10M,"Button",BS_AUTORADIOBUTTON,75,76,34,9
GROUPBOX "Translation step",IDC_STATIC,68,10,59,82
GROUPBOX "Rotation Axis system",IDC_STATIC,8,96,119,23
CONTROL "Camera",IDC_RB_ROTATIONAXIS,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,17,107,39,8
CONTROL "World",IDC_ROTWORLD,"Button",BS_AUTORADIOBUTTON,81,107,
39,8
GROUPBOX "Translation Axis system",IDC_STATIC,8,121,119,23
CONTROL "Camera",IDC_RB_TRANSLATIONAXIS,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,17,131,39,8
CONTROL "World",IDC_TRANSWORLD,"Button",BS_AUTORADIOBUTTON,81,
131,39,8
GROUPBOX "Base Parameters",IDC_STATIC,0,0,135,205
PUSHBUTTON "More...",IDC_BT_MORE,49,184,30,14
CONTROL "Privileged mode",IDC_CHK_PRIVILEGE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,8,148,66,10
LTEXT "Show Axis",IDC_STATIC,6,165,34,8
COMBOBOX IDC_COMBO_AXIS,44,163,79,45,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
END
IDD_COMPLETEPROPERTIES DIALOG DISCARDABLE 0, 0, 231, 226
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Camera Propetries"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,45,205,50,14
PUSHBUTTON "Cancel",IDCANCEL,122,205,50,14
CONTROL "Tab1",IDC_TAB_PROPERTIES,"SysTabControl32",0x0,11,42,
206,157
LTEXT "Static",IDC_STATIC_PAGEPOS,13,55,200,141,NOT WS_VISIBLE |
NOT WS_GROUP
EDITTEXT IDC_EDIT_NAME,35,3,70,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Name :",IDC_STATIC,7,5,24,12
EDITTEXT IDC_EDIT_TYPE,35,20,70,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Type :",IDC_STATIC,7,21,24,12
LTEXT "Show Axis",IDC_STATIC,117,5,34,8
COMBOBOX IDC_COMBO_AXIS,155,3,69,45,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
END
IDD_NEW_SLOT DIALOG DISCARDABLE 0, 0, 150, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Camera Slot"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,85,45,50,14
PUSHBUTTON "Cancel",IDCANCEL,13,45,50,14
EDITTEXT IDC_SLOT_NAME,7,23,136,16,ES_AUTOHSCROLL
LTEXT "Choose a name for the new camera slot :",IDC_STATIC,7,7,
136,11
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_PROPERTIES, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 123
TOPMARGIN, 6
BOTTOMMARGIN, 199
END
IDD_COMPLETEPROPERTIES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 224
TOPMARGIN, 3
BOTTOMMARGIN, 219
END
IDD_NEW_SLOT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 143
TOPMARGIN, 7
BOTTOMMARGIN, 59
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_CAMERATB TOOLBAR DISCARDABLE 18, 18
BEGIN
BUTTON ID_FREEVIEW
BUTTON ID_FRONTVIEW
BUTTON ID_RIGHTVIEW
BUTTON ID_LEFTVIEW
BUTTON ID_TOPVIEW
BUTTON ID_BOTTOMVIEW
BUTTON ID_BACKVIEW
BUTTON ID_ENDFAMILY
SEPARATOR
BUTTON ID_NOTTARGETED
BUTTON ID_POINTTARGETED
BUTTON ID_SOTARGETED
BUTTON ID_ENDFAMILY
SEPARATOR
BUTTON ID_PREFERENCES
BUTTON ID_ENDFAMILY
SEPARATOR
BUTTON ID_SELECTCAMERA
BUTTON ID_ENDFAMILY
BUTTON ID_SAVECAMERA
BUTTON ID_ENDFAMILY
END
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_CAMERATB BITMAP DISCARDABLE "toolbar1.bmp"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"camresrc.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_COMPLETEPROPERTIES DLGINIT
BEGIN
IDC_COMBO_AXIS, 0x403, 3, 0
0x6f4e, "\000"
IDC_COMBO_AXIS, 0x403, 10, 0
0x6f44, 0x6e77, 0x4c20, 0x6665, 0x0074,
IDC_COMBO_AXIS, 0x403, 11, 0
0x6f44, 0x6e77, 0x5220, 0x6769, 0x7468, "\000"
0
END
IDD_PROPERTIES DLGINIT
BEGIN
IDC_COMBO_AXIS, 0x403, 3, 0
0x6f4e, "\000"
IDC_COMBO_AXIS, 0x403, 10, 0
0x6f44, 0x6e77, 0x4c20, 0x6665, 0x0074,
IDC_COMBO_AXIS, 0x403, 11, 0
0x6f44, 0x6e77, 0x5220, 0x6769, 0x7468, "\000"
0
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,98 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by camera.rc
//
#define IDR_CAMERATB 101
#define IDD_PROPERTIES 104
#define IDD_PROPPAGE_TARGET 106
#define IDD_PROPPAGE_ROTATIONCENTER 108
#define IDD_COMPLETEPROPERTIES 112
#define IDD_PROPPAGE_GENERAL 113
#define IDD_NEW_SLOT 115
#define IDC_ROTVALUE 1002
#define IDC_TRANSVALUE 1003
#define IDC_PION4 1006
#define IDC_RB_ROTATIONSTEP 1006
#define IDC_PION8 1007
#define IDC_PION16 1008
#define IDC_PION32 1009
#define IDC_10CM 1010
#define IDC_RB_TRANSLATIONSTEP 1010
#define IDC_50CM 1011
#define IDC_1M 1012
#define IDC_10M 1013
#define IDC_COMBO 1014
#define IDC_ROTCAMERA 1016
#define IDC_RB_ROTATIONAXIS 1016
#define IDC_ROTWORLD 1017
#define IDC_TRANSCAMERA 1018
#define IDC_RB_TRANSLATIONAXIS 1018
#define IDC_TRANSWORLD 1019
#define IDC_COMBOSO 1036
#define IDC_CHK_RELATIVE 1039
#define IDC_RB_TARGPOINT 1040
#define IDC_TAB_PROPERTIES 1041
#define IDC_BT_MORE 1042
#define IDC_RB_TARGSO 1042
#define IDC_RB_NOTARG 1043
#define IDC_STATIC_PAGEPOS 1044
#define IDC_BT_RETURN 1045
#define IDC_EDIT_NAME 1047
#define IDC_EDIT_TYPE 1048
#define IDC_RB_ROTAXISWORLD 1048
#define IDC_RB_ROTAXISCAMERA 1049
#define IDC_RB_TRANSAXISCAMERA 1050
#define IDC_RB_TRANSAXISWORLD 1051
#define IDC_EDIT_ROTVALUE 1052
#define IDC_EDIT_TRANSVALUE 1053
#define IDC_RB_PION4 1054
#define IDC_RB_PION8 1055
#define IDC_RB_PION16 1056
#define IDC_RB_PION32 1057
#define IDC_RB_10CM 1058
#define IDC_RB_50CM 1059
#define IDC_RB_1M 1060
#define IDC_RB_10M 1061
#define IDC_RB_ROTPOINT 1062
#define IDC_RB_ROTSO 1063
#define IDC_RB_ROTTARGET 1064
#define IDC_RB_WORLDCOORDS 1065
#define IDC_RB_CAMERACOORDS 1066
#define IDC_EDIT_POINTX 1067
#define IDC_EDIT_POINTY 1068
#define IDC_EDIT_POINTZ 1069
#define IDC_COMBO_SUPEROBJECT 1070
#define IDC_EDIT_SOX 1071
#define IDC_EDIT_SOY 1072
#define IDC_EDIT_SOZ 1073
#define IDC_BT_COPYTOPOINT 1074
#define IDC_CHK_SHOWAXIS 1076
#define IDC_CHK_PRIVILEGE 1077
#define IDC_CHK_PRIVILEGEMODE 1078
#define IDC_COMBO_AXIS 1079
#define IDC_SLOT_NAME 1080
#define ID_BACKVIEW 40001
#define ID_FREEVIEW 40005
#define ID_FRONTVIEW 40006
#define ID_RIGHTVIEW 40007
#define ID_LEFTVIEW 40008
#define ID_TOPVIEW 40009
#define ID_BOTTOMVIEW 40010
#define ID_ENDFAMILY 40011
#define ID_NOTTARGETED 40012
#define ID_POINTTARGETED 40013
#define ID_PREFERENCES 40015
#define ID_SOTARGETED 40017
#define ID_SELECTCAMERA 40019
#define ID_SAVECAMERA 40020
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 116
#define _APS_NEXT_COMMAND_VALUE 40021
#define _APS_NEXT_CONTROL_VALUE 1081
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

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

View File

@@ -0,0 +1,10 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

View File

@@ -0,0 +1,111 @@
//
// Common functions for Object DLL capabilities
// C. Beaudet
//
#include "stdafx.h"
#include "acp_base.h"
#include "afxdllx.h"
#include "caminter.hpp"
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static Camera_Interface *gs_p_oCameraInterface = NULL;
#endif
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stCameraIdentity.eType = OBJECT_DLL; //object DLL type
g_stCameraIdentity.csName = C_szDLLCameraName; //object DLL name (unique name)
g_stCameraIdentity.hModule = NULL; //********************** private internal
g_stCameraIdentity.p_oListOfInstances = &g_oListOfInstances; //********************** private internal
return &g_stCameraIdentity;
}
//========================================================================
// DLL int function
//========================================================================
extern "C" void __declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oCameraInterface == NULL)
{
gs_p_oCameraInterface = new Camera_Interface();
ASSERT(gs_p_oCameraInterface != NULL);
}
return gs_p_oCameraInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new Camera_Interface();
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,234 @@
// compprop.cpp : implementation file
//
#include "stdafx.h"
#include "acp_base.h"
#include "camresrc.h"
#include "compprop.hpp"
#include "pagetarget.hpp"
#include "pagerotcenter.hpp"
#include "camera.hpp"
#include "caminter.hpp"
#define M_GetDLL(Camera) ((Camera_Interface*)((Camera)->GetEditor()))
#define M_GetAxisCombo() ((CComboBox*)GetDlgItem(IDC_COMBO_AXIS))
/////////////////////////////////////////////////////////////////////////////
// CompleteProperties dialog
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
CompleteProperties::CompleteProperties(Camera* p_oCamera,CWnd* pParent /*=NULL*/)
: CDialog(CompleteProperties::IDD, pParent),
m_oTargetPage(p_oCamera),m_oRotCenterPage(p_oCamera),m_oGeneralPage(p_oCamera)
{
//{{AFX_DATA_INIT(CompleteProperties)
m_csTypeName = _T("");
m_csCameraName = _T("");
//}}AFX_DATA_INIT
m_p_oCamera = p_oCamera;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void CompleteProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CompleteProperties)
DDX_Control(pDX, IDC_TAB_PROPERTIES, m_oTabControl);
DDX_Text(pDX, IDC_EDIT_TYPE, m_csTypeName);
DDX_Text(pDX, IDC_EDIT_NAME, m_csCameraName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CompleteProperties, CDialog)
//{{AFX_MSG_MAP(CompleteProperties)
ON_NOTIFY(TCN_SELCHANGING, IDC_TAB_PROPERTIES, OnSelchangingTabProperties)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_PROPERTIES, OnSelchangeTabProperties)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CompleteProperties message handlers
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL CompleteProperties::OnInitDialog()
{
TC_ITEM stTabItem;
CRect oRect;
tdeDisplayReferential eDisplayMode;
CDialog::OnInitDialog();
// get the display rect
GetDlgItem(IDC_STATIC_PAGEPOS)->GetWindowRect(&oRect);
ScreenToClient(&oRect);
// create the two pages
m_oTargetPage.Create(IDD_PROPPAGE_TARGET,this);
m_oRotCenterPage.Create(IDD_PROPPAGE_ROTATIONCENTER,this);
m_oGeneralPage.Create(IDD_PROPPAGE_GENERAL,this);
// create the tabs
stTabItem.mask = TCIF_TEXT|TCIF_PARAM ;
stTabItem.pszText = "General";
stTabItem.lParam = (LPARAM) &m_oGeneralPage;
m_oTabControl.InsertItem(0,&stTabItem);
stTabItem.mask = TCIF_TEXT|TCIF_PARAM ;
stTabItem.pszText = "Target";
stTabItem.lParam = (LPARAM) &m_oTargetPage;
m_oTabControl.InsertItem(1,&stTabItem);
stTabItem.mask = TCIF_TEXT|TCIF_PARAM ;
stTabItem.pszText = "Rotation Center";
stTabItem.lParam = (LPARAM) &m_oRotCenterPage;
m_oTabControl.InsertItem(2,&stTabItem);
// move the pages at the right place
m_oTargetPage.SetWindowPos(&wndTop,oRect.left,oRect.top,0,0,SWP_NOSIZE);
m_oRotCenterPage.SetWindowPos(&wndTop,oRect.left,oRect.top,0,0,SWP_NOSIZE);
m_oGeneralPage.SetWindowPos(&wndTop,oRect.left,oRect.top,0,0,SWP_NOSIZE);
// activate the first tab
m_oTabControl.SetCurSel(0);
m_oGeneralPage.ShowWindow(SW_SHOWNORMAL);
// put the type name of the camera
m_csTypeName = (m_p_oCamera->GetCameraType() == InertCamera)? "Editor Camera" : "Actor Camera" ;
// put the name of the camera
m_csCameraName = m_p_oCamera->GetName();
// update drawing
UpdateData(FALSE);
eDisplayMode = M_GetDLL(m_p_oCamera) -> GetReferentialDisplayMode();
if( eDisplayMode == DisplayNone )
M_GetAxisCombo() -> SelectString(-1,"No");
else if( eDisplayMode == DisplayDownLeft )
M_GetAxisCombo() -> SelectString(-1,"Down Left");
else if( eDisplayMode == DisplayDownRight)
M_GetAxisCombo() -> SelectString(-1,"Down Right");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void CompleteProperties::OnSelchangingTabProperties(NMHDR* pNMHDR, LRESULT* pResult)
{
int index;
TC_ITEM stTabItem;
PageBase *p_oPage;
stTabItem.mask = TCIF_PARAM ;
index = TabCtrl_GetCurSel(pNMHDR->hwndFrom);
m_oTabControl.GetItem(index,&stTabItem);
p_oPage = (PageBase*)stTabItem.lParam;
if (p_oPage->IsPageValid())
{
p_oPage->ShowWindow(SW_HIDE);
p_oPage->MakeChangesAvailable();
*pResult = 0;
}
else
{
*pResult = TRUE;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void CompleteProperties::OnSelchangeTabProperties(NMHDR* pNMHDR, LRESULT* pResult)
{
int index;
TC_ITEM stTabItem;
PageBase *p_oPage;
stTabItem.mask = TCIF_PARAM ;
index = TabCtrl_GetCurSel(pNMHDR->hwndFrom);
m_oTabControl.GetItem(index,&stTabItem);
p_oPage = (PageBase*)stTabItem.lParam;
p_oPage->ShowWindow(SW_SHOWNORMAL);
*pResult = 0;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void CompleteProperties::OnOK()
{
int index,i;
TC_ITEM stTabItem;
PageBase *p_oPage;
UpdateData(TRUE);
stTabItem.mask = TCIF_PARAM ;
// look if all tabs are valid
//beginning with the active one
index = m_oTabControl.GetCurSel();
m_oTabControl.GetItem(index,&stTabItem);
p_oPage = (PageBase*)stTabItem.lParam;
if (!p_oPage->IsPageValid())
return;
// then all other ones
for (i=0; i<m_oTabControl.GetItemCount(); i++)
{
if (i != index)
{
m_oTabControl.GetItem(i,&stTabItem);
p_oPage = (PageBase*)stTabItem.lParam;
if (!p_oPage->IsPageValid())
{
m_oTabControl.SetCurSel(i);
return;
}
}
}
// ok, everything is valid
// so let's make changes
for (i=0; i<m_oTabControl.GetItemCount(); i++)
{
m_oTabControl.GetItem(i,&stTabItem);
p_oPage = (PageBase*)stTabItem.lParam;
p_oPage->MakeChangesAvailable();
p_oPage->DoUpdate();
}
// Axis Display
int iIndex = M_GetAxisCombo() -> GetCurSel();
if( iIndex != CB_ERR )
{
CString csText;
M_GetAxisCombo() -> GetLBText( iIndex, csText );
if( csText == "No" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayNone );
else if( csText == "Down Left" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayDownLeft );
else if( csText == "Down Right" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayDownRight );
}
CDialog::OnOK();
}

View File

@@ -0,0 +1,540 @@
#include <direct.h>
#include "stdafx.h"
#include "acp_base.h"
#include "ITF.h"
#include "caminter.hpp"
#include "camresrc.h"
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Camera_Interface::SendDialogBarCommandToCamera(CPA_BaseObject *_p_oCamera,UINT nID)
{
Camera *p_oCamera;
ASSERT(_p_oCamera != NULL);
p_oCamera = (Camera*)_p_oCamera;
ASSERT(p_oCamera->fn_bIsOfType(C_szCameraObjectTypeName));
p_oCamera->GetDialogBar()->OnCommand(nID);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Camera_Interface::ShowDialogBar(CPA_BaseObject *_p_oCamera)
{
Camera *p_oCamera;
ASSERT(_p_oCamera != NULL);
p_oCamera = (Camera*)_p_oCamera;
ASSERT(p_oCamera->fn_bIsOfType(C_szCameraObjectTypeName));
p_oCamera->GetDialogBar()->Show();
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Camera_Interface::HideDialogBar(CPA_BaseObject *_p_oCamera)
{
Camera *p_oCamera;
ASSERT(_p_oCamera != NULL);
p_oCamera = (Camera*)_p_oCamera;
ASSERT(p_oCamera->fn_bIsOfType(C_szCameraObjectTypeName));
p_oCamera->GetDialogBar()->Hide();
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::OnToolTipNotify (CPA_BaseObject *_p_oCamera, TOOLTIPTEXT *p_TTT, UINT nID)
{
Camera *p_oCamera;
ASSERT(_p_oCamera != NULL);
p_oCamera = (Camera*)_p_oCamera;
ASSERT(p_oCamera->fn_bIsOfType(C_szCameraObjectTypeName));
return p_oCamera->GetDialogBar()->GetToolTipText(p_TTT,nID);
}
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
DialogBar::DialogBar()
{
m_p_oParentWnd = NULL;
m_p_oCamera = NULL;
m_p_oInterface = NULL;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
DialogBar::DialogBar(DialogBar& r_src) : m_oToolBar(r_src.m_oToolBar)
{
m_p_oParentWnd = NULL;
m_p_oCamera = NULL;
m_p_oInterface = NULL;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::SetCamera(Camera *p_oCamera)
{
m_p_oCamera = p_oCamera;
m_p_oInterface = (Camera_Interface*) p_oCamera->GetEditor();
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::InitInertCameraDialogBar(Camera *p_oCamera)
{
//ToolBar definition
tdstButtonDef a_stButtonDef[] =
{
{ID_FREEVIEW, TRUE, "Select Camera View"},
{ID_FRONTVIEW, FALSE, "Front View"},
{ID_RIGHTVIEW, FALSE, "Right View"},
{ID_LEFTVIEW, FALSE, "Left View"},
{ID_TOPVIEW, FALSE, "Top View"},
{ID_BOTTOMVIEW, FALSE, "Bottom View"},
{ID_BACKVIEW, FALSE, "Back View"},
{ID_ENDFAMILY, FALSE, ""},
{ID_NOTTARGETED,TRUE, "Target : None"},
{ID_POINTTARGETED,TRUE, "Target : Point"},
{ID_SOTARGETED,TRUE, "Target : Object"},
{ID_ENDFAMILY, FALSE, ""},
{ID_PREFERENCES,TRUE, "Settings"},
{ID_ENDFAMILY, FALSE, ""},
{ID_SELECTCAMERA,TRUE, "Select Camera Slot"},
{ID_ENDFAMILY, FALSE, ""},
{ID_SAVECAMERA,TRUE, "Get New Camera Slot"},
{ID_ENDFAMILY, FALSE, ""},
};
m_oToolBar.Define(a_stButtonDef,18,IDR_CAMERATB,ID_ENDFAMILY,18,18);
m_oToolBar.SetVisibility(ID_FREEVIEW,FALSE);
m_oToolBar.SetInitialPermission(ID_SOTARGETED,FALSE);
m_oToolBar.SetPermission(ID_SOTARGETED,FALSE);
//camera definition
m_p_oCamera = p_oCamera;
m_p_oInterface = (Camera_Interface*) p_oCamera->GetEditor();
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::Hide()
{
if (m_p_oParentWnd != NULL)
{
m_oToolBar.ShowWindow(SW_HIDE);
m_p_oParentWnd->m_p_oCamera = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::Show()
{
if (!M_bEditorsActive())
return;
if (m_p_oParentWnd != NULL)
{
m_oToolBar.ShowWindow(SW_SHOW);
m_p_oParentWnd->m_p_oCamera = m_p_oCamera;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL DialogBar::GetToolTipText(TOOLTIPTEXT *p_TTT, UINT nID)
{
return m_oToolBar.GetToolTipText(p_TTT,nID);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::Create(CPA_DialogBar *p_oPopUpParent, CPoint oPos)
{
//if a window was given for ToolBar
if (p_oPopUpParent != NULL && p_oPopUpParent->m_hWnd != NULL)
{
if (m_p_oParentWnd == NULL)
{
// the dialog bar has not been created yet for this window...
// create toolbar
m_oToolBar.CreateToolBarCtrl(p_oPopUpParent,oPos);
m_p_oParentWnd = p_oPopUpParent;
}
else
{
// the dialog bar has already been created, check if it's the same window
ASSERT(m_p_oParentWnd == p_oPopUpParent);
}
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::Destroy()
{
// detach toolbar from its window
if (m_p_oParentWnd != NULL)
{
m_oToolBar.DestroyWindow();
m_p_oParentWnd->m_p_oCamera = NULL;
m_p_oParentWnd = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void DialogBar::OnCommand(UINT nID)
{
CPA_CameraSlots *p_oCameraSlot;
DEV_ViewPort3D *p_oFocusViewport;
// get the focus viewport
p_oFocusViewport = m_p_oCamera->GetViewport();
// get the camera slots
p_oCameraSlot = p_oFocusViewport->GetParentMultiDevice3D()->GetWorld()->GetCameraSlots();
switch(nID)
{
case ID_FREEVIEW:
break;
case ID_FRONTVIEW:
m_p_oCamera->FrontView();
break;
case ID_RIGHTVIEW:
m_p_oCamera->RightView();
break;
case ID_LEFTVIEW:
m_p_oCamera->LeftView();
break;
case ID_TOPVIEW:
m_p_oCamera->TopView();
break;
case ID_BOTTOMVIEW:
m_p_oCamera->BottomView();
break;
case ID_BACKVIEW:
m_p_oCamera->BackView();
break;
case ID_NOTTARGETED:
m_p_oCamera->SetTargetType(tNone);
break;
case ID_POINTTARGETED:
m_p_oCamera->SetTargetType(tPoint);
m_p_oCamera->Update();
m_p_oInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case ID_SOTARGETED:
m_p_oCamera->SetTargetType(tSuperObject);
m_p_oCamera->Update();
m_p_oInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case ID_PREFERENCES:
m_p_oCamera->Preferences();
break;
case ID_SELECTCAMERA:
{
Camera *p_oCamera;
Camera_Interface *p_oInterface;
//Stefan Dumitrean 22-06-98 ( slots )
long lSlotNum;
// let the user choose a slot camera from a popup menu
p_oCamera = (Camera*)p_oCameraSlot->GetCameraFromPopUpMenu(lSlotNum,m_p_oParentWnd,MakeACopy);
//End Stefan Dumitrean 22-06-98 ( slots )
//and set this new camera in the focus viewport
// the old camera (if any) is totally destroyed
if (p_oCamera != NULL)
{
CPA_SuperObject *p_oCameraSO,*p_oOldCameraSO;
//Stefan Dumitrean 29-06-98 ( slots )
// get or build a superobject for this camera
if( p_oCameraSlot->IsSpecialSlot(lSlotNum))
p_oOldCameraSO = p_oFocusViewport->GetCameraSO( );
else
{
p_oCameraSO = m_p_oInterface->AssociateSuperObject(p_oCamera);
// put this camera in the viewport
p_oOldCameraSO = p_oFocusViewport->ChangeCamera(p_oCameraSO);
}
//End Stefan Dumitrean 29-06-98 ( slots )
//Stefan Dumitrean 22-06-98 ( slots )
// if normal slot, save the camera position in the current slot
if (!p_oCameraSlot->IsSpecialSlot( p_oCameraSlot->GetCurrentSlot()))
p_oCameraSlot->SaveCameraInSlot(p_oCameraSlot->GetCurrentSlot(),"",p_oOldCameraSO->GetObject(),MakeACopy);
// special slot : ask for save in a new slot
else
{
if (AfxMessageBox("The current slot is the default one. \n Do you want to save it in a new slot ?",
MB_ICONWARNING|MB_OKCANCEL) == IDOK)
{
Camera_NewSlot oDialog;
CString csName;
long lSlotNumber = p_oCameraSlot->FindFirstEmptySlot();
csName.Format("Default Slot %i", lSlotNumber);
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle( m_p_oInterface->GetDLLIdentity()->hModule );
// call dialog to find new name
if (oDialog.fn_iDoDialog(csName, TRUE) == IDOK)
{
if( lSlotNumber >= 0 )
p_oCameraSlot->SaveCameraInSlot(lSlotNumber,oDialog.GetName(),p_oOldCameraSO->GetObject(),MakeACopy);
else
p_oCameraSlot->SaveCameraInSlot(-1,oDialog.GetName(),p_oOldCameraSO->GetObject(),MakeACopy);
}
AfxSetResourceHandle( hOldInst );
}
}
m_p_oInterface->SaveSlotsPositions();
if (p_oCameraSlot->IsSpecialSlot(lSlotNum) || !p_oCameraSlot->IsSlotReserved(lSlotNum))
p_oCameraSlot->SetCurrentSlot(lSlotNum);
//End Stefan Dumitrean 22-06-98 ( slots )
//Stefan Dumitrean 26-06-98 ( slots )
if (!p_oCameraSlot->IsSpecialSlot(lSlotNum))
{
// keep in memory the interface, because if I destroy the old camera,I destroy "THIS"
p_oInterface = m_p_oInterface;
// remove the old camera from the hierarchy, and destroy it
m_p_oInterface->DestroyCamera(p_oOldCameraSO);
// and put the new camera in the hierarchy
p_oInterface->InsertCameraInHierarchy(p_oCameraSO);
//restore the editor and selection saved with the slot 2-07-98
if (!p_oCameraSlot->IsSlotReserved(lSlotNum))
{
p_oCameraSlot->SetCurrentEditorForSlotNr(lSlotNum);
p_oCameraSlot->SetCurrentSelectionForSlotNr(lSlotNum);
}
p_oCamera->GetMainWorld()->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
//End Stefan Dumitrean 26-06-98 ( slots )
}
}
break;
case ID_SAVECAMERA:
{
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle( m_p_oInterface->GetDLLIdentity()->hModule );
Camera_NewSlot oDialog;
CString csName;
long lNewSlot;
//Stefan Dumitrean 22-06-98 ( slots )
// special slot
if (p_oCameraSlot->IsSpecialSlot(p_oCameraSlot->GetCurrentSlot()))
{
if (AfxMessageBox("The current slot is the default one. \n Do you want to save it in a new slot ?",
MB_ICONWARNING|MB_OKCANCEL) == IDOK)
{
long lNewSlot = p_oCameraSlot->FindFirstEmptySlot();
csName.Format("Default Slot %i", lNewSlot);
// call dialog to find new name
if (oDialog.fn_iDoDialog(csName, TRUE) == IDOK)
{
if( lNewSlot >= 0 )
p_oCameraSlot->SaveCameraInSlot(lNewSlot,oDialog.GetName(),m_p_oCamera,MakeACopy);
else
p_oCameraSlot->SaveCameraInSlot(-1,oDialog.GetName(),m_p_oCamera,MakeACopy);
// set new current slot
p_oCameraSlot->SetCurrentSlot(lNewSlot);
}
}
}
// get an empty slot
lNewSlot = p_oCameraSlot->FindFirstEmptySlot();
csName.Format("Slot %i", lNewSlot);
// call dialog to find new name
if (oDialog.fn_iDoDialog(csName) == IDOK)
{
long lSlotNum = p_oCameraSlot->SaveCameraInSlot(lNewSlot,oDialog.GetName(),m_p_oCamera,MakeACopy);
// save the camera position in the current slot
if( !p_oCameraSlot->IsSpecialSlot(p_oCameraSlot->GetCurrentSlot()))
p_oCameraSlot->SaveCameraInSlot(p_oCameraSlot->GetCurrentSlot(),"",m_p_oCamera,MakeACopy);
// update current slot
if (!p_oCameraSlot->IsSlotReserved(lSlotNum))
p_oCameraSlot->SetCurrentSlot(lSlotNum);
}
//BEGIN CPA2 Laurentiu Barza 24-03-98
m_p_oInterface->SaveSlotsPositions();
//END CPA2 Laurentiu Barza 24-03-98
AfxSetResourceHandle( hOldInst );
}
break;
default:
break;
}
p_oFocusViewport->SetFocus();
}
//#################################################################################
// Camera_NewSlot dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
Camera_NewSlot::Camera_NewSlot (CWnd* pParent)
: CDialog (Camera_NewSlot::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(Camera_NewSlot)
//}}AFX_DATA_INIT
}
/*----------------------------------------
----------------------------------------*/
void Camera_NewSlot::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Camera_NewSlot)
DDX_Control(pDX, IDC_SLOT_NAME, m_cNewName);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(Camera_NewSlot, CDialog)
//{{AFX_MSG_MAP(Camera_NewSlot)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*----------------------------------------
----------------------------------------*/
int Camera_NewSlot::fn_iDoDialog (CString _csName, BOOL bDefault)
{
// create the dialog
m_csName = _csName;
m_bDefault = bDefault;
return DoModal();
}
/*----------------------------------------
----------------------------------------*/
BOOL Camera_NewSlot::OnInitDialog (void)
{
// Create the dialog
CDialog::OnInitDialog();
// init window text
if (!m_bDefault)
SetWindowText("CREATE NEW SLOT");
else
SetWindowText("REGISTER DEFAULT SLOT");
// init name
m_cNewName.SetWindowText(m_csName);
return TRUE;
}
/*----------------------------------------
----------------------------------------*/
void Camera_NewSlot::OnOK (void)
{
// get new name
m_cNewName.GetWindowText(m_csName);
// close dialog
CDialog::OnOK();
}
/*----------------------------------------
----------------------------------------*/
void Camera_NewSlot::OnCancel (void)
{
// get new name
m_cNewName.GetWindowText(m_csName);
// close dialog
CDialog::OnCancel();
}

View File

@@ -0,0 +1,801 @@
#include <direct.h>
#include "stdafx.h"
#include "acp_base.h"
#include "geo.h"
#include "gli.h"
#include "ITF.h"
#include "caminter.hpp"
#include "camresrc.h"
//Keyboard constants
enum{ KA_RotateX = 1,
KA_RotateY,
KA_RotateZ,
KA_InvRotateX,
KA_InvRotateY,
KA_InvRotateZ,
KA_MoveX,
KA_MoveY,
KA_MoveZ,
KA_InvMoveX,
KA_InvMoveY,
KA_InvMoveZ,
KA_IncreaseTStep,
KA_DecreaseTStep,
KA_FrontView,
KA_BackView,
KA_RightView,
KA_LeftView,
KA_TopView,
KA_BottomView,
KA_ToggleTargetSO,
KA_ToggleTargetPoint,
KA_TargetSO,
//CPA2 Corneliu Babiuc 15-05-98
KA_ZoomSO,
KA_CenterSO,
KA_EasyPointTarget,
KA_NotTargeted,
KA_AutoTarget,
KA_AutoZoom,
KA_PutCameraInEmptySlot,
KA_GetSlot1,
KA_GetSlot2,
KA_GetSlot3,
KA_GetSlot4,
KA_GetSlot5,
KA_GetSlot6,
KA_GetSlot7,
KA_GetSlot8,
KA_GetSlot9
//END CPA2 Corneliu Babiuc 15-05-98
};
static tdstKeyboardActionDef gs_a_stCameraKeys[] =
{
{"Turn right (Y axis)", KA_InvRotateY},
{"Turn left (Y axis)", KA_RotateY},
{"Look up (X axis)", KA_InvRotateX},
{"Look down (X axis)", KA_RotateX},
{"Twist clockwise (Z axis)", KA_RotateZ},
{"Twist counter-clockwise (Z axis)", KA_InvRotateZ},
{"Move left (X+)", KA_MoveX},
{"Move right (X-)", KA_InvMoveX},
{"Move up (Y+)", KA_MoveY},
{"Move down (Y-)", KA_InvMoveY},
{"Move forward (Z+)", KA_MoveZ},
{"Move backward (Z-)", KA_InvMoveZ},
{"Increase Translation Step", KA_IncreaseTStep},
{"Decrease Translation Step", KA_DecreaseTStep},
{"Front View", KA_FrontView},
{"Back View", KA_BackView},
{"Left View", KA_LeftView},
{"Right View", KA_RightView},
{"Top View", KA_TopView},
{"Bottom View", KA_BottomView},
{"Toggle SuperObject Targeted", KA_ToggleTargetSO},
{"Toggle Point Targeted", KA_ToggleTargetPoint},
{"Target Selected Object", KA_TargetSO},
{"Center Selected Object", KA_CenterSO},
{"Zoom Selected Object", KA_ZoomSO},
{"Easy Point Target", KA_EasyPointTarget},
{"Camera Not Targeted", KA_NotTargeted},
{"AutoTarget", KA_AutoTarget},
{"AutoZoom", KA_AutoZoom},
{"Put Camera in empty slot ", KA_PutCameraInEmptySlot},
{"Get Slot 1", KA_GetSlot1},
{"Get Slot 2", KA_GetSlot2},
{"Get Slot 3", KA_GetSlot3},
{"Get Slot 4", KA_GetSlot4},
{"Get Slot 5", KA_GetSlot5},
{"Get Slot 6", KA_GetSlot6},
{"Get Slot 7", KA_GetSlot7},
{"Get Slot 8", KA_GetSlot8},
{"Get Slot 9", KA_GetSlot9},
{NULL, 0}
};
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Camera_Interface::InitKeyboard()
{
m_p_oKeyConfiguration = new CPA_KeyActionConfiguration("camera\\camera.ini", gs_a_stCameraKeys);
m_p_oKeyConfiguration->mfn_vSetObjectName("Camera Editor");
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::SendKeyDownToCamera (CPA_BaseObject *p_oCamera, UINT nChar, UINT nRepCnt, UINT nFlags)
{
ASSERT(p_oCamera != NULL);
ASSERT(p_oCamera->fn_bIsOfType(C_szCameraObjectTypeName));
// Camera Rotation.
if (KeyRotateCamera((Camera*)p_oCamera,nChar,(nRepCnt != 1)))
{
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
if (GetInterface()->GetStatusBarMode() == E_sb_CameraInfo)
((Camera*)p_oCamera)->GetViewport()->fn_vUpdateStatusBarMessage();
return TRUE;
}
// Camera Move.
if (KeyMoveCamera((Camera*)p_oCamera,nChar,(nRepCnt != 1)))
{
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
if (GetInterface()->GetStatusBarMode() == E_sb_CameraInfo)
((Camera*)p_oCamera)->GetViewport()->fn_vUpdateStatusBarMessage();
return TRUE;
}
// Camera Move.
if (KeyViewCamera((Camera*)p_oCamera,nChar))
{
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
if (GetInterface()->GetStatusBarMode() == E_sb_CameraInfo)
((Camera*)p_oCamera)->GetViewport()->fn_vUpdateStatusBarMessage();
return TRUE;
}
// Camera Move.
if (KeyOtherActions((Camera*)p_oCamera,nChar))
{
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
if (GetInterface()->GetStatusBarMode() == E_sb_CameraInfo)
((Camera*)p_oCamera)->GetViewport()->fn_vUpdateStatusBarMessage();
return TRUE;
}
return FALSE;
}
//==================================================================================================
//==================================================================================================
//==================================================================================================
//==================================================================================================
//================ P R I V A T E ===================================================================
//==================================================================================================
//==================================================================================================
BOOL Camera_Interface::KeyRotateCamera(Camera *p_oCamera, UINT nChar, BOOL bRepeat)
{
switch (m_p_oKeyConfiguration->mfn_uwKeyToAction(nChar))
{
case KA_RotateX :
p_oCamera->Rotate(X_Custom, m_fRotationStep);
return TRUE;
break;
case KA_InvRotateX :
p_oCamera->Rotate(X_Custom, -m_fRotationStep);
return TRUE;
break;
case KA_RotateY :
p_oCamera->Rotate(Y_Custom, m_fRotationStep);
return TRUE;
break;
case KA_InvRotateY :
p_oCamera->Rotate(Y_Custom, -m_fRotationStep);
return TRUE;
break;
case KA_RotateZ :
p_oCamera->Rotate(Z_Custom, m_fRotationStep);
return TRUE;
break;
case KA_InvRotateZ :
p_oCamera->Rotate(Z_Custom, -m_fRotationStep);
return TRUE;
break;
}
return FALSE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::KeyMoveCamera(Camera *p_oCamera, UINT nChar, BOOL bRepeat)
{
CPA_CameraCoords oCoords;
switch (m_p_oKeyConfiguration->mfn_uwKeyToAction(nChar))
{
case KA_MoveX :
if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
{
//we have a target, so we rotate
p_oCamera->Rotate(Y_Custom, m_fRotationStep);
}
else
{
oCoords.SetXYZ(m_fTranslationStep,0,0);
p_oCamera->Translate(&oCoords,TRUE);
}
return TRUE;
break;
case KA_InvMoveX :
if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
{
//we have a target, so we rotate
p_oCamera->Rotate(Y_Custom, -m_fRotationStep);
}
else
{
oCoords.SetXYZ(-m_fTranslationStep,0,0);
p_oCamera->Translate(&oCoords,TRUE);
}
return TRUE;
break;
case KA_MoveY :
if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
{
//we have a target, so we rotate
p_oCamera->Rotate(X_Custom, m_fRotationStep);
}
else
{
oCoords.SetXYZ(0,m_fTranslationStep,0);
p_oCamera->Translate(&oCoords,TRUE);
}
return TRUE;
break;
case KA_InvMoveY :
if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
{
//we have a target, so we rotate
p_oCamera->Rotate(X_Custom, -m_fRotationStep);
}
else
{
oCoords.SetXYZ(0,-m_fTranslationStep,0);
p_oCamera->Translate(&oCoords,TRUE);
}
return TRUE;
break;
case KA_MoveZ :
oCoords.SetXYZ(0,0,m_fTranslationStep);
p_oCamera->Translate(&oCoords,TRUE);
return TRUE;
break;
case KA_InvMoveZ :
oCoords.SetXYZ(0,0,-m_fTranslationStep);
p_oCamera->Translate(&oCoords,TRUE);
return TRUE;
break;
}
return FALSE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::KeyOtherActions(Camera *p_oCamera, UINT nChar)
{
CPA_SuperObject *p_oSelection;
switch (m_p_oKeyConfiguration->mfn_uwKeyToAction(nChar))
{
case KA_IncreaseTStep :
m_fTranslationStep = m_fTranslationStep * 10.0;
if (m_fTranslationStep == 0)
m_fTranslationStep = 0.001;
if (m_fTranslationStep > 10000)
m_fTranslationStep = 10000;
return TRUE;
case KA_DecreaseTStep :
m_fTranslationStep = m_fTranslationStep / 10.0;
if (m_fTranslationStep < 0.001)
m_fTranslationStep = 0.001;
return TRUE;
case KA_TargetSO :
// get the selected superobject
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
if (p_oSelection == NULL)
{
M_GetMainWnd()->UpdateStatus("there is no valid selection to target",C_STATUSPANE_INFOS,C_STATUS_WARNING);
return TRUE;
}
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
return TRUE;
break;
case KA_ToggleTargetSO :
if (p_oCamera->GetTargetType() != tSuperObject)
{
BOOL bResult;
bResult = p_oCamera->SetTargetType(tSuperObject);
if (!bResult)
{
M_GetMainWnd()->UpdateStatus("there is no valid target in this camera",C_STATUSPANE_INFOS,C_STATUS_WARNING);
}
else
{
p_oCamera->Update();
}
return TRUE;
}
p_oCamera->SetTargetType(tNone);
return TRUE;
break;
case KA_ToggleTargetPoint :
if (p_oCamera->GetTargetType() != tPoint)
{
p_oCamera->SetTargetType(tPoint);
return TRUE;
}
p_oCamera->SetTargetType(tNone);
return TRUE;
break;
//CPA2 Corneliu Babiuc 15-05-98
// center camera on object
case KA_CenterSO:
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
if (p_oSelection != NULL)
{
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
p_oCamera->SetTargetType(tNone);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
return TRUE;
case KA_ZoomSO:
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
if (p_oSelection != NULL)
{
p_oCamera->ZoomOnTarget(p_oSelection);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
else if (p_oCamera->GetTargetType() == tSuperObject)
{
p_oCamera->ZoomOnTarget();
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
return TRUE;
case KA_EasyPointTarget:
ChangeCameraTarget();
return TRUE;
case KA_NotTargeted:
p_oCamera->SetTargetType(tNone);
return TRUE;
case KA_AutoTarget:
GetInterface()->SetAutoTarget(!GetInterface()->fn_bAutoTarget());
return TRUE;
case KA_AutoZoom:
GetInterface()->SetAutoZoom(!GetInterface()->fn_bAutoZoom());
return TRUE;
case KA_PutCameraInEmptySlot:
{
//Stefan Dumitrean 22-06-98 ( slots )
CPA_CameraSlots * p_oCameraSlot = GetMainWorld()->GetWorld()->GetCameraSlots();
//save camera in empty slot
long lSlotNum = p_oCameraSlot->SaveCameraInSlot(-1,"",p_oCamera,MakeACopy);
// normal slot : save the camera position in the current slot
if (!p_oCameraSlot->IsSpecialSlot( p_oCameraSlot->GetCurrentSlot()))
p_oCameraSlot->SaveCameraInSlot(p_oCameraSlot->GetCurrentSlot(),"",p_oCamera,MakeACopy);
// special slot : save in empty slot
else
{
if (AfxMessageBox("The current slot is the default one. \n Do you want to save it in a new slot ?",
MB_ICONWARNING|MB_OKCANCEL) == IDOK)
{
Camera_NewSlot oDialog;
CString csName;
long lNewSlot = p_oCameraSlot->FindFirstEmptySlot();
csName.Format("Default Slot %i", lNewSlot);
// call dialog to find new name
if (oDialog.fn_iDoDialog(csName, TRUE) == IDOK)
{
if( lNewSlot >= 0 )
p_oCameraSlot->SaveCameraInSlot(lNewSlot,oDialog.GetName(),p_oCamera,MakeACopy);
else
p_oCameraSlot->SaveCameraInSlot(-1,oDialog.GetName(),p_oCamera,MakeACopy);
// set new current slot
p_oCameraSlot->SetCurrentSlot(lNewSlot);
}
}
}
if (p_oCameraSlot->IsSpecialSlot(lSlotNum) || !p_oCameraSlot->IsSlotReserved(lSlotNum))
p_oCameraSlot->SetCurrentSlot(lSlotNum);
//End Stefan Dumitrean 22-06-98 ( slots )
//save slots positions in .ECA file
SaveSlotsPositions();
return TRUE;
}
case KA_GetSlot1:
case KA_GetSlot2:
case KA_GetSlot3:
case KA_GetSlot4:
case KA_GetSlot5:
case KA_GetSlot6:
case KA_GetSlot7:
case KA_GetSlot9:
//get camera slots
CPA_CameraSlots * p_oCameraSlot = GetMainWorld()->GetWorld()->GetCameraSlots();
//get the number of slot
long lSlotNumber = m_p_oKeyConfiguration->mfn_uwKeyToAction(nChar) - KA_PutCameraInEmptySlot;
//if the slot is not empty restore camera
if (! p_oCameraSlot->IsEmpty(lSlotNumber) )
{
(Camera *) p_oCamera = (Camera*)p_oCameraSlot->GetCameraFromSlot(lSlotNumber,MakeACopy);
//and set this new camera in the focus viewport
// the old camera (if any) is totally destroyed
if (p_oCamera != NULL)
{
CPA_SuperObject *p_oCameraSO,*p_oOldCameraSO;
//get or build a superobject for this camera
//Stefan Dumitrean 29-06-98 ( slots )
DEV_ViewPort3D * p_oViewPort = (DEV_ViewPort3D*)(M_GetMainDeviceNum(0)->GetViewPort());
if( p_oCameraSlot->IsSpecialSlot( lSlotNumber ) )
p_oOldCameraSO = p_oViewPort->GetCameraSO();
else
{
p_oCameraSO = AssociateSuperObject(p_oCamera);
p_oOldCameraSO = p_oViewPort->ChangeCamera(p_oCameraSO);
}
//End Stefan Dumitrean 29-06-98 ( slots )
//Stefan Dumitrean 22-06-98 ( slots )
// normal slot : save the camera position in the current slot
if (!p_oCameraSlot->IsSpecialSlot( p_oCameraSlot->GetCurrentSlot()))
p_oCameraSlot->SaveCameraInSlot(p_oCameraSlot->GetCurrentSlot(),"",p_oOldCameraSO->GetObject(),MakeACopy);
// special slot : save in empty slot
else
{
if (AfxMessageBox("The current slot is the default one. \n Do you want to save it in a new slot ?",
MB_ICONWARNING|MB_OKCANCEL) == IDOK)
{
Camera_NewSlot oDialog;
CString csName;
long lNewSlot = p_oCameraSlot->FindFirstEmptySlot();
csName.Format("Default Slot %i", lNewSlot);
// call dialog to find new name
if (oDialog.fn_iDoDialog(csName, TRUE) == IDOK)
{
if( lNewSlot >= 0 )
p_oCameraSlot->SaveCameraInSlot(lNewSlot,oDialog.GetName(),p_oOldCameraSO->GetObject(),MakeACopy);
else
p_oCameraSlot->SaveCameraInSlot(-1,oDialog.GetName(),p_oOldCameraSO->GetObject(),MakeACopy);
// set new current slot
p_oCameraSlot->SetCurrentSlot(lNewSlot);
}
}
}
SaveSlotsPositions();
if (p_oCameraSlot->IsSpecialSlot(lSlotNumber) || !p_oCameraSlot->IsSlotReserved(lSlotNumber))
p_oCameraSlot->SetCurrentSlot(lSlotNumber);
//End Stefan Dumitrean 22-06-98 ( slots )
//Stefan Dumitrean 29-06-98 ( slots )
if (!p_oCameraSlot->IsSpecialSlot(lSlotNumber))
{
// remove the old camera from the hierarchy, and destroy it
DestroyCamera(p_oOldCameraSO);
// and put the new camera in the hierarchy
InsertCameraInHierarchy(p_oCameraSO);
//restore the editor and selection saved with the slot 2-07-98
if (!p_oCameraSlot->IsSlotReserved(lSlotNumber))
{
p_oCameraSlot->SetCurrentEditorForSlotNr( lSlotNumber );
p_oCameraSlot->SetCurrentSelectionForSlotNr( lSlotNumber );
}
p_oCamera->GetMainWorld()->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
//End Stefan Dumitrean 29-06-98 ( slots )
}
}
return TRUE;
//END CPA2 Corneliu Babiuc 21-05-98
}
return FALSE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::KeyViewCamera(Camera *p_oCamera, UINT nChar)
{
switch (m_p_oKeyConfiguration->mfn_uwKeyToAction(nChar))
{
case KA_FrontView:
p_oCamera->FrontView();
return TRUE;
break;
case KA_BackView:
p_oCamera->BackView();
return TRUE;
break;
case KA_LeftView:
p_oCamera->LeftView();
return TRUE;
break;
case KA_RightView:
p_oCamera->RightView();
return TRUE;
break;
case KA_TopView:
p_oCamera->TopView();
return TRUE;
break;
case KA_BottomView:
p_oCamera->BottomView();
return TRUE;
break;
}
return FALSE;
}
//**********************************************************************************
// CPA_Ed_1 MP BEGIN
//**********************************************************************************
#define R_SENSITIVITY 64
#define T_SENSITIVITY 128
void Camera_Interface::UpdatePosition( Camera *p_oCamera, tdstMousePos *p_stPos )
{
DEV_ViewPort3D *vp=p_oCamera->GetViewport();
CRect rect;
vp->GetClientRect( &rect );
CPoint point;
point=p_stPos->stPos;
vp->ScreenToClient( &point );
if( !rect.PtInRect( point ) )
{
if( point.x<rect.left )
point.x+=rect.Width();
else
if( point.x>=rect.right )
point.x-=rect.Width();
if( point.y<rect.top )
point.y+=rect.Height();
else
if( point.y>=rect.bottom )
point.y-=rect.Height();
vp->ClientToScreen( &point );
SetCursorPos( point.x, point.y );
p_stPos->stPos=point;
}
m_stMousePos=*p_stPos;
}
BOOL Camera_Interface::MouseRotateCamera( Camera *p_oCamera, tdstMousePos *p_stPos )
{
BOOL retval=FALSE;
int dx=p_stPos->stPos.x-m_stMousePos.stPos.x;
int dy=p_stPos->stPos.y-m_stMousePos.stPos.y;
UpdatePosition( p_oCamera, p_stPos );
m_stMousePos=*p_stPos;
if( dx!=0 )
{
//ANNECY Shaitan correction 19/02/98
p_oCamera->Rotate(Y_Custom, /*-*/dx*m_fRotationStep/R_SENSITIVITY);
//ENDANNECY Shaitan correction
retval=TRUE;
}
if( dy!=0 )
{ p_oCamera->Rotate(X_Custom, dy*m_fRotationStep/R_SENSITIVITY);
retval=TRUE;
}
return retval;
}
BOOL Camera_Interface::MouseMoveCamera( Camera *p_oCamera, tdstMousePos *p_stPos )
{
CPA_CameraCoords oCoords;
BOOL retval=FALSE;
int dx=p_stPos->stPos.x-m_stMousePos.stPos.x;
int dy=p_stPos->stPos.y-m_stMousePos.stPos.y;
UpdatePosition( p_oCamera, p_stPos );
m_stMousePos=*p_stPos;
if( dx!=0 )
{ //if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
//{
// //we have a target, so we rotate
// p_oCamera->Rotate(Y_Custom, dx*m_fRotationStep/SENSITIVITY);
//}
//else
{
//ANNECY Shaitan correction 19/02/98
oCoords.SetXYZ(/*-*/dx*m_fTranslationStep/T_SENSITIVITY,0,0);
p_oCamera->Translate(&oCoords,TRUE);
//ENDANNECY Shaitan correction
}
retval=TRUE;
}
if( dy!=0 )
{ //if (p_oCamera->GetTargetType() != tNone && p_oCamera->GetTranslationAxisSystem() != WorldCoordinates)
//{
// //we have a target, so we rotate
// p_oCamera->Rotate(X_Custom, dy*m_fRotationStep/SENSITIVITY);
//}
//else
{
oCoords.SetXYZ(0,dy*m_fTranslationStep/T_SENSITIVITY,0);
p_oCamera->Translate(&oCoords,TRUE);
}
retval=TRUE;
}
return retval;
}
static HCURSOR oldcursor=NULL;
BOOL Camera_Interface::SendMouseMoveToCamera(CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, MTH3D_tdstVector *p_stVect)
{
if( !GetInterface()->fn_bMoveCamera() )
return FALSE;
if( nFlags & MK_RBUTTON )
m_bRotateOn=TRUE;
else
m_bRotateOn=FALSE;
if( !m_bIsMoving )
return FALSE;
Camera *pCamera=(Camera *)p_oCamera;
if( m_bRotateOn )
{
if( MouseRotateCamera( pCamera, p_stPos ))
{ GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
return TRUE;
}
}
else
{
if( MouseMoveCamera( pCamera, p_stPos ))
{ GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
return TRUE;
}
}
m_stMousePos=*p_stPos;
return TRUE;
}
BOOL Camera_Interface::SendLButtonDownToCamera(CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
if( !GetInterface()->fn_bMoveCamera() )
return FALSE;
m_stMousePos=*p_stPos;
m_bIsMoving=TRUE;
oldcursor=::SetCursor( hcursorM );
return TRUE;
}
BOOL Camera_Interface::SendRButtonDownToCamera(CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
if( !GetInterface()->fn_bMoveCamera() )
return FALSE;
if( !m_bIsMoving )
{
GetInterface()->GetFrameBase()->m_oGeneralDialogBar.SetMoveCamera( 0 );
return TRUE;
}
m_bRotateOn=TRUE;
::SetCursor( hcursorR );
return TRUE;
}
BOOL Camera_Interface::SendLButtonUpToCamera(CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos)
{
if( !GetInterface()->fn_bMoveCamera() )
return FALSE;
if( !m_bIsMoving )
return FALSE;
Camera *pCamera=(Camera *)p_oCamera;
m_bIsMoving=FALSE;
::SetCursor( oldcursor );
if( m_bRotateOn )
{ if( MouseRotateCamera( pCamera, p_stPos ))
{ GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
return TRUE;
}
}
else
{ if( MouseMoveCamera( pCamera, p_stPos ))
{ GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
return TRUE;
}
}
return FALSE;
}
BOOL Camera_Interface::SendRButtonUpToCamera(CPA_BaseObject *p_oCamera, UINT nFlags, tdstMousePos *p_stPos)
{
if( !GetInterface()->fn_bMoveCamera() )
return FALSE;
m_bRotateOn=FALSE;
if( m_bIsMoving )
::SetCursor( hcursorM );
else
::SetCursor( oldcursor );
return TRUE;
}
//**********************************************************************************
// CPA_Ed_1 MP END
// *********************************************************************************

View File

@@ -0,0 +1,446 @@
// pagegeneral.cpp : implementation file
//
#include "stdafx.h"
#include "acp_base.h"
#include "camresrc.h"
#include "pagegeneral.hpp"
#include "caminter.hpp"
#include "camera.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define M_GetDLL(Camera) ((Camera_Interface*)((Camera)->GetEditor()))
#define C_PI (float)3.14159265
/////////////////////////////////////////////////////////////////////////////
// PageGeneral dialog
PageGeneral::PageGeneral(Camera *p_oCamera)
: PageBase(PageGeneral::IDD)
{
//{{AFX_DATA_INIT(PageGeneral)
m_iTranslationAxis = -1;
m_iRotationAxis = -1;
m_csRotationValue = _T("");
m_csTranslationValue = _T("");
m_iTranslationStep = -1;
m_iRotationStep = -1;
m_bPrivilegeMode = FALSE;
//}}AFX_DATA_INIT
m_lIDofCurrentEdit = NULL;
m_p_oCamera = p_oCamera;
}
void PageGeneral::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(PageGeneral)
DDX_Radio(pDX, IDC_RB_TRANSAXISCAMERA, m_iTranslationAxis);
DDX_Radio(pDX, IDC_RB_ROTAXISCAMERA, m_iRotationAxis);
DDX_Text(pDX, IDC_EDIT_ROTVALUE, m_csRotationValue);
DDX_Text(pDX, IDC_EDIT_TRANSVALUE, m_csTranslationValue);
DDX_Radio(pDX, IDC_RB_10CM, m_iTranslationStep);
DDX_Radio(pDX, IDC_RB_PION4, m_iRotationStep);
DDX_Check(pDX, IDC_CHK_PRIVILEGEMODE, m_bPrivilegeMode);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(PageGeneral, CDialog)
//{{AFX_MSG_MAP(PageGeneral)
ON_EN_SETFOCUS(IDC_EDIT_ROTVALUE, OnSetfocusEditRotvalue)
ON_EN_KILLFOCUS(IDC_EDIT_ROTVALUE, OnKillfocusEditRotvalue)
ON_EN_KILLFOCUS(IDC_EDIT_TRANSVALUE, OnKillfocusEditTransvalue)
ON_EN_SETFOCUS(IDC_EDIT_TRANSVALUE, OnSetfocusEditTransvalue)
ON_BN_CLICKED(IDC_BT_RETURN, OnBtReturn)
ON_BN_CLICKED(IDC_RB_10CM, OnRbTranslationStep)
ON_BN_CLICKED(IDC_RB_PION4, OnRbRotationStep)
ON_BN_CLICKED(IDC_RB_10M, OnRbTranslationStep)
ON_BN_CLICKED(IDC_RB_1M, OnRbTranslationStep)
ON_BN_CLICKED(IDC_RB_50CM, OnRbTranslationStep)
ON_BN_CLICKED(IDC_RB_PION8, OnRbRotationStep)
ON_BN_CLICKED(IDC_RB_PION16, OnRbRotationStep)
ON_BN_CLICKED(IDC_RB_PION32, OnRbRotationStep)
ON_BN_CLICKED(IDC_CHK_PRIVILEGEMODE, OnChkPrivilegemode)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// PageGeneral message handlers
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageGeneral::OnInitDialog()
{
float fTransValue;
float fRotValue;
CDialog::OnInitDialog();
// get the current translation and rotation step
fTransValue = M_GetDLL(m_p_oCamera)->GetTranslationStep();
fRotValue = M_GetDLL(m_p_oCamera)->GetRotationStep() * 180 / C_PI;
// init the edit dialog values (and update the radiobuttons)
VERIFY(UpdateTransRadioButtons(fTransValue));
VERIFY(UpdateRotRadioButtons(fRotValue));
// init the translation and rotation axis
if (m_p_oCamera->GetRotationAxisSystem() == CameraCoordinates)
m_iRotationAxis = 0; //camera
else
m_iRotationAxis = 1; //world
if (m_p_oCamera->GetTranslationAxisSystem() == CameraCoordinates)
m_iTranslationAxis = 0; //camera
else
m_iTranslationAxis = 1; //world
if (m_p_oCamera->IsInPrivilegeMode())
{
m_iRotationAxis = 0;
m_iTranslationAxis = 0;
m_bPrivilegeMode = TRUE;
GetDlgItem(IDC_RB_ROTAXISCAMERA)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_ROTAXISWORLD)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSAXISCAMERA)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSAXISWORLD)->EnableWindow(FALSE);
}
else
m_bPrivilegeMode = FALSE;
// update drawing
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnKillfocusEditTransvalue()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csTranslationValue;
// get the new text value
UpdateData(TRUE);
// update radio buttons
if (UpdateTransRadioButtons() == FALSE)
{
// value is not good, put back the old one
m_csTranslationValue = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_TRANSVALUE)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnSetfocusEditTransvalue()
{
m_lIDofCurrentEdit = IDC_EDIT_TRANSVALUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnKillfocusEditRotvalue()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csRotationValue;
// get the new text value
UpdateData(TRUE);
// update radio buttons
if (UpdateRotRadioButtons() == FALSE)
{
// value is not good, put back the old one
m_csRotationValue = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_ROTVALUE)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnSetfocusEditRotvalue()
{
m_lIDofCurrentEdit = IDC_EDIT_ROTVALUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnRbTranslationStep()
{
// get the new button value
UpdateData(TRUE);
// update the control value
UpdateTransText();
// update drawing of dialog
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnRbRotationStep()
{
// get the new button value
UpdateData(TRUE);
// update the control value
UpdateRotText();
// update drawing of dialog
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update translation value text control according to selected radio button
void PageGeneral::UpdateTransText()
{
switch(m_iTranslationStep)
{
case 0:
m_csTranslationValue.Format("%.3f",0.1);
break;
case 1:
m_csTranslationValue.Format("%.3f",1.0);
break;
case 2:
m_csTranslationValue.Format("%.3f",10.0);
break;
case 3:
m_csTranslationValue.Format("%.3f",100.0);
break;
default:
m_csTranslationValue = "";
break;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update rotation value text control according to selected radio button
void PageGeneral::UpdateRotText()
{
switch(m_iRotationStep)
{
case 0:
m_csRotationValue.Format("%.3f",180.0/4.0);
break;
case 1:
m_csRotationValue.Format("%.3f",180.0/8.0);
break;
case 2:
m_csRotationValue.Format("%.3f",180.0/16.0);
break;
case 3:
m_csRotationValue.Format("%.3f",180.0/32.0);
break;
default:
m_csRotationValue = "";
break;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update rotation radio buttons according to parameter.
BOOL PageGeneral::UpdateRotRadioButtons(float fRotValue)
{
if (fRotValue != -1)
{
// a value was given, take it
if (fRotValue <= 0) return FALSE;
m_csRotationValue.Format("%.3f",fRotValue);
}
else
{
// no initial value given, take the current one
fRotValue = (float) atof(m_csRotationValue);
if (fRotValue <= 0) return FALSE;
}
if (fabs(fRotValue - 45) < 1e-5)
m_iRotationStep = 0;
else if (fabs(fRotValue - 22.5) < 1e-5)
m_iRotationStep = 1;
else if (fabs(fRotValue - 11.25) < 1e-5)
m_iRotationStep = 2;
else if (fabs(fRotValue - 5.625) < 1e-5)
m_iRotationStep = 3;
else
m_iRotationStep = -1;
return TRUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update translation radio buttons according to parameter.
BOOL PageGeneral::UpdateTransRadioButtons(float fTransValue)
{
if (fTransValue != -1)
{
// a value was given, take it
if (fTransValue <= 0) return FALSE;
m_csTranslationValue.Format("%.3f",fTransValue);
}
else
{
// no initial value given, take the current one
fTransValue = (float) atof(m_csTranslationValue);
if (fTransValue <= 0) return FALSE;
}
if (fabs(fTransValue - 10) < 1e-5)
m_iTranslationStep = 2;
else if (fabs(fTransValue - 0.1) < 1e-5)
m_iTranslationStep = 0;
else if (fabs(fTransValue - 1.0) < 1e-5)
m_iTranslationStep = 1;
else if (fabs(fTransValue - 100) < 1e-5)
m_iTranslationStep = 3;
else
m_iTranslationStep = -1;
return TRUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::MakeChangesAvailable()
{
UpdateData(TRUE);
m_eRotationAxis = (m_iRotationAxis == 0) ? CameraCoordinates : WorldCoordinates;
m_eTranslationAxis = (m_iTranslationAxis == 0) ? CameraCoordinates : WorldCoordinates;
m_fRotValue = (float) (atof(m_csRotationValue) * C_PI / 180.0);
m_fTransValue = (float) atof(m_csTranslationValue);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageGeneral::IsPageValid()
{
// check translation value
if (((float) atof(m_csTranslationValue)) <= 0)
return FALSE;
// check rotation value
if (((float) atof(m_csRotationValue)) <= 0)
return FALSE;
// check both radiobuttons
if (m_iTranslationAxis == -1)
return FALSE;
if (m_iRotationAxis == -1)
return FALSE;
return TRUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::DoUpdate()
{
m_p_oCamera->SetRotationAxisSystem(m_eRotationAxis);
m_p_oCamera->SetTranslationAxisSystem(m_eTranslationAxis);
M_GetDLL(m_p_oCamera)->SetRotationStep(m_fRotValue);
M_GetDLL(m_p_oCamera)->SetTranslationStep(m_fTransValue);
m_p_oCamera->SetPrivilegeMode(m_bPrivilegeMode);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnBtReturn()
{
// if an edit had the focus, put the focus on the hidden button
// to be sure to call the killfocus function for the dialog
if (m_lIDofCurrentEdit != NULL)
{
GetDlgItem(IDC_BT_RETURN)->SetFocus();
return;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageGeneral::OnChkPrivilegemode()
{
UpdateData(TRUE);
if (m_bPrivilegeMode)
{
m_iRotationAxis = 0;
m_iTranslationAxis = 0;
GetDlgItem(IDC_RB_ROTAXISCAMERA)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_ROTAXISWORLD)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSAXISCAMERA)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSAXISWORLD)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_RB_ROTAXISCAMERA)->EnableWindow(TRUE);
GetDlgItem(IDC_RB_ROTAXISWORLD)->EnableWindow(TRUE);
GetDlgItem(IDC_RB_TRANSAXISCAMERA)->EnableWindow(TRUE);
GetDlgItem(IDC_RB_TRANSAXISWORLD)->EnableWindow(TRUE);
}
UpdateData(FALSE);
}

View File

@@ -0,0 +1,668 @@
// pagerotcenter.cpp : implementation file
//
#include "stdafx.h"
#include "acp_base.h"
#include "camresrc.h"
#include "pagerotcenter.hpp"
#include "caminter.hpp"
#include "camera.hpp"
#define M_GetDLL(Camera) ((Camera_Interface*)((Camera)->GetEditor()))
/////////////////////////////////////////////////////////////////////////////
// PageRotationCenter property page
//IMPLEMENT_DYNCREATE(PageRotationCenter, CDialog)
PageRotationCenter::PageRotationCenter(Camera *p_oCamera)
: PageBase(PageRotationCenter::IDD)
{
//{{AFX_DATA_INIT(PageRotationCenter)
m_csPointX = _T("");
m_csPointY = _T("");
m_csPointZ = _T("");
m_csSuperObjectX = _T("");
m_csSuperObjectY = _T("");
m_csSuperObjectZ = _T("");
m_iRotationCenterType = -1;
m_iPointCoords = -1;
m_csComboEdit = _T("");
m_bPointRelative = FALSE;
//}}AFX_DATA_INIT
m_p_oCamera = p_oCamera;
m_lIDofCurrentEdit = NULL;
}
PageRotationCenter::~PageRotationCenter()
{
}
void PageRotationCenter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(PageRotationCenter)
DDX_Control(pDX, IDC_COMBO_SUPEROBJECT, m_oComboSO);
DDX_Text(pDX, IDC_EDIT_POINTX, m_csPointX);
DDX_Text(pDX, IDC_EDIT_POINTY, m_csPointY);
DDX_Text(pDX, IDC_EDIT_POINTZ, m_csPointZ);
DDX_Text(pDX, IDC_EDIT_SOX, m_csSuperObjectX);
DDX_Text(pDX, IDC_EDIT_SOY, m_csSuperObjectY);
DDX_Text(pDX, IDC_EDIT_SOZ, m_csSuperObjectZ);
DDX_Radio(pDX, IDC_RB_ROTPOINT, m_iRotationCenterType);
DDX_Radio(pDX, IDC_RB_WORLDCOORDS, m_iPointCoords);
DDX_CBString(pDX, IDC_COMBO_SUPEROBJECT, m_csComboEdit);
DDX_Check(pDX, IDC_CHK_RELATIVE, m_bPointRelative);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(PageRotationCenter, CDialog)
//{{AFX_MSG_MAP(PageRotationCenter)
ON_BN_CLICKED(IDC_BT_COPYTOPOINT, OnBtCopytopoint)
ON_BN_CLICKED(IDC_BT_RETURN, OnBtReturn)
ON_EN_KILLFOCUS(IDC_EDIT_POINTX, OnKillfocusEditPointx)
ON_EN_SETFOCUS(IDC_EDIT_POINTX, OnSetfocusEditPointx)
ON_EN_KILLFOCUS(IDC_EDIT_POINTY, OnKillfocusEditPointy)
ON_EN_SETFOCUS(IDC_EDIT_POINTY, OnSetfocusEditPointy)
ON_EN_KILLFOCUS(IDC_EDIT_POINTZ, OnKillfocusEditPointz)
ON_EN_SETFOCUS(IDC_EDIT_POINTZ, OnSetfocusEditPointz)
ON_BN_CLICKED(IDC_RB_CAMERACOORDS, OnRbPointCoords)
ON_CBN_SELCHANGE(IDC_COMBO_SUPEROBJECT, OnSelChangeComboSO)
ON_CBN_EDITCHANGE(IDC_COMBO_SUPEROBJECT, OnEditChangeComboSO)
ON_CBN_SETFOCUS(IDC_COMBO_SUPEROBJECT, OnSetfocusComboso)
ON_CBN_KILLFOCUS(IDC_COMBO_SUPEROBJECT, OnKillfocusComboso)
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_RB_WORLDCOORDS, OnRbPointCoords)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// PageRotationCenter message handlers
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageRotationCenter::OnInitDialog()
{
MTH3D_tdstVector stPoint;
CPA_List<CPA_SuperObject> *p_oListOfSO;
POSITION stPos;
CPA_SuperObject *p_oSO;
long lIndex;
tdeCoordsType eType;
CDialog::OnInitDialog();
// update the current Rotation Center type member
switch (m_p_oCamera->GetRotationCenterType())
{
case rTarget :
m_iRotationCenterType = 2;
break;
case rPoint :
m_iRotationCenterType = 0;
break;
case rSuperObject :
m_iRotationCenterType = 1;
break;
default:
m_iRotationCenterType = -1;
break;
}
// init the point coordinates
m_p_oCamera->GetRotationCenterPoint(stPoint,eType);
m_csPointX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csPointY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csPointZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
// init the point coordinates type according to type of point
switch(eType)
{
case Absolute :
m_iPointCoords = 0;
m_bPointRelative = FALSE;
break;
case Relative :
m_iPointCoords = 1;
m_bPointRelative = TRUE;
break;
default:
ASSERT(0);
break;
}
// add the 'none' entry to the combo
lIndex = m_oComboSO.AddString("none");
m_oComboSO.SetItemData(lIndex,NULL);
// init the SuperObject combobox entries
// get the list of available superobjects for this world
p_oListOfSO = (M_GetDLL(m_p_oCamera))->M_GetListAllObjects();
stPos = p_oListOfSO->GetHeadPosition();
while(stPos)
{
p_oSO = p_oListOfSO->GetNext(stPos);
if (p_oSO->GetObject() != m_p_oCamera && p_oSO->GetObject() != NULL)
{
lIndex = m_oComboSO.AddString(p_oSO->GetObject()->GetName());
m_oComboSO.SetItemData(lIndex,(DWORD)p_oSO);
}
}
// select the current target in the combo
p_oSO = m_p_oCamera->GetRotationCenterSuperObject();
if (p_oSO == NULL)
{
m_oComboSO.SelectString(-1,"none");
m_csComboEdit = "none";
}
else if (m_oComboSO.SelectString(-1,p_oSO->GetObject()->GetName()) != CB_ERR)
m_csComboEdit = p_oSO->GetObject()->GetName();
else
{
m_oComboSO.SetCurSel(-1);
m_csComboEdit = "";
}
// update the SO coordinates
if (m_oComboSO.GetCurSel() != -1 && p_oSO != NULL)
{
GEO_tdxHandleToMatrix hMatrix;
hMatrix = HIE_fn_hGetSuperObjectMatrix(p_oSO->GetStruct());
POS_fn_vGetTranslationVector(hMatrix,&stPoint);
m_csSuperObjectX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csSuperObjectY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csSuperObjectZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
}
else
{
m_csSuperObjectX = "---";
m_csSuperObjectY = "---";
m_csSuperObjectZ = "---";
GetDlgItem(IDC_RB_ROTSO)->EnableWindow(FALSE);
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(FALSE);
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnBtCopytopoint()
{
UpdateData(TRUE);
m_iPointCoords = 0;
m_csPointX = m_csSuperObjectX;
m_csPointY = m_csSuperObjectY;
m_csPointZ = m_csSuperObjectZ;
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnBtReturn()
{
// if an edit had the focus, put the focus on the hidden button
// to be sure to call the killfocus function for the dialog
if (m_lIDofCurrentEdit != NULL)
{
GetDlgItem(IDC_BT_RETURN)->SetFocus();
return;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnKillfocusEditPointx()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointX;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointX) == 0.0) && (m_csPointX[0] != '0') )
{
// value is not good, put back the old one
m_csPointX = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTX)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnSetfocusEditPointx()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTX;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnKillfocusEditPointy()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointY;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointY) == 0.0) && (m_csPointY[0] != '0') )
{
// value is not good, put back the old one
m_csPointY = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTY)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnSetfocusEditPointy()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTY;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnKillfocusEditPointz()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointZ;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointZ) == 0.0) && (m_csPointZ[0] != '0') )
{
// value is not good, put back the old one
m_csPointZ = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTZ)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnSetfocusEditPointz()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTZ;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnRbPointCoords()
{
long lLastValue;
MTH3D_tdstVector stPoint;
float fX,fY,fZ;
// get last value
lLastValue = m_iPointCoords;
// get new values
UpdateData(TRUE);
if (m_iPointCoords == lLastValue)
return;
// coords type changed -> translate
fX = (float) atof(m_csPointX);
fY = (float) atof(m_csPointY);
fZ = (float) atof(m_csPointZ);
MTH3D_M_vSetVectorElements(&stPoint,fX,fY,fZ);
if (m_iPointCoords == 0)
m_p_oCamera->CameraToWorldCoordinates_Point(stPoint);
else
m_p_oCamera->WorldToCameraCoordinates_Point(stPoint);
MTH3D_M_vGetVectorElements(&fX,&fY,&fZ,&stPoint);
m_csPointX.Format("%.3f",fX);
m_csPointY.Format("%.3f",fY);
m_csPointZ.Format("%.3f",fZ);
UpdateData(FALSE);
// TODO: Add your control notification handler code here
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnSelChangeComboSO()
{
long lIndex;
CPA_SuperObject *p_oSO;
UpdateData(TRUE);
// get the new selected element;
lIndex = m_oComboSO.GetCurSel();
if (lIndex != -1)
{
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
m_csComboEdit = p_oSO->GetObject()->GetName();
}
else
{
m_csComboEdit = "";
}
CheckComboSO();
CheckRotationCenterType();
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnEditChangeComboSO()
{
long lIndex,lIndex2;
lIndex = CB_ERR;
lIndex2 = CB_ERR;
// get the current combo text
// UpdateData(TRUE);
// look for the index of the string
/* lIndex = m_oComboSO.FindString(-1,(char*)(LPCTSTR)m_csComboEdit);
// look if there are more than one match
if (lIndex != CB_ERR)
{
lIndex2 = m_oComboSO.FindString(lIndex,(char*)(LPCTSTR)m_csComboEdit);
// open the combo droplist
if (m_oComboSO.GetDroppedState() == FALSE)
{
// drop down, put back the original text, and put entry point at the end
m_oComboSO.ShowDropDown(TRUE);
m_oComboSO.SetWindowText(m_csComboEdit);
m_oComboSO.SetEditSel(m_csComboEdit.GetLength(),m_csComboEdit.GetLength());
}
// if there's only one match, select it
if (lIndex2 == CB_ERR || lIndex2 == lIndex)
m_oComboSO.SetCurSel(lIndex);
else // else, just show the selected string
m_oComboSO.SetTopIndex(lIndex);
}
*/}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnSetfocusComboso()
{
m_lIDofCurrentEdit = IDC_COMBOSO;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnKillfocusComboso()
{
UpdateData(TRUE);
CheckComboSO();
CheckRotationCenterType();
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::MakeChangesAvailable()
{
float fX,fY,fZ;
long lIndex;
UpdateData(TRUE);
// RotationCenter Point coords
fX = (float) atof(m_csPointX);
fY = (float) atof(m_csPointY);
fZ = (float) atof(m_csPointZ);
m_oRotationCenterPoint.SetXYZ(fX,fY,fZ);
switch(m_iPointCoords)
{
case 0: // world coordinates
m_oRotationCenterPoint.SetAxisSystem(WorldCoordinates);
break;
case 1: // camera coordinates
m_oRotationCenterPoint.SetAxisSystem(CameraCoordinates);
break;
default:
ASSERT(0);
break;
}
// Rotation Center SuperObject
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1)
m_p_oRotationCenterSuperObject = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
else
m_p_oRotationCenterSuperObject = NULL;
// RotationCenter Type
switch(m_iRotationCenterType)
{
case 2:
m_eRotationCenterType = rTarget;
break;
case 0:
m_eRotationCenterType = rPoint;
break;
case 1:
m_eRotationCenterType = rSuperObject;
break;
default:
ASSERT(0);
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageRotationCenter::IsPageValid()
{
BOOL bResult;
bResult = TRUE;
UpdateData(TRUE);
bResult = CheckComboSO();
bResult &= CheckRotationCenterType();
UpdateData(FALSE);
return bResult;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::DoUpdate()
{
m_p_oCamera->SetRotationCenterType(rTarget);
m_p_oCamera->SetRotationCenterSuperObject(m_p_oRotationCenterSuperObject);
if (m_bPointRelative)
m_p_oCamera->SetRotationCenterPoint(&m_oRotationCenterPoint,Relative);
else
m_p_oCamera->SetRotationCenterPoint(&m_oRotationCenterPoint,Absolute);
m_p_oCamera->SetRotationCenterType(m_eRotationCenterType);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageRotationCenter::OnLButtonDown(UINT nFlags, CPoint point)
{
// if an edit had the focus, put the focus on the hidden button
// to be sure to call the killfocus function for the dialog
if (m_lIDofCurrentEdit != NULL)
{
GetDlgItem(IDC_BT_RETURN)->SetFocus();
return;
}
else
{
CDialog::OnLButtonDown(nFlags, point);
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// check if combo SO is valid. If not, set to "none" and return FALSE
BOOL PageRotationCenter::CheckComboSO()
{
long lIndex;
CPA_SuperObject *p_oSO;
BOOL bResult;
p_oSO = NULL;
// get the new selected element;
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1)
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
// check if the superobject is good
if (p_oSO == NULL)
{
// not good!
// disable copy to point
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(FALSE);
// erase coords
m_csSuperObjectX = "---";
m_csSuperObjectY = "---";
m_csSuperObjectZ = "---";
// set name to none
m_csComboEdit = "none";
// if target was not valid, result = FALSE
bResult = (lIndex != -1);
}
else
{
GEO_tdxHandleToMatrix hMatrix;
MTH3D_tdstVector stPoint;
//enable target SO and copy to point
GetDlgItem(IDC_RB_ROTSO)->EnableWindow(TRUE);
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(TRUE);
// update coords
hMatrix = HIE_fn_hGetSuperObjectMatrix(p_oSO->GetStruct());
POS_fn_vGetTranslationVector(hMatrix,&stPoint);
m_csSuperObjectX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csSuperObjectY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csSuperObjectZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
// set new name in combo
m_csComboEdit = p_oSO->GetObject()->GetName();
bResult = TRUE;
}
return bResult;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// check if RotationCenter type is valid. if not, set to valid and return FALSE
BOOL PageRotationCenter::CheckRotationCenterType()
{
long lIndex;
CPA_SuperObject *p_oSO;
BOOL bResult;
bResult = TRUE;
// find the combo selection
p_oSO = NULL;
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1) // selection valid
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
// check target type
switch(m_iRotationCenterType)
{
case 2: // rTarget --> ok
case 0: // rPoint --> ok
bResult = TRUE;
break;
case 1: // rSuperObject
// if SO not valid, set target type to rTarget and return FALSE
if (p_oSO == NULL)
{
m_iRotationCenterType = 2;
bResult = FALSE;
}
break;
default:
ASSERT(0);
}
// if rotation center SO not valid, disable "rotation center is SO", else, enable
if (p_oSO == NULL)
GetDlgItem(IDC_RB_ROTSO)->EnableWindow(FALSE);
else
GetDlgItem(IDC_RB_ROTSO)->EnableWindow(TRUE);
return bResult;
}

View File

@@ -0,0 +1,647 @@
// pagetarget.cpp : implementation file
//
#include "stdafx.h"
#include "acp_base.h"
#include "camresrc.h"
#include "pagetarget.hpp"
#include "caminter.hpp"
#include "camera.hpp"
#define M_GetDLL(Camera) ((Camera_Interface*)((Camera)->GetEditor()))
/////////////////////////////////////////////////////////////////////////////
// PageTarget property page
//IMPLEMENT_DYNCREATE(PageTarget, CDialog)
PageTarget::PageTarget(Camera *p_oCamera)
: PageBase(PageTarget::IDD)
{
//{{AFX_DATA_INIT(PageTarget)
m_csPointX = _T("");
m_csPointY = _T("");
m_csPointZ = _T("");
m_csSuperObjectX = _T("");
m_csSuperObjectY = _T("");
m_csSuperObjectZ = _T("");
m_iTargetType = -1;
m_iPointCoords = -1;
m_csComboEdit = _T("");
//}}AFX_DATA_INIT
m_p_oCamera = p_oCamera;
m_lIDofCurrentEdit = NULL;
}
PageTarget::~PageTarget()
{
}
void PageTarget::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(PageTarget)
DDX_Control(pDX, IDC_COMBOSO, m_oComboSO);
DDX_Text(pDX, IDC_EDIT_POINTX, m_csPointX);
DDX_Text(pDX, IDC_EDIT_POINTY, m_csPointY);
DDX_Text(pDX, IDC_EDIT_POINTZ, m_csPointZ);
DDX_Text(pDX, IDC_EDIT_SOX, m_csSuperObjectX);
DDX_Text(pDX, IDC_EDIT_SOY, m_csSuperObjectY);
DDX_Text(pDX, IDC_EDIT_SOZ, m_csSuperObjectZ);
DDX_Radio(pDX, IDC_RB_TARGPOINT, m_iTargetType);
DDX_Radio(pDX, IDC_RB_WORLDCOORDS, m_iPointCoords);
DDX_CBString(pDX, IDC_COMBOSO, m_csComboEdit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(PageTarget, CDialog)
//{{AFX_MSG_MAP(PageTarget)
ON_BN_CLICKED(IDC_BT_COPYTOPOINT, OnBtCopytopoint)
ON_BN_CLICKED(IDC_BT_RETURN, OnBtReturn)
ON_EN_KILLFOCUS(IDC_EDIT_POINTX, OnKillfocusEditPointx)
ON_EN_SETFOCUS(IDC_EDIT_POINTX, OnSetfocusEditPointx)
ON_EN_KILLFOCUS(IDC_EDIT_POINTY, OnKillfocusEditPointy)
ON_EN_SETFOCUS(IDC_EDIT_POINTY, OnSetfocusEditPointy)
ON_EN_KILLFOCUS(IDC_EDIT_POINTZ, OnKillfocusEditPointz)
ON_EN_SETFOCUS(IDC_EDIT_POINTZ, OnSetfocusEditPointz)
ON_BN_CLICKED(IDC_RB_CAMERACOORDS, OnRbPointCoords)
ON_CBN_SELCHANGE(IDC_COMBOSO, OnSelChangeComboSO)
ON_CBN_EDITCHANGE(IDC_COMBOSO, OnEditChangeComboSO)
ON_CBN_SETFOCUS(IDC_COMBOSO, OnSetfocusComboso)
ON_CBN_KILLFOCUS(IDC_COMBOSO, OnKillfocusComboso)
ON_BN_CLICKED(IDC_RB_WORLDCOORDS, OnRbPointCoords)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageTarget::OnInitDialog()
{
MTH3D_tdstVector stPoint;
CPA_List<CPA_SuperObject> *p_oListOfSO;
POSITION stPos;
CPA_SuperObject *p_oSO;
long lIndex;
CDialog::OnInitDialog();
// update the current target type member
switch (m_p_oCamera->GetTargetType())
{
case tNone :
m_iTargetType = 2;
break;
case tSuperObject :
m_iTargetType = 1;
break;
case tPoint :
m_iTargetType = 0;
break;
default:
m_iTargetType = -1;
break;
}
// init the point coordinates to world coordinates
m_iPointCoords = 0;
// init the point coordinates
m_p_oCamera->GetTargetPoint(stPoint);
m_csPointX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csPointY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csPointZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
// add the 'none' entry to the combo
lIndex = m_oComboSO.AddString("none");
m_oComboSO.SetItemData(lIndex,NULL);
// init the SuperObject combobox entries
// get the list of available superobjects for this world
p_oListOfSO = (M_GetDLL(m_p_oCamera))->M_GetListAllObjects();
stPos = p_oListOfSO->GetHeadPosition();
while(stPos)
{
p_oSO = p_oListOfSO->GetNext(stPos);
if (p_oSO->GetObject() != m_p_oCamera && p_oSO->GetObject() != NULL)
{
lIndex = m_oComboSO.AddString(p_oSO->GetObject()->GetName());
m_oComboSO.SetItemData(lIndex,(DWORD)p_oSO);
}
}
// select the current target in the combo
p_oSO = m_p_oCamera->GetTargetSuperObject();
if (p_oSO == NULL)
{
m_oComboSO.SelectString(-1,"none");
m_csComboEdit = "none";
}
else if (m_oComboSO.SelectString(-1,p_oSO->GetObject()->GetName()) != CB_ERR)
m_csComboEdit = p_oSO->GetObject()->GetName();
else
{
m_oComboSO.SetCurSel(-1);
m_csComboEdit = "";
}
// update the SO coordinates
if (m_oComboSO.GetCurSel() != -1 && p_oSO != NULL)
{
GEO_tdxHandleToMatrix hMatrix;
hMatrix = HIE_fn_hGetSuperObjectMatrix(p_oSO->GetStruct());
POS_fn_vGetTranslationVector(hMatrix,&stPoint);
m_csSuperObjectX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csSuperObjectY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csSuperObjectZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
}
else
{
m_csSuperObjectX = "---";
m_csSuperObjectY = "---";
m_csSuperObjectZ = "---";
GetDlgItem(IDC_RB_TARGSO)->EnableWindow(FALSE);
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(FALSE);
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/////////////////////////////////////////////////////////////////////////////
// PageTarget message handlers
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnBtCopytopoint()
{
UpdateData(TRUE);
m_iPointCoords = 0;
m_csPointX = m_csSuperObjectX;
m_csPointY = m_csSuperObjectY;
m_csPointZ = m_csSuperObjectZ;
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnBtReturn()
{
// if an edit had the focus, put the focus on the hidden button
// to be sure to call the killfocus function for the dialog
if (m_lIDofCurrentEdit != NULL)
{
GetDlgItem(IDC_BT_RETURN)->SetFocus();
return;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnKillfocusEditPointx()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointX;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointX) == 0.0) && (m_csPointX[0] != '0') )
{
// value is not good, put back the old one
m_csPointX = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTX)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnSetfocusEditPointx()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTX;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnKillfocusEditPointy()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointY;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointY) == 0.0) && (m_csPointY[0] != '0') )
{
// value is not good, put back the old one
m_csPointY = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTY)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnSetfocusEditPointy()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTY;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnKillfocusEditPointz()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csPointZ;
// get the new text value
UpdateData(TRUE);
// check validity of text
if ( ((float) atof(m_csPointZ) == 0.0) && (m_csPointZ[0] != '0') )
{
// value is not good, put back the old one
m_csPointZ = csOldValue;
UpdateData(FALSE);
// and give back the focus to the window
GetDlgItem(IDC_EDIT_POINTZ)->SetFocus();
}
else
{
// update drawing
UpdateData(FALSE);
m_lIDofCurrentEdit = NULL;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnSetfocusEditPointz()
{
m_lIDofCurrentEdit = IDC_EDIT_POINTZ;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnRbPointCoords()
{
long lLastValue;
MTH3D_tdstVector stPoint;
float fX,fY,fZ;
// get last value
lLastValue = m_iPointCoords;
// get new values
UpdateData(TRUE);
if (m_iPointCoords == lLastValue)
return;
// coords type changed -> translate
fX = (float) atof(m_csPointX);
fY = (float) atof(m_csPointY);
fZ = (float) atof(m_csPointZ);
MTH3D_M_vSetVectorElements(&stPoint,fX,fY,fZ);
if (m_iPointCoords == 0)
m_p_oCamera->CameraToWorldCoordinates_Point(stPoint);
else
m_p_oCamera->WorldToCameraCoordinates_Point(stPoint);
MTH3D_M_vGetVectorElements(&fX,&fY,&fZ,&stPoint);
m_csPointX.Format("%.3f",fX);
m_csPointY.Format("%.3f",fY);
m_csPointZ.Format("%.3f",fZ);
UpdateData(FALSE);
// TODO: Add your control notification handler code here
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnSelChangeComboSO()
{
long lIndex;
CPA_SuperObject *p_oSO;
UpdateData(TRUE);
// get the new selected element;
lIndex = m_oComboSO.GetCurSel();
if (lIndex != -1)
{
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
m_csComboEdit = p_oSO->GetObject()->GetName();
}
else
{
m_csComboEdit = "";
}
CheckComboSO();
CheckTargetType();
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnEditChangeComboSO()
{
long lIndex,lIndex2;
lIndex = CB_ERR;
lIndex2 = CB_ERR;
// get the current combo text
// UpdateData(TRUE);
// look for the index of the string
/* lIndex = m_oComboSO.FindString(-1,(char*)(LPCTSTR)m_csComboEdit);
// look if there are more than one match
if (lIndex != CB_ERR)
{
lIndex2 = m_oComboSO.FindString(lIndex,(char*)(LPCTSTR)m_csComboEdit);
// open the combo droplist
if (m_oComboSO.GetDroppedState() == FALSE)
{
// drop down, put back the original text, and put entry point at the end
m_oComboSO.ShowDropDown(TRUE);
m_oComboSO.SetWindowText(m_csComboEdit);
m_oComboSO.SetEditSel(m_csComboEdit.GetLength(),m_csComboEdit.GetLength());
}
// if there's only one match, select it
if (lIndex2 == CB_ERR || lIndex2 == lIndex)
m_oComboSO.SetCurSel(lIndex);
else // else, just show the selected string
m_oComboSO.SetTopIndex(lIndex);
}
*/}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnSetfocusComboso()
{
m_lIDofCurrentEdit = IDC_COMBOSO;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnKillfocusComboso()
{
UpdateData(TRUE);
CheckComboSO();
CheckTargetType();
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::MakeChangesAvailable()
{
float fX,fY,fZ;
long lIndex;
UpdateData(TRUE);
// Target Point coords
fX = (float) atof(m_csPointX);
fY = (float) atof(m_csPointY);
fZ = (float) atof(m_csPointZ);
m_oTargetPoint.SetXYZ(fX,fY,fZ);
if (m_iPointCoords == 1) // camera coordinates
m_oTargetPoint.SetAxisSystem(CameraCoordinates);
else
m_oTargetPoint.SetAxisSystem(WorldCoordinates);
// Target SuperObject
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1)
m_p_oTargetSuperObject = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
else
m_p_oTargetSuperObject = NULL;
// Target Type
switch(m_iTargetType)
{
case 2:
m_eTargetType = tNone;
break;
case 1:
m_eTargetType = tSuperObject;
break;
case 0:
m_eTargetType = tPoint;
break;
default:
ASSERT(0);
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL PageTarget::IsPageValid()
{
BOOL bResult;
bResult = TRUE;
UpdateData(TRUE);
bResult = CheckComboSO();
bResult &= CheckTargetType();
UpdateData(FALSE);
return bResult;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::DoUpdate()
{
m_p_oCamera->SetTargetType(tNone);
m_p_oCamera->SetTargetSuperObject(m_p_oTargetSuperObject);
m_p_oCamera->SetTargetPoint(&m_oTargetPoint);
m_p_oCamera->SetTargetType(m_eTargetType);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void PageTarget::OnLButtonDown(UINT nFlags, CPoint point)
{
// if an edit had the focus, put the focus on the hidden button
// to be sure to call the killfocus function for the dialog
if (m_lIDofCurrentEdit != NULL)
{
GetDlgItem(IDC_BT_RETURN)->SetFocus();
return;
}
else
{
CDialog::OnLButtonDown(nFlags, point);
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// check if combo SO is valid. If not, set to "none" and return FALSE
BOOL PageTarget::CheckComboSO()
{
long lIndex;
CPA_SuperObject *p_oSO;
BOOL bResult;
p_oSO = NULL;
// get the new selected element;
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1)
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
// check if the superobject is good
if (p_oSO == NULL)
{
// not good!
// disable copy to point
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(FALSE);
// erase coords
m_csSuperObjectX = "---";
m_csSuperObjectY = "---";
m_csSuperObjectZ = "---";
// set name to none
m_csComboEdit = "none";
// if target was not valid, result = FALSE
bResult = (lIndex != -1);
}
else
{
GEO_tdxHandleToMatrix hMatrix;
MTH3D_tdstVector stPoint;
//enable target SO and copy to point
GetDlgItem(IDC_RB_TARGSO)->EnableWindow(TRUE);
GetDlgItem(IDC_BT_COPYTOPOINT)->EnableWindow(TRUE);
// update coords
hMatrix = HIE_fn_hGetSuperObjectMatrix(p_oSO->GetStruct());
POS_fn_vGetTranslationVector(hMatrix,&stPoint);
m_csSuperObjectX.Format("%.3f",MTH3D_M_xGetXofVector(&stPoint));
m_csSuperObjectY.Format("%.3f",MTH3D_M_xGetYofVector(&stPoint));
m_csSuperObjectZ.Format("%.3f",MTH3D_M_xGetZofVector(&stPoint));
// set new name in combo
m_csComboEdit = p_oSO->GetObject()->GetName();
bResult = TRUE;
}
return bResult;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// check if target type is valid. if not, set to not valid and return FALSE
BOOL PageTarget::CheckTargetType()
{
long lIndex;
CPA_SuperObject *p_oSO;
BOOL bResult;
bResult = TRUE;
// find the combo selection
p_oSO = NULL;
lIndex = m_oComboSO.FindStringExact(-1,(char*)(LPCTSTR)m_csComboEdit);
if (lIndex != -1) // selection valid
p_oSO = (CPA_SuperObject*) m_oComboSO.GetItemData(lIndex);
// check target type
switch(m_iTargetType)
{
case 2: // tNone --> ok
case 0: // tPoint --> ok
bResult = TRUE;
break;
case 1: // tSuperObject
// if SO not valid, set target type to tNone and return FALSE
if (p_oSO == NULL)
{
m_iTargetType = 2;
bResult = FALSE;
}
break;
default:
ASSERT(0);
}
// if target SO not valid, disable Target SO, else, enable
if (p_oSO == NULL)
GetDlgItem(IDC_RB_TARGSO)->EnableWindow(FALSE);
else
GetDlgItem(IDC_RB_TARGSO)->EnableWindow(TRUE);
return bResult;
}

View File

@@ -0,0 +1,358 @@
#include <direct.h>
#include "stdafx.h"
#include "acp_base.h"
#include "geo.h"
#include "gli.h"
#include "ITF.h"
#include "caminter.hpp"
// popupmenu constants
enum { C_PopUpTarget = 0, C_PopUpCenter, C_PopUpNoTarget, C_ZoomTarget,C_ZoomNotTargetedTarget, C_PopUpEasyPointTarget};
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Camera_Interface::fn_bDefinePopupMenu(EDT_PopUpMenu *p_oPopup, CPA_List<CPA_SuperObject> *p_oSelection, BOOL bIsAlone)
{
DEV_ViewPort3D *p_oViewPort;
Camera *p_oCamera;
BOOL bResult;
CPA_BaseObject *p_oObject;
EDT_SubMenu *p_oSubMenu;
if (bIsAlone)
return FALSE;
// this part is executed only if we are NOT the current editor
bResult = FALSE;
// get the camera
p_oViewPort = (DEV_ViewPort3D*)(M_GetMultiDevice3D()->GetFocusDevice()->GetViewPort());
p_oCamera = (Camera*) p_oViewPort->GetCamera();
p_oSubMenu = p_oPopup->fn_p_oGetNewSubMenu("Camera");
if (GetInterface()->GetCurrentWorld()->GetCountSelected() == 1)
{
CPA_SuperObject *p_oSelection;
CString csText;
// get the selection
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
switch (p_oCamera->GetTargetType())
{
case tNone:
p_oObject = p_oSelection->GetObject();
if (p_oObject != NULL)
{
// entry select new target
csText = "Target " + p_oObject->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_PopUpTarget);
// entry center on object
csText = "Center on " + p_oObject->GetName();
//CPA2 Corneliu Babiuc 21-05-98
csText += "\t" + m_p_oKeyConfiguration->mfn_oConvertIniStringToKeyString((const CString*)&CString("Center Camera on Object"));
//END CPA2 Coreliu Babiuc 21-05-98
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText, C_PopUpCenter);
// entry zoom on object
// get the object
csText = "Zoom on " + p_oObject->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_ZoomNotTargetedTarget);
bResult = TRUE;
}
break;
case tSuperObject:
// if the current target is different from the selected object
if (p_oSelection != p_oCamera->GetTargetSuperObject())
{
csText = "Set New Target to " + p_oSelection->GetObject()->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_PopUpTarget);
bResult = TRUE;
}
else // current target == selected object
{
// get the object
p_oObject = p_oCamera->GetTargetSuperObject()->GetObject();
if (p_oObject != NULL)
{
csText = "Zoom on " + p_oObject->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_ZoomTarget);
bResult = TRUE;
}
}
break;
case tPoint:
csText = "Set New Target to " + p_oSelection->GetObject()->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_PopUpTarget);
bResult = TRUE;
break;
}
}
else
{
// no object or more than one object selected.
// if camera is targeted, then add ZOOM entry if valid
if (p_oCamera->GetTargetType() == tSuperObject)
{
// get the object
p_oObject = p_oCamera->GetTargetSuperObject()->GetObject();
if (p_oObject != NULL)
{
CString csText = "Zoom on " + p_oObject->GetName();
p_oSubMenu->AddAnEntry(this,(char*)(LPCTSTR)csText,C_ZoomTarget);
bResult = TRUE;
}
}
}
if (p_oCamera->GetTargetType() != tNone)
{
p_oSubMenu->AddAnEntry(this,"Not Targeted",C_PopUpNoTarget);
bResult = TRUE;
}
p_oSubMenu->AddAnEntry(this, "Easy point target", C_PopUpEasyPointTarget);
bResult = TRUE;
if (bResult)
p_oPopup->AddASubMenu(p_oSubMenu);
return bResult;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Camera_Interface::_OnPopUpMenuCommand(UINT m_IDCmdMsg)
{
CPA_SuperObject *p_oSelection;
DEV_ViewPort3D *p_oViewPort;
Camera *p_oCamera;
// get the camera
p_oViewPort = (DEV_ViewPort3D*)(M_GetMultiDevice3D()->GetFocusDevice()->GetViewPort());
p_oCamera = (Camera*) p_oViewPort->GetCamera();
// get the selected superobject
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
switch (m_IDCmdMsg)
{
case C_PopUpTarget:
ASSERT(p_oSelection != NULL);
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpCenter:
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
p_oCamera->SetTargetType(tNone);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpNoTarget:
p_oCamera->SetTargetType(tNone);
break;
case C_ZoomTarget:
p_oCamera->ZoomOnTarget();
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_ZoomNotTargetedTarget:
ASSERT(p_oSelection != NULL);
p_oCamera->ZoomOnTarget(p_oSelection);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpEasyPointTarget:
ChangeCameraTarget();
return;
//ENDROMTEAM 3DEdition (Adrian Silvescu)
}
}
/*===========================================================================
* Description: Add Camera entries to popup
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
BOOL Camera_Interface::fn_bAddEntriesToTreePopup (CPA_DialogList *pDialog, CString csListName, CMenu *pMenu, UINT uiCustomEntriesStart)
{
DEV_ViewPort3D *p_oViewPort;
Camera *p_oCamera;
BOOL bResult;
CPA_BaseObject *p_oObject;
// this part is executed only if we are NOT the current editor
bResult = FALSE;
// get the camera
p_oViewPort = (DEV_ViewPort3D*)(M_GetMultiDevice3D()->GetFocusDevice()->GetViewPort());
p_oCamera = (Camera*) p_oViewPort->GetCamera();
if (GetInterface()->GetCurrentWorld()->GetCountSelected() == 1)
{
CPA_SuperObject *p_oSelection;
CString csText;
// get the selection
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
switch (p_oCamera->GetTargetType())
{
case tNone:
p_oObject = p_oSelection->GetObject();
if (p_oObject != NULL)
{
// entry select new target
csText = "Target " + p_oObject->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_PopUpTarget, (char*)(LPCTSTR)csText);
// entry center on object
csText = "Center on " + p_oObject->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_PopUpCenter, (char*)(LPCTSTR)csText);
// entry zoom on object
// get the object
csText = "Zoom on " + p_oObject->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_ZoomNotTargetedTarget, (char*)(LPCTSTR)csText);
bResult = TRUE;
}
break;
case tSuperObject:
// if the current target is different from the selected object
if (p_oSelection != p_oCamera->GetTargetSuperObject())
{
csText = "Set New Target to " + p_oSelection->GetObject()->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_PopUpTarget, (char*)(LPCTSTR)csText);
bResult = TRUE;
}
else // current target == selected object
{
// get the object
p_oObject = p_oCamera->GetTargetSuperObject()->GetObject();
if (p_oObject != NULL)
{
csText = "Zoom on " + p_oObject->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_ZoomTarget, (char*)(LPCTSTR)csText);
bResult = TRUE;
}
}
break;
case tPoint:
csText = "Set New Target to " + p_oSelection->GetObject()->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_PopUpTarget, (char*)(LPCTSTR)csText);
bResult = TRUE;
break;
}
}
else
{
// no object or more than one object selected.
// if camera is targeted, then add ZOOM entry if valid
if (p_oCamera->GetTargetType() == tSuperObject)
{
// get the object
p_oObject = p_oCamera->GetTargetSuperObject()->GetObject();
if (p_oObject != NULL)
{
CString csText = "Zoom on " + p_oObject->GetName();
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_ZoomTarget, (char*)(LPCTSTR)csText);
bResult = TRUE;
}
}
}
if (p_oCamera->GetTargetType() != tNone)
{
pMenu->AppendMenu(MF_STRING, uiCustomEntriesStart + C_PopUpNoTarget, "Not Targeted");
bResult = TRUE;
}
return bResult;
}
/*===========================================================================
*=========================================================================*/
BOOL Camera_Interface::fn_bAddEntriesToListPopup (CPA_DialogList *pDialog, CString csListName, CMenu *pMenu, UINT uiCustomEntriesStart)
{
return fn_bAddEntriesToTreePopup(pDialog, csListName, pMenu, uiCustomEntriesStart);
}
/*===========================================================================
*=========================================================================*/
void Camera_Interface::fn_vOnCommandInTreePopup (CPA_DialogList *pDialog, CString csListName, UINT uiCustomEntry)
{
CPA_SuperObject *p_oSelection;
DEV_ViewPort3D *p_oViewPort;
Camera *p_oCamera;
// get the camera
p_oViewPort = (DEV_ViewPort3D*)(M_GetMultiDevice3D()->GetFocusDevice()->GetViewPort());
p_oCamera = (Camera*) p_oViewPort->GetCamera();
// get the selected superobject
p_oSelection = GetInterface()->GetCurrentWorld()->GetSingleSelection();
switch (uiCustomEntry)
{
case C_PopUpTarget:
ASSERT(p_oSelection != NULL);
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpCenter:
p_oCamera->SetTargetSuperObject(p_oSelection);
p_oCamera->SetTargetType(tSuperObject);
p_oCamera->Update();
p_oCamera->SetTargetType(tNone);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpNoTarget:
p_oCamera->SetTargetType(tNone);
break;
case C_ZoomTarget:
p_oCamera->ZoomOnTarget();
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_ZoomNotTargetedTarget:
ASSERT(p_oSelection != NULL);
p_oCamera->ZoomOnTarget(p_oSelection);
GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
break;
case C_PopUpEasyPointTarget:
ChangeCameraTarget();
return;
}
}
/*===========================================================================
*=========================================================================*/
void Camera_Interface::fn_vOnCommandInListPopup (CPA_DialogList *pDialog, CString csListName, UINT uiCustomEntry)
{
fn_vOnCommandInTreePopup (pDialog, csListName, uiCustomEntry);
}

View File

@@ -0,0 +1,445 @@
// propert.cpp : implementation file
//
#include "stdafx.h"
#include "acp_base.h"
#include "caminter.hpp"
#include "camera.hpp"
#include "propert.hpp"
#define M_GetDLL(Camera) ((Camera_Interface*)((Camera)->GetEditor()))
#define M_GetAxisCombo() ((CComboBox*)GetDlgItem(IDC_COMBO_AXIS))
#define C_PI (float)3.14159265
/////////////////////////////////////////////////////////////////////////////
// Properties dialog
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
Properties::Properties(Camera* p_oCamera, CWnd* pParent /*=NULL*/)
: CDialog(Properties::IDD, pParent)
{
//{{AFX_DATA_INIT(Properties)
m_iRotationAxis = -1;
m_iTranslationAxis = -1;
m_iRotationStep = -1;
m_csRotationValue = _T("");
m_csTranslationValue = _T("");
m_iTranslationStep = -1;
m_bPrivilegeMode = FALSE;
//}}AFX_DATA_INIT
m_p_oCamera = p_oCamera;
m_bWantToOpenMore = FALSE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Properties)
DDX_Radio(pDX, IDC_RB_ROTATIONAXIS, m_iRotationAxis);
DDX_Radio(pDX, IDC_RB_TRANSLATIONAXIS, m_iTranslationAxis);
DDX_Radio(pDX, IDC_RB_ROTATIONSTEP, m_iRotationStep);
DDX_Text(pDX, IDC_ROTVALUE, m_csRotationValue);
DDX_Text(pDX, IDC_TRANSVALUE, m_csTranslationValue);
DDX_Radio(pDX, IDC_RB_TRANSLATIONSTEP, m_iTranslationStep);
DDX_Check(pDX, IDC_CHK_PRIVILEGE, m_bPrivilegeMode);
//}}AFX_DATA_MAP
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BEGIN_MESSAGE_MAP(Properties, CDialog)
//{{AFX_MSG_MAP(Properties)
ON_EN_KILLFOCUS(IDC_TRANSVALUE, OnKillfocusTransvalue)
ON_EN_KILLFOCUS(IDC_ROTVALUE, OnKillfocusRotvalue)
ON_BN_CLICKED(IDC_RB_ROTATIONSTEP, OnRbRotationStep)
ON_BN_CLICKED(IDC_RB_TRANSLATIONSTEP, OnRbTranslationStep)
ON_BN_CLICKED(IDC_BT_MORE, OnBtMore)
ON_BN_CLICKED(IDC_10M, OnRbTranslationStep)
ON_BN_CLICKED(IDC_1M, OnRbTranslationStep)
ON_BN_CLICKED(IDC_50CM, OnRbTranslationStep)
ON_BN_CLICKED(IDC_PION16, OnRbRotationStep)
ON_BN_CLICKED(IDC_PION32, OnRbRotationStep)
ON_BN_CLICKED(IDC_PION8, OnRbRotationStep)
ON_BN_DOUBLECLICKED(IDC_10M, OnOK)
ON_BN_DOUBLECLICKED(IDC_1M, OnOK)
ON_BN_DOUBLECLICKED(IDC_50CM, OnOK)
ON_BN_DOUBLECLICKED(IDC_PION16, OnOK)
ON_BN_DOUBLECLICKED(IDC_PION32, OnOK)
ON_BN_DOUBLECLICKED(IDC_PION8, OnOK)
ON_BN_DOUBLECLICKED(IDC_RB_ROTATIONAXIS, OnOK)
ON_BN_DOUBLECLICKED(IDC_RB_ROTATIONSTEP, OnOK)
ON_BN_DOUBLECLICKED(IDC_RB_TRANSLATIONAXIS, OnOK)
ON_BN_DOUBLECLICKED(IDC_RB_TRANSLATIONSTEP, OnOK)
ON_BN_DOUBLECLICKED(IDC_ROTWORLD, OnOK)
ON_BN_DOUBLECLICKED(IDC_TRANSWORLD, OnOK)
ON_BN_CLICKED(IDC_CHK_PRIVILEGE, OnChkPrivilege)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Properties message handlers
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Properties::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_RBUTTONDOWN)
{
OnOK();
return 1;
}
return CDialog::PreTranslateMessage(pMsg);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
BOOL Properties::OnInitDialog()
{
POINT stPoint;
float fTransValue;
float fRotValue;
tdeDisplayReferential eDisplayMode;
CDialog::OnInitDialog();
// get the current translation and rotation step
fTransValue = M_GetDLL(m_p_oCamera)->GetTranslationStep();
fRotValue = M_GetDLL(m_p_oCamera)->GetRotationStep() * 180 / C_PI;
// init the edit dialog values (and update the radiobuttons)
VERIFY(UpdateTransRadioButtons(fTransValue));
VERIFY(UpdateRotRadioButtons(fRotValue));
// init the translation and rotation axis
if (m_p_oCamera->GetRotationAxisSystem() == CameraCoordinates)
m_iRotationAxis = 0; //camera
else
m_iRotationAxis = 1; //world
if (m_p_oCamera->GetTranslationAxisSystem() == CameraCoordinates)
m_iTranslationAxis = 0; //camera
else
m_iTranslationAxis = 1; //world
if (m_p_oCamera->IsInPrivilegeMode())
{
m_iRotationAxis = 0;
m_iTranslationAxis = 0;
m_bPrivilegeMode = TRUE;
GetDlgItem(IDC_RB_ROTATIONAXIS)->EnableWindow(FALSE);
GetDlgItem(IDC_ROTWORLD)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSLATIONAXIS)->EnableWindow(FALSE);
GetDlgItem(IDC_TRANSWORLD)->EnableWindow(FALSE);
}
else
m_bPrivilegeMode = FALSE;
// update drawing
UpdateData(FALSE);
eDisplayMode = M_GetDLL(m_p_oCamera) -> GetReferentialDisplayMode();
if( eDisplayMode == DisplayNone )
M_GetAxisCombo() -> SelectString(-1,"No");
else if( eDisplayMode == DisplayDownLeft )
M_GetAxisCombo() -> SelectString(-1,"Down Left");
else if( eDisplayMode == DisplayDownRight)
M_GetAxisCombo() -> SelectString(-1,"Down Right");
GetCursorPos(&stPoint);
SetWindowPos(&wndTop,stPoint.x,stPoint.y+10,40,100,SWP_NOSIZE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnKillfocusTransvalue()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csTranslationValue;
// get the new text value
UpdateData(TRUE);
// update radio buttons
if (UpdateTransRadioButtons() == FALSE)
m_csTranslationValue = csOldValue;
// update drawing
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnKillfocusRotvalue()
{
CString csOldValue;
// translate old value into float and save it
csOldValue = m_csRotationValue;
// get the new text value
UpdateData(TRUE);
// update radio buttons
if (UpdateRotRadioButtons() == FALSE)
m_csRotationValue = csOldValue;
// update drawing
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnRbTranslationStep()
{
// get the new button value
UpdateData(TRUE);
// update the control value
UpdateTransText();
// update drawing of dialog
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnRbRotationStep()
{
// get the new button value
UpdateData(TRUE);
// update the control value
UpdateRotText();
// update drawing of dialog
UpdateData(FALSE);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update translation value text control according to selected radio button
void Properties::UpdateTransText()
{
switch(m_iTranslationStep)
{
case 0:
m_csTranslationValue.Format("%.3f",0.1);
break;
case 1:
m_csTranslationValue.Format("%.3f",1.0);
break;
case 2:
m_csTranslationValue.Format("%.3f",10.0);
break;
case 3:
m_csTranslationValue.Format("%.3f",100.0);
break;
default:
m_csTranslationValue = "";
break;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update rotation value text control according to selected radio button
void Properties::UpdateRotText()
{
switch(m_iRotationStep)
{
case 0:
m_csRotationValue.Format("%.3f",180.0/4.0);
break;
case 1:
m_csRotationValue.Format("%.3f",180.0/8.0);
break;
case 2:
m_csRotationValue.Format("%.3f",180.0/16.0);
break;
case 3:
m_csRotationValue.Format("%.3f",180.0/32.0);
break;
default:
m_csRotationValue = "";
break;
}
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update rotation radio buttons according to parameter.
BOOL Properties::UpdateRotRadioButtons(float fRotValue)
{
if (fRotValue != -1)
{
// a value was given, take it
if (fRotValue <= 0) return FALSE;
m_csRotationValue.Format("%.3f",fRotValue);
}
else
{
// no initial value given, take the current one
fRotValue = (float) atof(m_csRotationValue);
if (fRotValue <= 0) return FALSE;
}
if (fabs(fRotValue - 45) < 1e-5)
m_iRotationStep = 0;
else if (fabs(fRotValue - 22.5) < 1e-5)
m_iRotationStep = 1;
else if (fabs(fRotValue - 11.25) < 1e-5)
m_iRotationStep = 2;
else if (fabs(fRotValue - 5.625) < 1e-5)
m_iRotationStep = 3;
else
m_iRotationStep = -1;
return TRUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
// update translation radio buttons according to parameter.
BOOL Properties::UpdateTransRadioButtons(float fTransValue)
{
if (fTransValue != -1)
{
// a value was given, take it
if (fTransValue <= 0) return FALSE;
m_csTranslationValue.Format("%.3f",fTransValue);
}
else
{
// no initial value given, take the current one
fTransValue = (float) atof(m_csTranslationValue);
if (fTransValue <= 0) return FALSE;
}
if (fabs(fTransValue - 10) < 1e-5)
m_iTranslationStep = 2;
else if (fabs(fTransValue - 0.1) < 1e-5)
m_iTranslationStep = 0;
else if (fabs(fTransValue - 1) < 1e-5)
m_iTranslationStep = 1;
else if (fabs(fTransValue - 100) < 1e-5)
m_iTranslationStep = 3;
else
m_iTranslationStep = -1;
return TRUE;
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnOK()
{
UpdateData(TRUE);
m_eRotationAxis = (m_iRotationAxis == 0) ? CameraCoordinates : WorldCoordinates;
m_eTranslationAxis = (m_iTranslationAxis == 0) ? CameraCoordinates : WorldCoordinates;
m_fRotValue = (float) (atof(m_csRotationValue) * C_PI / 180.0);
m_fTransValue = (float) atof(m_csTranslationValue);
if (m_fTransValue == 0.0)
m_fTransValue = 0.001;
// Axis Display
int iIndex = M_GetAxisCombo() -> GetCurSel();
if( iIndex != CB_ERR )
{
CString csText;
M_GetAxisCombo() -> GetLBText( iIndex, csText );
if( csText == "No" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayNone );
else if( csText == "Down Left" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayDownLeft );
else if( csText == "Down Right" )
M_GetDLL(m_p_oCamera) -> SetReferentialDisplayMode( DisplayDownRight );
}
CDialog::OnOK();
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::DoUpdate()
{
M_GetDLL(m_p_oCamera)->SetTranslationStep(m_fTransValue);
M_GetDLL(m_p_oCamera)->SetRotationStep(m_fRotValue);
m_p_oCamera->SetRotationAxisSystem(m_eRotationAxis);
m_p_oCamera->SetTranslationAxisSystem(m_eTranslationAxis);
m_p_oCamera->SetPrivilegeMode(m_bPrivilegeMode);
}
//********************************************************************************************************
//********************************************************************************************************
//********************************************************************************************************
void Properties::OnBtMore()
{
m_bWantToOpenMore = TRUE;
OnOK();
}
void Properties::OnChkPrivilege()
{
UpdateData(TRUE);
if (m_bPrivilegeMode)
{
m_iRotationAxis = 0;
m_iTranslationAxis = 0;
GetDlgItem(IDC_RB_ROTATIONAXIS)->EnableWindow(FALSE);
GetDlgItem(IDC_ROTWORLD)->EnableWindow(FALSE);
GetDlgItem(IDC_RB_TRANSLATIONAXIS)->EnableWindow(FALSE);
GetDlgItem(IDC_TRANSWORLD)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_RB_ROTATIONAXIS)->EnableWindow(TRUE);
GetDlgItem(IDC_ROTWORLD)->EnableWindow(TRUE);
GetDlgItem(IDC_RB_TRANSLATIONAXIS)->EnableWindow(TRUE);
GetDlgItem(IDC_TRANSWORLD)->EnableWindow(TRUE);
}
UpdateData(FALSE);
// TODO: Add your control notification handler code here
}