664 lines
22 KiB
C++
664 lines
22 KiB
C++
//ROMTEAM StickObjects (Gabi Dumitrascu 02/02/98)
|
|
|
|
/*=========================================================================
|
|
* edtdsel.cpp : Implementation file
|
|
* we will select three points from the destination object,three points
|
|
from the source object and stick them together.
|
|
*
|
|
* Version 1.0
|
|
* Creation date
|
|
* Revision date
|
|
*
|
|
* CPA2 Gabi Dumitrascu 98-02-02
|
|
*=======================================================================*/
|
|
|
|
#include "stdafx.h"
|
|
#ifdef ACTIVE_EDITOR
|
|
|
|
#include "acp_base.h"
|
|
|
|
#include "ITF.h"
|
|
|
|
#include "edtdedit.hpp"
|
|
#include "edtdsel.hpp"
|
|
#include "EDTBase.hpp"
|
|
#include "EDTSObj.hpp"
|
|
|
|
#include "incMTH.h"
|
|
|
|
#include "..\Main\Inc\_EditID.h"
|
|
#include "TUT.h"
|
|
|
|
#include "EDTrot.hpp"
|
|
|
|
#define M_GetToolDLLs() m_pEditor->GetMainWorld()->GetToolDLLReceivingEvtEditorMsg()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EDT_DialogSelect
|
|
|
|
|
|
EDT_DialogSelect::EDT_DialogSelect(CWnd *pParent)
|
|
: CFormView(EDT_DialogSelect::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(EDT_DialogSelect)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void EDT_DialogSelect::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CFormView::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(EDT_DialogSelect)
|
|
DDX_Control(pDX, EDT_IDC_SELECTSRC, m_ckSelectSrc);
|
|
DDX_Control(pDX, EDT_IDC_SELECTDST, m_ckSelectDst);
|
|
DDX_Control(pDX, EDT_IDC_Z33, m_PosZ33);
|
|
DDX_Control(pDX, EDT_IDC_Z3, m_PosZ3);
|
|
DDX_Control(pDX, EDT_IDC_Z22, m_PosZ22);
|
|
DDX_Control(pDX, EDT_IDC_Z2, m_PosZ2);
|
|
DDX_Control(pDX, EDT_IDC_Z11, m_PosZ11);
|
|
DDX_Control(pDX, EDT_IDC_Z1, m_PosZ1);
|
|
DDX_Control(pDX, EDT_IDC_Y33, m_PosY33);
|
|
DDX_Control(pDX, EDT_IDC_Y3, m_PosY3);
|
|
DDX_Control(pDX, EDT_IDC_Y22, m_PosY22);
|
|
DDX_Control(pDX, EDT_IDC_Y2, m_PosY2);
|
|
DDX_Control(pDX, EDT_IDC_Y11, m_PosY11);
|
|
DDX_Control(pDX, EDT_IDC_Y1, m_PosY1);
|
|
DDX_Control(pDX, EDT_IDC_X33, m_PosX33);
|
|
DDX_Control(pDX, EDT_IDC_X3, m_PosX3);
|
|
DDX_Control(pDX, EDT_IDC_X22, m_PosX22);
|
|
DDX_Control(pDX, EDT_IDC_X2, m_PosX2);
|
|
DDX_Control(pDX, EDT_IDC_X11, m_PosX11);
|
|
DDX_Control(pDX, EDT_IDC_X1, m_PosX1);
|
|
DDX_Control(pDX, EDT_IDC_MOVE, m_bMove);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(EDT_DialogSelect, CFormView)
|
|
//{{AFX_MSG_MAP(EDT_DialogSelect)
|
|
ON_WM_DESTROY()
|
|
ON_BN_CLICKED(EDT_IDC_MOVE, OnMove)
|
|
ON_BN_CLICKED(EDT_IDC_SELECTDST, OnSelectDst)
|
|
ON_BN_CLICKED(EDT_IDC_SELECTSRC, OnSelectSrc)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/*===========================================================================
|
|
* Description:
|
|
* Creation date:
|
|
* Author:
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
CPA_Interface * EDT_DialogSelect::GetInterface (void)
|
|
{
|
|
return m_pEditor->GetInterface();
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: Init Dialog
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date:
|
|
* Author:
|
|
*=========================================================================*/
|
|
void EDT_DialogSelect::fn_vInitDialog (EDT_HierarchyEditor *pEditor, FRMBase *pFrame)
|
|
{
|
|
// create the dialog
|
|
m_pEditor = pEditor;
|
|
CFormView::Create(NULL, "", WS_VISIBLE|WS_CHILD, CRect(0,0,0,0), pFrame, AFX_IDW_PANE_FIRST, NULL);
|
|
|
|
m_bWrongObject = FALSE;
|
|
m_iCrtDstPoint = -1;
|
|
m_iCrtSrcPoint = -1;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
MTH3D_M_vNullVector(m_stDstPoints + i);
|
|
MTH3D_M_vNullVector(m_stSrcPoints + i);
|
|
}
|
|
// init data for dialog
|
|
CFormView::UpdateData(FALSE);
|
|
|
|
// FOR TUTORIAL
|
|
TUT_M_vGetTutDll();
|
|
// button Select points
|
|
TUT_M_vRegisterControl(m_ckSelectDst.m_hWnd, "EDT_DEDIT_BUTTON_SELECTDST", TUT_e_Button);
|
|
TUT_M_vRegisterControl(m_ckSelectSrc.m_hWnd, "EDT_DEDIT_BUTTON_SELECTSRC", TUT_e_Button);
|
|
// position
|
|
TUT_M_vRegisterControl(m_PosX1.m_hWnd, "EDT_DEDIT_EDIT_POSX1", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY1.m_hWnd, "EDT_DEDIT_EDIT_POSY1", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ1.m_hWnd, "EDT_DEDIT_EDIT_POSZ1", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosX2.m_hWnd, "EDT_DEDIT_EDIT_POSX2", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY2.m_hWnd, "EDT_DEDIT_EDIT_POSY2", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ2.m_hWnd, "EDT_DEDIT_EDIT_POSZ2", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosX3.m_hWnd, "EDT_DEDIT_EDIT_POSX3", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY3.m_hWnd, "EDT_DEDIT_EDIT_POSY3", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ3.m_hWnd, "EDT_DEDIT_EDIT_POSZ3", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosX11.m_hWnd, "EDT_DEDIT_EDIT_POSX11", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY11.m_hWnd, "EDT_DEDIT_EDIT_POSY11", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ11.m_hWnd, "EDT_DEDIT_EDIT_POSZ11", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosX22.m_hWnd, "EDT_DEDIT_EDIT_POSX22", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY22.m_hWnd, "EDT_DEDIT_EDIT_POSY22", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ22.m_hWnd, "EDT_DEDIT_EDIT_POSZ22", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosX33.m_hWnd, "EDT_DEDIT_EDIT_POSX33", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosY33.m_hWnd, "EDT_DEDIT_EDIT_POSY33", TUT_e_TextEdit);
|
|
TUT_M_vRegisterControl(m_PosZ33.m_hWnd, "EDT_DEDIT_EDIT_POSZ33", TUT_e_TextEdit);
|
|
// button move
|
|
TUT_M_vRegisterControl(m_bMove.m_hWnd, "EDT_DEDIT_BUTTON_MOVE", TUT_e_Button);
|
|
// END TUTORIAL
|
|
|
|
|
|
m_ckSelectDst.SetCheck(FALSE);
|
|
m_ckSelectSrc.SetCheck(FALSE);
|
|
// update data
|
|
fn_vUpdateDialog();
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: update dialog when object changes
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date:
|
|
* Author:
|
|
*=========================================================================*/
|
|
void EDT_DialogSelect::fn_vUpdateDialog (void)
|
|
{
|
|
CPA_SuperObject* pSelectedObject = m_pEditor->M_GetSingleSelection();
|
|
m_ckSelectDst.EnableWindow(!fn_bIsSelectingDst() && !m_bWrongObject );
|
|
m_ckSelectSrc.EnableWindow(m_iCrtDstPoint == 3 && pSelectedObject && pSelectedObject != m_pDstObject );
|
|
|
|
m_ckSelectDst.EnableWindow((pSelectedObject != NULL));
|
|
|
|
m_bMove.EnableWindow(m_iCrtDstPoint == 3 && m_iCrtSrcPoint == 3);// && m_bWrongObject);
|
|
|
|
fn_vUpdateDstDialog ();
|
|
fn_vUpdateSrcDialog ();
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: update the destination dialog
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
|
|
void EDT_DialogSelect::fn_vUpdateDstDialog (void)
|
|
{
|
|
char szPosX[3][10],szPosY[3][10],szPosZ[3][10];
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
*szPosX[i] = *szPosY[i] = *szPosZ[i] = 0;
|
|
|
|
for (i = 0; i < m_iCrtDstPoint; i++)
|
|
{
|
|
sprintf(szPosX[i], "%7.4f", MTH3D_M_xGetXofVector(&m_stDstPoints[i]));
|
|
sprintf(szPosY[i], "%7.4f", MTH3D_M_xGetYofVector(&m_stDstPoints[i]));
|
|
sprintf(szPosZ[i], "%7.4f", MTH3D_M_xGetZofVector(&m_stDstPoints[i]));
|
|
}
|
|
|
|
m_PosX1.SetWindowText(szPosX[0]);
|
|
m_PosY1.SetWindowText(szPosY[0]);
|
|
m_PosZ1.SetWindowText(szPosZ[0]);
|
|
|
|
m_PosX2.SetWindowText(szPosX[1]);
|
|
m_PosY2.SetWindowText(szPosY[1]);
|
|
m_PosZ2.SetWindowText(szPosZ[1]);
|
|
|
|
m_PosX3.SetWindowText(szPosX[2]);
|
|
m_PosY3.SetWindowText(szPosY[2]);
|
|
m_PosZ3.SetWindowText(szPosZ[2]);
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: update the source dialog
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
void EDT_DialogSelect::fn_vUpdateSrcDialog (void)
|
|
{
|
|
char szPosX[3][10],szPosY[3][10],szPosZ[3][10];
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
*szPosX[i] = *szPosY[i] = *szPosZ[i] = 0;
|
|
|
|
for (i = 0; i < m_iCrtSrcPoint; i++)
|
|
{
|
|
sprintf(szPosX[i], "%7.4f", MTH3D_M_xGetXofVector(&m_stSrcPoints[i]));
|
|
sprintf(szPosY[i], "%7.4f", MTH3D_M_xGetYofVector(&m_stSrcPoints[i]));
|
|
sprintf(szPosZ[i], "%7.4f", MTH3D_M_xGetZofVector(&m_stSrcPoints[i]));
|
|
}
|
|
|
|
m_PosX11.SetWindowText(szPosX[0]);
|
|
m_PosY11.SetWindowText(szPosY[0]);
|
|
m_PosZ11.SetWindowText(szPosZ[0]);
|
|
|
|
m_PosX22.SetWindowText(szPosX[1]);
|
|
m_PosY22.SetWindowText(szPosY[1]);
|
|
m_PosZ22.SetWindowText(szPosZ[1]);
|
|
|
|
m_PosX33.SetWindowText(szPosX[2]);
|
|
m_PosY33.SetWindowText(szPosY[2]);
|
|
m_PosZ33.SetWindowText(szPosZ[2]);
|
|
}
|
|
|
|
|
|
/*===========================================================================
|
|
* Description: These two functions are called in the function OnLButtonDown
|
|
from edtbase.cpp
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
BOOL EDT_DialogSelect::fn_bIsSelecting()
|
|
{
|
|
return fn_bIsSelectingDst() || fn_bIsSelectingSrc();
|
|
}
|
|
|
|
|
|
void EDT_DialogSelect::fn_vSetPoint(tdstMousePos *p_stPos, HIE_tdstPickInfo *p_stPickInfo)
|
|
{
|
|
if (fn_bIsSelectingDst())
|
|
fn_vSetDstPoint(p_stPos, p_stPickInfo);
|
|
if (fn_bIsSelectingSrc())
|
|
fn_vSetSrcPoint(p_stPos, p_stPickInfo);
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: Set the points of the destination object
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
|
|
void EDT_DialogSelect::fn_vSetDstPoint(tdstMousePos *p_stPos, HIE_tdstPickInfo *p_stPickInfo)
|
|
{
|
|
CPA_SuperObject* pSelectedObject = m_pEditor->M_GetSingleSelection();
|
|
|
|
if (m_iCrtDstPoint == 0)
|
|
m_pDstObject = pSelectedObject;
|
|
|
|
// If no selected object or the selected obj was changed, then cancel the selection
|
|
if (!pSelectedObject || m_pDstObject != pSelectedObject || m_pDstObject == m_pSrcObject)
|
|
{
|
|
m_bWrongObject = TRUE;
|
|
M_GetMainWnd()->UpdateStatus("No object selected or the object was changed. Cancel the selection.", C_STATUSPANE_INFOS, C_STATUS_ERROR);
|
|
fn_vUpdateDialog();
|
|
return;
|
|
}
|
|
if (m_bWrongObject)
|
|
{
|
|
m_bWrongObject = FALSE;
|
|
return;
|
|
}
|
|
|
|
HIE_aDEF_stTabOfPickInfo xPickInfo;
|
|
DEV_ViewPort3D *pCurViewport = ((DEV_ViewPort3D *)m_pEditor->GetInterface()->GetMultiDevice()->GetFocusDevice()->GetViewPort());
|
|
|
|
if(HIE_xIsSuperObjectPick(GLI_C_ModePickingPoint, pCurViewport->m_hDisplayDevice, pCurViewport->m_hDisplayViewport,
|
|
&p_stPos->stPos2D, p_stPickInfo[0].hSprObject, xPickInfo ))
|
|
{
|
|
// Get the object relative point's coord
|
|
ACP_tdxIndex xSelectedPointIndex = ((HIE_tdstPickInfo*)xPickInfo)->stPickedObject.aDEF_stDataOfElement[0].xIndexOfPoint;
|
|
MTH3D_tdstVector x3DPoint = ((HIE_tdstPickInfo*)xPickInfo)->hGeoObject->d_stListOfPoints[xSelectedPointIndex];
|
|
// Get the absolute point's coord
|
|
POS_tdstCompletePosition * pObjectMatrix = HIE_fn_hGetSuperObjectMatrix(m_pDstObject->GetStruct());
|
|
POS_fn_vMulMatrixVertex(&x3DPoint, pObjectMatrix, &x3DPoint);
|
|
// Save the absolute point's coord
|
|
m_stDstPoints[m_iCrtDstPoint++] = x3DPoint;
|
|
|
|
if (m_iCrtDstPoint == 3)
|
|
{
|
|
m_bWrongObject = TRUE;
|
|
m_ckSelectDst.SetCheck(FALSE);
|
|
}
|
|
// Update the dialog's fields
|
|
fn_vUpdateDialog();
|
|
}
|
|
}
|
|
|
|
/*===========================================================================
|
|
* Description: Set the points of the source object
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
void EDT_DialogSelect::fn_vSetSrcPoint(tdstMousePos *p_stPos, HIE_tdstPickInfo *p_stPickInfo)
|
|
{
|
|
|
|
CPA_SuperObject* pSelectedObject = m_pEditor->M_GetSingleSelection();
|
|
|
|
if (m_iCrtSrcPoint == 0)
|
|
m_pSrcObject = pSelectedObject;
|
|
// If no selected object or the selected obj was changed, then cancel the selection.
|
|
if (!pSelectedObject || m_pSrcObject != pSelectedObject || m_pDstObject == m_pSrcObject)
|
|
{
|
|
m_bWrongObject = TRUE;
|
|
M_GetMainWnd()->UpdateStatus("No object selected or the object was changed. Cancel the selection.", C_STATUSPANE_INFOS, C_STATUS_ERROR);
|
|
fn_vUpdateDialog();
|
|
return;
|
|
}
|
|
if (m_bWrongObject)
|
|
{
|
|
m_bWrongObject = FALSE;
|
|
return;
|
|
}
|
|
|
|
HIE_aDEF_stTabOfPickInfo xPickInfo;
|
|
DEV_ViewPort3D *pCurViewport = ((DEV_ViewPort3D *)m_pEditor->GetInterface()->GetMultiDevice()->GetFocusDevice()->GetViewPort());
|
|
|
|
if(HIE_xIsSuperObjectPick(GLI_C_ModePickingPoint, pCurViewport->m_hDisplayDevice, pCurViewport->m_hDisplayViewport,
|
|
&p_stPos->stPos2D, p_stPickInfo[0].hSprObject, xPickInfo ))
|
|
{
|
|
// Get the object relative point's coord
|
|
ACP_tdxIndex xSelectedPointIndex = ((HIE_tdstPickInfo*)xPickInfo)->stPickedObject.aDEF_stDataOfElement[0].xIndexOfPoint;
|
|
MTH3D_tdstVector x3DPoint = ((HIE_tdstPickInfo*)xPickInfo)->hGeoObject->d_stListOfPoints[xSelectedPointIndex];
|
|
// Get the absolute point's coord
|
|
POS_tdstCompletePosition * pObjectMatrix = HIE_fn_hGetSuperObjectMatrix(m_pSrcObject->GetStruct());
|
|
POS_fn_vMulMatrixVertex(&x3DPoint, pObjectMatrix, &x3DPoint);
|
|
// Save the absolute point's coord
|
|
m_stSrcPoints[m_iCrtSrcPoint++] = x3DPoint;
|
|
// Update the dialog's fields
|
|
if (m_iCrtSrcPoint == 3)
|
|
{
|
|
m_bWrongObject = TRUE;
|
|
m_ckSelectSrc.SetCheck(FALSE);
|
|
}
|
|
// Update the dialog's fields
|
|
fn_vUpdateDialog();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
* EDT_DialogSelect message handlers
|
|
* Creation date: 98-02-02
|
|
* Author: CPA2 Gabi Dumitrascu
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
|
|
void EDT_DialogSelect::OnSelectDst()
|
|
{
|
|
m_iCrtDstPoint = 0;
|
|
m_bWrongObject = FALSE;
|
|
fn_vUpdateDialog();
|
|
}
|
|
|
|
|
|
void EDT_DialogSelect::OnSelectSrc()
|
|
{
|
|
m_iCrtSrcPoint = 0;
|
|
m_bWrongObject = FALSE;
|
|
fn_vUpdateDialog();
|
|
}
|
|
|
|
void EDT_DialogSelect::OnMove()
|
|
{
|
|
if (m_pSrcObject != m_pEditor->M_GetSingleSelection())
|
|
{
|
|
GetInterface ()->fn_vCancelCurrentSelection(FALSE);
|
|
GetInterface ()->fn_vAddSelectedObject(m_pSrcObject , TRUE);
|
|
}
|
|
|
|
if (m_iCrtDstPoint == 3 && m_iCrtSrcPoint == 3)
|
|
{
|
|
// Compute the rotation matrix and the translation vector.
|
|
Matrix src, dst, resM;
|
|
Vector vect;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
dst[i][0] = m_stDstPoints[i].xX;
|
|
dst[i][1] = m_stDstPoints[i].xY;
|
|
dst[i][2] = m_stDstPoints[i].xZ;
|
|
}
|
|
for (i=0; i < 3; i++)
|
|
{
|
|
src[i][0] = m_stSrcPoints[i].xX;
|
|
src[i][1] = m_stSrcPoints[i].xY;
|
|
src[i][2] = m_stSrcPoints[i].xZ;
|
|
}
|
|
if (!GetTransform(dst, src, resM, vect))
|
|
{
|
|
// display message box
|
|
M_GetMainWnd()->UpdateStatus("The selected triangles are invalid. Cancel the move.", C_STATUSPANE_INFOS, C_STATUS_ERROR);
|
|
m_ckSelectSrc.EnableWindow(FALSE);
|
|
}
|
|
else
|
|
{
|
|
// CPA2 Nicolae Suparatu 98-02-10
|
|
// STM - 18-8-98 - use stTransformMatrix instead of stRotationMatrix
|
|
POS_tdstCompletePosition m, *stMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(m_pSrcObject->GetStruct());
|
|
CopyMemory(&m.stTransformMatrix, &stMatrix->stTransformMatrix, sizeof(Matrix));
|
|
CopyMemory(&m.stTranslationVector, &stMatrix->stTranslationVector, sizeof(Vector));
|
|
// Translate and rotate the last selected object.
|
|
Convert(resM, vect, (Matrix&)m.stTransformMatrix, (Vector&)m.stTranslationVector);
|
|
m_edit->fn_vSetNewPositionAndRotation((EDT_SuperObject *)m_pSrcObject, m);
|
|
|
|
// End CPA2 Nicolae Suparatu 98-02-10
|
|
|
|
}
|
|
|
|
m_iCrtDstPoint = -1;
|
|
m_iCrtSrcPoint = -1;
|
|
fn_vUpdateDialog();
|
|
m_pDstObject = m_pSrcObject = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
void EDT_DialogSelect::OnDestroy()
|
|
{
|
|
// FOR TUTORIAL
|
|
TUT_M_vGetTutDll();
|
|
// button select
|
|
TUT_M_vUnregisterControl(m_ckSelectDst.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_ckSelectSrc.m_hWnd);
|
|
// position
|
|
TUT_M_vUnregisterControl(m_PosX1.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY1.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ1.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosX2.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY2.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ2.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosX3.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY3.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ3.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosX11.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY11.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ11.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosX22.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY22.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ22.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosX33.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosY33.m_hWnd);
|
|
TUT_M_vUnregisterControl(m_PosZ33.m_hWnd);
|
|
// button move
|
|
TUT_M_vUnregisterControl(m_bMove.m_hWnd);
|
|
// END TUTORIAL
|
|
|
|
CFormView::OnDestroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
//// Begin Silviu Simen september 1998 List of Objects in Sectors
|
|
/*=========================================================================
|
|
* Version 1.0
|
|
* Creation date 9 september 1998
|
|
* Revision date 9 september 1998
|
|
*
|
|
* Author : Silviu Simen
|
|
*=======================================================================*/
|
|
|
|
static int s_iDefSect = 0;
|
|
static int s_iDefType = 0;
|
|
|
|
struct stTypeNames_
|
|
{
|
|
unsigned long ulType;
|
|
char * szTypeName;
|
|
BOOL bActive;
|
|
}
|
|
stTypeNames[] =
|
|
{
|
|
HIE_C_ulSuperObject, "SuperObject", 0,
|
|
HIE_C_ulActor, "Actor", 1,
|
|
HIE_C_ulSector, "Sector", 0,
|
|
HIE_C_ulPO, "PhysicalObject", 0,
|
|
HIE_C_ulPO_Mirror, "PO Mirror", 0,
|
|
HIE_C_ulIPO, "IPO", 1,
|
|
HIE_C_ulIPO_Mirror, "IPO Mirror", 1,
|
|
HIE_C_ulSpecialEffect, "SpecialEffect", 0,
|
|
HIE_C_ulNoAction, "OOPS", 0,
|
|
HIE_C_ulMirror, "Mirror", 0,
|
|
HIE_C_ulEDT_Geometric, "Geometric", 0,
|
|
HIE_C_ulEDT_Light, "Light", 1,
|
|
HIE_C_ulEDT_Waypoint, "WayPoint", 1
|
|
//#define HIE_C_ulEDT_ZdD 0x00002000 // ZdD object (Editor)
|
|
//#define HIE_C_ulEDT_ZdE 0x00004000 // ZdE object (Editor)
|
|
//#define HIE_C_ulEDT_ZdM 0x00008000 // ZdM object (Editor)
|
|
//#define HIE_C_ulEDT_ZdR 0x00010000 // ZdR object (Editor)
|
|
//#define HIE_C_ulEDT_BdV 0x00020000 // Bounding Volume object (Editor)
|
|
//#define HIE_C_ulEDT_TestPoint 0x00040000 // TestPoint object (Editor)
|
|
};
|
|
|
|
#define NUMBEROFNAMES (sizeof(stTypeNames)/sizeof(stTypeNames_))
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// implementation of the EDT_DialogSelectType class.
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
EDT_DialogSelectType::EDT_DialogSelectType (CPA_Interface *p_oInterface, CWnd* pParent)
|
|
: CDialog(EDT_DialogSelectType::IDD)
|
|
{
|
|
m_p_oInterface = p_oInterface;
|
|
//{{AFX_DATA_INIT(EDT_DialogSelectType)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
EDT_DialogSelectType::~EDT_DialogSelectType()
|
|
{
|
|
|
|
}
|
|
|
|
void EDT_DialogSelectType::Init(void)
|
|
{
|
|
POSITION pos;
|
|
int i;
|
|
for (i=0;i<NUMBEROFNAMES;i++)
|
|
{
|
|
if (stTypeNames[i].bActive)
|
|
m_cTypes.AddString(stTypeNames[i].szTypeName);
|
|
}
|
|
|
|
CPA_List<CPA_SuperObject>* poList = GetInterface()->GetObjectListByType (C_szSectorTypeName);
|
|
CPA_SuperObject * p_sector;
|
|
|
|
// Sectors
|
|
for (p_sector = poList -> GetHeadElement(pos); p_sector;
|
|
p_sector = poList -> GetNextElement(pos) ) {
|
|
m_cSectors.AddString (p_sector -> GetName());
|
|
}
|
|
|
|
if (s_iDefSect >= m_cSectors.GetCount() )
|
|
s_iDefSect = 0;
|
|
if (s_iDefType >= m_cTypes.GetCount() )
|
|
s_iDefType = 0;
|
|
|
|
m_cSectors.SetCurSel(s_iDefSect);
|
|
m_cTypes.SetCurSel(s_iDefType);
|
|
|
|
}
|
|
|
|
void EDT_DialogSelectType::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(EDT_DialogSelectType)
|
|
DDX_Control(pDX, EDT_IDC_SECTORLIST, m_cSectors);
|
|
DDX_Control(pDX, EDT_IDC_TYPESLIST, m_cTypes);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
void EDT_DialogSelectType::OnOK (void)
|
|
{
|
|
// check sectors !
|
|
if (m_cSectors.GetCount() == 0)
|
|
{
|
|
m_bWasOK = FALSE;
|
|
CDialog::OnCancel();
|
|
return;
|
|
}
|
|
|
|
// for sector we need the string
|
|
m_cSectors.GetText(m_cSectors.GetCurSel(),m_csSelSector);
|
|
// combo m_cSectors.GetLBText(m_cSectors.GetCurSel(), m_csSelSector);
|
|
|
|
|
|
// for Type we need the type
|
|
CString csTypeSelected;
|
|
int i;
|
|
// combo m_cTypes.GetLBText(m_cTypes.GetCurSel(), typeSelected);
|
|
m_cTypes.GetText(m_cTypes.GetCurSel(), csTypeSelected);
|
|
for (i=0;i<NUMBEROFNAMES;i++)
|
|
{
|
|
if ((stTypeNames[i].bActive) && (strcmp(stTypeNames[i].szTypeName, csTypeSelected)==0))
|
|
{
|
|
m_ulSelType = stTypeNames[i].ulType;
|
|
break;
|
|
}
|
|
}
|
|
|
|
s_iDefSect = m_cSectors.GetCurSel();
|
|
s_iDefType = m_cTypes.GetCurSel();
|
|
|
|
m_bWasOK = TRUE;
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
BOOL EDT_DialogSelectType::OnInitDialog (void)
|
|
{
|
|
CDialog::OnInitDialog();
|
|
m_bWasOK = FALSE;
|
|
Init();
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(EDT_DialogSelectType, CDialog)
|
|
//{{AFX_MSG_MAP(EDT_DialogSelectType)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//// End Silviu Simen september 1998 List of Objects in Sectors
|
|
|
|
#endif // ACTIVE_EDITOR
|
|
|
|
|
|
//ENDROMTEAM StickObjects (Gabi Dumitrascu)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|