2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/rc/AFEditor_resource.h"
35 #include "DialogAFConstraint.h"
36 #include "DialogAFConstraintUniversal.h"
39 // DialogAFConstraintUniversal dialog
41 toolTip_t DialogAFConstraintUniversal::toolTips[] = {
42 { IDC_RADIO_ANCHOR_JOINT, "use the position of a joint for the anchor" },
43 { IDC_COMBO_ANCHOR_JOINT, "anchor joint name" },
44 { IDC_RADIO_ANCHOR_COORDINATES, "use absolute coordinates for the anchor" },
45 { IDC_EDIT_ANCHOR_X, "anchor x-coordinate" },
46 { IDC_EDIT_ANCHOR_Y, "anchor y-coordinate" },
47 { IDC_EDIT_ANCHOR_Z, "anchor z-coordinate" },
48 { IDC_RADIO_UNIVERSAL_BONE_SHAFT1, "use a bone for the first shaft" },
49 { IDC_RADIO_UNIVERSAL_ANGLES_SHAFT1, "use angles to set the orientation of the first shaft" },
50 { IDC_COMBO_UNIVERSAL_JOINT1_SHAFT1, "bone start joint" },
51 { IDC_COMBO_UNIVERSAL_JOINT2_SHAFT1, "bone end joint" },
52 { IDC_EDIT_UNIVERSAL_PITCH_SHAFT1, "pitch angle" },
53 { IDC_EDIT_UNIVERSAL_YAW_SHAFT1, "yaw angle" },
54 { IDC_RADIO_UNIVERSAL_BONE_SHAFT2, "use a bone for the second shaft" },
55 { IDC_RADIO_UNIVERSAL_ANGLES_SHAFT2, "use angles to set the orientation of the second shaft" },
56 { IDC_COMBO_UNIVERSAL_JOINT1_SHAFT2, "bone start joint" },
57 { IDC_COMBO_UNIVERSAL_JOINT2_SHAFT2, "bone end joint" },
58 { IDC_EDIT_UNIVERSAL_PITCH_SHAFT2, "pitch angle" },
59 { IDC_EDIT_UNIVERSAL_YAW_SHAFT2, "yaw angle" },
60 { IDC_RADIO_UNIVERSAL_LIMIT_NONE, "no joint limit" },
61 { IDC_RADIO_UNIVERSAL_LIMIT_CONE, "cone shaped joint limit" },
62 { IDC_RADIO_UNIVERSAL_LIMIT_PYRAMID, "pyramid shaped joint limit" },
63 { IDC_RADIO_UNIVERSAL_LIMIT_BONE, "use a bone for the limit orientation" },
64 { IDC_RADIO_UNIVERSAL_LIMIT_ANGLES, "use angles for the limit orientation" },
65 { IDC_COMBO_UNIVERSAL_LIMIT_JOINT1, "bone start joint" },
66 { IDC_COMBO_UNIVERSAL_LIMIT_JOINT2, "bone end joint" },
67 { IDC_EDIT_UNIVERSAL_LIMIT_PITCH, "pitch angle" },
68 { IDC_EDIT_UNIVERSAL_LIMIT_YAW, "yaw angle" },
69 { IDC_EDIT_UNIVERSAL_LIMIT_ROLL, "roll angle" },
70 { IDC_EDIT_UNIVERSAL_LIMIT_CONE_ANGLE, "cone angle" },
71 { IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE1, "first pyramid angle" },
72 { IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE2, "second pyramid angle" },
76 IMPLEMENT_DYNAMIC(DialogAFConstraintUniversal, CDialog)
80 DialogAFConstraintUniversal::DialogAFConstraintUniversal
83 DialogAFConstraintUniversal::DialogAFConstraintUniversal(CWnd* pParent /*=NULL*/)
84 : CDialog(DialogAFConstraintUniversal::IDD, pParent)
93 , m_pyramidAngle1(30.0f)
94 , m_pyramidAngle2(30.0f)
101 Create( IDD_DIALOG_AF_CONSTRAINT_UNIVERSAL, pParent );
102 EnableToolTips( TRUE );
107 DialogAFConstraintUniversal::~DialogAFConstraintUniversal
110 DialogAFConstraintUniversal::~DialogAFConstraintUniversal() {
115 DialogAFConstraintUniversal::DoDataExchange
118 void DialogAFConstraintUniversal::DoDataExchange(CDataExchange* pDX) {
119 CDialog::DoDataExchange(pDX);
120 //{{AFX_DATA_MAP(DialogAFConstraintUniversal)
121 DDX_Control(pDX, IDC_COMBO_ANCHOR_JOINT, m_comboAnchorJoint);
122 DDX_Text(pDX, IDC_EDIT_ANCHOR_X, m_anchor_x);
123 DDX_Text(pDX, IDC_EDIT_ANCHOR_Y, m_anchor_y);
124 DDX_Text(pDX, IDC_EDIT_ANCHOR_Z, m_anchor_z);
125 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_JOINT1_SHAFT1, m_comboJoint1Shaft1);
126 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_JOINT2_SHAFT1, m_comboJoint2Shaft1);
127 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_PITCH_SHAFT1, m_pitchShaft1);
128 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_YAW_SHAFT1, m_yawShaft1);
129 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_JOINT1_SHAFT2, m_comboJoint1Shaft2);
130 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_JOINT2_SHAFT2, m_comboJoint2Shaft2);
131 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_PITCH_SHAFT2, m_pitchShaft2);
132 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_YAW_SHAFT2, m_yawShaft2);
133 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_CONE_ANGLE, m_coneAngle);
134 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE1, m_pyramidAngle1);
135 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE2, m_pyramidAngle2);
136 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_LIMIT_JOINT1, m_comboLimitJoint1);
137 DDX_Control(pDX, IDC_COMBO_UNIVERSAL_LIMIT_JOINT2, m_comboLimitJoint2);
138 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_PITCH, m_limitPitch);
139 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_YAW, m_limitYaw);
140 DDX_Text(pDX, IDC_EDIT_UNIVERSAL_LIMIT_ROLL, m_limitRoll);
146 DialogAFConstraintUniversal::InitJointLists
149 void DialogAFConstraintUniversal::InitJointLists( void ) {
150 m_comboAnchorJoint.ResetContent();
151 m_comboJoint1Shaft1.ResetContent();
152 m_comboJoint2Shaft1.ResetContent();
153 m_comboJoint1Shaft2.ResetContent();
154 m_comboJoint2Shaft2.ResetContent();
155 m_comboLimitJoint1.ResetContent();
156 m_comboLimitJoint2.ResetContent();
162 const idRenderModel *model = gameEdit->ANIM_GetModelFromName( file->model );
167 int numJoints = model->NumJoints();
168 for ( int i = 0; i < numJoints; i++ ) {
169 const char *jointName = model->GetJointName( (jointHandle_t) i );
170 m_comboAnchorJoint.AddString( jointName );
171 m_comboJoint1Shaft1.AddString( jointName );
172 m_comboJoint2Shaft1.AddString( jointName );
173 m_comboJoint1Shaft2.AddString( jointName );
174 m_comboJoint2Shaft2.AddString( jointName );
175 m_comboLimitJoint1.AddString( jointName );
176 m_comboLimitJoint2.AddString( jointName );
182 DialogAFConstraintUniversal::LoadFile
185 void DialogAFConstraintUniversal::LoadFile( idDeclAF *af ) {
193 DialogAFConstraintUniversal::SaveFile
196 void DialogAFConstraintUniversal::SaveFile( void ) {
202 DialogAFConstraintUniversal::LoadConstraint
205 void DialogAFConstraintUniversal::LoadConstraint( idDeclAF_Constraint *c ) {
213 SetSafeComboBoxSelection( &m_comboAnchorJoint, constraint->anchor.joint1.c_str(), -1 );
214 m_anchor_x = constraint->anchor.ToVec3().x;
215 m_anchor_y = constraint->anchor.ToVec3().y;
216 m_anchor_z = constraint->anchor.ToVec3().z;
217 if ( constraint->anchor.type == idAFVector::VEC_JOINT ) {
218 i = IDC_RADIO_ANCHOR_JOINT;
221 i = IDC_RADIO_ANCHOR_COORDINATES;
223 CheckRadioButton( IDC_RADIO_ANCHOR_JOINT, IDC_RADIO_ANCHOR_COORDINATES, i );
226 s1 = SetSafeComboBoxSelection( &m_comboJoint1Shaft1, constraint->shaft[0].joint1.c_str(), -1 );
227 s2 = SetSafeComboBoxSelection( &m_comboJoint2Shaft1, constraint->shaft[0].joint2.c_str(), s1 );
228 angles = constraint->shaft[0].ToVec3().ToAngles();
229 m_pitchShaft1 = angles.pitch;
230 m_yawShaft1 = angles.yaw;
231 if ( constraint->shaft[0].type == idAFVector::VEC_BONEDIR ) {
232 i = IDC_RADIO_UNIVERSAL_BONE_SHAFT1;
235 i = IDC_RADIO_UNIVERSAL_ANGLES_SHAFT1;
236 constraint->shaft[0].type = idAFVector::VEC_COORDS;
238 CheckRadioButton( IDC_RADIO_UNIVERSAL_BONE_SHAFT1, IDC_RADIO_UNIVERSAL_ANGLES_SHAFT1, i );
241 s1 = SetSafeComboBoxSelection( &m_comboJoint1Shaft2, constraint->shaft[1].joint1.c_str(), -1 );
242 s2 = SetSafeComboBoxSelection( &m_comboJoint2Shaft2, constraint->shaft[1].joint2.c_str(), s1 );
243 angles = constraint->shaft[1].ToVec3().ToAngles();
244 m_pitchShaft2 = angles.pitch;
245 m_yawShaft2 = angles.yaw;
246 if ( constraint->shaft[1].type == idAFVector::VEC_BONEDIR ) {
247 i = IDC_RADIO_UNIVERSAL_BONE_SHAFT2;
250 i = IDC_RADIO_UNIVERSAL_ANGLES_SHAFT2;
251 constraint->shaft[1].type = idAFVector::VEC_COORDS;
253 CheckRadioButton( IDC_RADIO_UNIVERSAL_BONE_SHAFT2, IDC_RADIO_UNIVERSAL_ANGLES_SHAFT2, i );
256 if ( constraint->limit == idDeclAF_Constraint::LIMIT_CONE ) {
257 i = IDC_RADIO_UNIVERSAL_LIMIT_CONE;
259 else if ( constraint->limit == idDeclAF_Constraint::LIMIT_PYRAMID ) {
260 i = IDC_RADIO_UNIVERSAL_LIMIT_PYRAMID;
263 i = IDC_RADIO_UNIVERSAL_LIMIT_NONE;
265 CheckRadioButton( IDC_RADIO_UNIVERSAL_LIMIT_NONE, IDC_RADIO_UNIVERSAL_LIMIT_PYRAMID, i );
267 m_coneAngle = constraint->limitAngles[0];
268 m_pyramidAngle1 = constraint->limitAngles[0];
269 m_pyramidAngle2 = constraint->limitAngles[1];
270 m_limitRoll = constraint->limitAngles[2];
271 angles = constraint->limitAxis.ToVec3().ToAngles();
272 m_limitPitch = angles.pitch;
273 m_limitYaw = angles.yaw;
275 if ( constraint->limitAxis.type == idAFVector::VEC_BONEDIR ) {
276 i = IDC_RADIO_UNIVERSAL_LIMIT_BONE;
279 i = IDC_RADIO_UNIVERSAL_LIMIT_ANGLES;
281 CheckRadioButton( IDC_RADIO_UNIVERSAL_LIMIT_BONE, IDC_RADIO_UNIVERSAL_LIMIT_ANGLES, i );
282 s1 = SetSafeComboBoxSelection( &m_comboLimitJoint1, constraint->limitAxis.joint1.c_str(), -1 );
283 s2 = SetSafeComboBoxSelection( &m_comboLimitJoint2, constraint->limitAxis.joint2.c_str(), s1 );
285 // update displayed values
291 DialogAFConstraintUniversal::SaveConstraint
294 void DialogAFConstraintUniversal::SaveConstraint( void ) {
300 if ( !file || !constraint ) {
306 GetSafeComboBoxSelection( &m_comboAnchorJoint, str, -1 );
307 constraint->anchor.joint1 = str;
308 constraint->anchor.ToVec3().x = m_anchor_x;
309 constraint->anchor.ToVec3().y = m_anchor_y;
310 constraint->anchor.ToVec3().z = m_anchor_z;
313 if ( constraint->shaft[0].type == idAFVector::VEC_BONEDIR ) {
314 s1 = GetSafeComboBoxSelection( &m_comboJoint1Shaft1, str, -1 );
315 constraint->shaft[0].joint1 = str;
316 s2 = GetSafeComboBoxSelection( &m_comboJoint2Shaft1, str, s1 );
317 constraint->shaft[0].joint2 = str;
320 constraint->shaft[0].ToVec3() = idAngles( m_pitchShaft1, m_yawShaft1, 0.0f ).ToForward();
324 if ( constraint->shaft[1].type == idAFVector::VEC_BONEDIR ) {
325 s1 = GetSafeComboBoxSelection( &m_comboJoint1Shaft2, str, -1 );
326 constraint->shaft[1].joint1 = str;
327 s2 = GetSafeComboBoxSelection( &m_comboJoint2Shaft2, str, s1 );
328 constraint->shaft[1].joint2 = str;
331 constraint->shaft[1].ToVec3() = idAngles( m_pitchShaft2, m_yawShaft2, 0.0f ).ToForward();
335 if ( constraint->limit == idDeclAF_Constraint::LIMIT_CONE ) {
336 constraint->limitAngles[0] = m_coneAngle;
339 constraint->limitAngles[0] = m_pyramidAngle1;
341 constraint->limitAngles[1] = m_pyramidAngle2;
342 constraint->limitAngles[2] = m_limitRoll;
343 angles.pitch = m_limitPitch;
344 angles.yaw = m_limitYaw;
346 constraint->limitAxis.ToVec3() = angles.ToForward();
347 s1 = GetSafeComboBoxSelection( &m_comboLimitJoint1, str, -1 );
348 constraint->limitAxis.joint1 = str;
349 s2 = GetSafeComboBoxSelection( &m_comboLimitJoint2, str, s1 );
350 constraint->limitAxis.joint2 = str;
352 AFDialogSetFileModified();
357 DialogAFConstraintUniversal::UpdateFile
360 void DialogAFConstraintUniversal::UpdateFile( void ) {
363 gameEdit->AF_UpdateEntities( file->GetName() );
369 DialogAFConstraintUniversal::OnToolHitTest
372 int DialogAFConstraintUniversal::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const {
373 CDialog::OnToolHitTest( point, pTI );
374 return DefaultOnToolHitTest( toolTips, this, point, pTI );
378 BEGIN_MESSAGE_MAP(DialogAFConstraintUniversal, CDialog)
379 ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
380 ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
381 ON_BN_CLICKED(IDC_RADIO_ANCHOR_JOINT, OnBnClickedRadioAnchorJoint)
382 ON_BN_CLICKED(IDC_RADIO_ANCHOR_COORDINATES, OnBnClickedRadioAnchorCoordinates)
383 ON_CBN_SELCHANGE(IDC_COMBO_ANCHOR_JOINT, OnCbnSelchangeComboAnchorJoint)
384 ON_EN_CHANGE(IDC_EDIT_ANCHOR_X, OnEnChangeEditAnchorX)
385 ON_EN_CHANGE(IDC_EDIT_ANCHOR_Y, OnEnChangeEditAnchorY)
386 ON_EN_CHANGE(IDC_EDIT_ANCHOR_Z, OnEnChangeEditAnchorZ)
387 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ANCHOR_X, OnDeltaposSpinAnchorX)
388 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ANCHOR_Y, OnDeltaposSpinAnchorY)
389 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ANCHOR_Z, OnDeltaposSpinAnchorZ)
390 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_BONE_SHAFT1, OnBnClickedRadioUniversalBoneShaft1)
391 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_ANGLES_SHAFT1, OnBnClickedRadioUniversalAnglesShaft1)
392 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_JOINT1_SHAFT1, OnCbnSelchangeComboUniversalJoint1Shaft1)
393 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_JOINT2_SHAFT1, OnCbnSelchangeComboUniversalJoint2Shaft1)
394 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_PITCH_SHAFT1, OnEnChangeEditUniversalPitchShaft1)
395 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_PITCH_SHAFT1, OnDeltaposSpinUniversalPitchShaft1)
396 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_YAW_SHAFT1, OnEnChangeEditUniversalYawShaft1)
397 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_YAW_SHAFT1, OnDeltaposSpinUniversalYawShaft1)
398 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_BONE_SHAFT2, OnBnClickedRadioUniversalBoneShaft2)
399 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_ANGLES_SHAFT2, OnBnClickedRadioUniversalAnglesShaft2)
400 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_JOINT1_SHAFT2, OnCbnSelchangeComboUniversalJoint1Shaft2)
401 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_JOINT2_SHAFT2, OnCbnSelchangeComboUniversalJoint2Shaft2)
402 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_PITCH_SHAFT2, OnEnChangeEditUniversalPitchShaft2)
403 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_PITCH_SHAFT2, OnDeltaposSpinUniversalPitchShaft2)
404 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_YAW_SHAFT2, OnEnChangeEditUniversalYawShaft2)
405 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_YAW_SHAFT2, OnDeltaposSpinUniversalYawShaft2)
406 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_LIMIT_NONE, OnBnClickedRadioUniversalLimitNone)
407 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_LIMIT_CONE, OnBnClickedRadioUniversalLimitCone)
408 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_LIMIT_PYRAMID, OnBnClickedRadioUniversalLimitPyramid)
409 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_CONE_ANGLE, OnEnChangeEditUniversalLimitConeAngle)
410 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_CONE_ANGLE, OnDeltaposSpinUniversalLimitConeAngle)
411 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE1, OnEnChangeEditUniversalLimitPyramidAngle1)
412 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_PYRAMID_ANGLE1, OnDeltaposSpinUniversalLimitPyramidAngle1)
413 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE2, OnEnChangeEditUniversalLimitPyramidAngle2)
414 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_PYRAMID_ANGLE2, OnDeltaposSpinUniversalLimitPyramidAngle2)
415 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_ROLL, OnEnChangeEditUniversalLimitRoll)
416 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_ROLL, OnDeltaposSpinUniversalLimitRoll)
417 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_LIMIT_BONE, OnBnClickedRadioUniversalLimitBone)
418 ON_BN_CLICKED(IDC_RADIO_UNIVERSAL_LIMIT_ANGLES, OnBnClickedRadioUniversalLimitAngles)
419 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_LIMIT_JOINT1, OnCbnSelchangeComboUniversalLimitJoint1)
420 ON_CBN_SELCHANGE(IDC_COMBO_UNIVERSAL_LIMIT_JOINT2, OnCbnSelchangeComboUniversalLimitJoint2)
421 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_PITCH, OnEnChangeEditUniversalLimitPitch)
422 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_PITCH, OnDeltaposSpinUniversalLimitPitch)
423 ON_EN_CHANGE(IDC_EDIT_UNIVERSAL_LIMIT_YAW, OnEnChangeEditUniversalLimitYaw)
424 ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_UNIVERSAL_LIMIT_YAW, OnDeltaposSpinUniversalLimitYaw)
428 // DialogAFConstraintUniversal message handlers
430 BOOL DialogAFConstraintUniversal::OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult ) {
431 return DefaultOnToolTipNotify( toolTips, id, pNMHDR, pResult );
434 void DialogAFConstraintUniversal::OnBnClickedRadioAnchorJoint() {
435 if ( IsDlgButtonChecked( IDC_RADIO_ANCHOR_JOINT ) ) {
437 constraint->anchor.type = idAFVector::VEC_JOINT;
443 void DialogAFConstraintUniversal::OnBnClickedRadioAnchorCoordinates() {
444 if ( IsDlgButtonChecked( IDC_RADIO_ANCHOR_COORDINATES ) ) {
446 constraint->anchor.type = idAFVector::VEC_COORDS;
452 void DialogAFConstraintUniversal::OnCbnSelchangeComboAnchorJoint() {
456 void DialogAFConstraintUniversal::OnEnChangeEditAnchorX() {
457 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_X ) ) ) {
461 m_anchor_x = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_X ) );
465 void DialogAFConstraintUniversal::OnEnChangeEditAnchorY() {
466 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_Y ) ) ) {
470 m_anchor_y = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_Y ) );
474 void DialogAFConstraintUniversal::OnEnChangeEditAnchorZ() {
475 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_Z ) ) ) {
479 m_anchor_z = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_ANCHOR_Z ) );
483 void DialogAFConstraintUniversal::OnDeltaposSpinAnchorX(NMHDR *pNMHDR, LRESULT *pResult) {
484 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
485 if ( pNMUpDown->iDelta < 0 ) {
496 void DialogAFConstraintUniversal::OnDeltaposSpinAnchorY(NMHDR *pNMHDR, LRESULT *pResult) {
497 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
498 if ( pNMUpDown->iDelta < 0 ) {
509 void DialogAFConstraintUniversal::OnDeltaposSpinAnchorZ(NMHDR *pNMHDR, LRESULT *pResult) {
510 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
511 if ( pNMUpDown->iDelta < 0 ) {
522 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalBoneShaft1() {
523 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_BONE_SHAFT1 ) ) {
525 constraint->shaft[0].type = idAFVector::VEC_BONEDIR;
531 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalAnglesShaft1() {
532 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_ANGLES_SHAFT1 ) ) {
534 constraint->shaft[0].type = idAFVector::VEC_COORDS;
540 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalJoint1Shaft1() {
542 GetSafeComboBoxSelection( &m_comboJoint1Shaft1, str, -1 );
543 UnsetSafeComboBoxSelection( &m_comboJoint2Shaft1, str );
547 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalJoint2Shaft1() {
549 GetSafeComboBoxSelection( &m_comboJoint2Shaft1, str, -1 );
550 UnsetSafeComboBoxSelection( &m_comboJoint1Shaft1, str );
554 void DialogAFConstraintUniversal::OnEnChangeEditUniversalPitchShaft1() {
555 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_PITCH_SHAFT1 ) ) ) {
559 m_pitchShaft1 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_PITCH_SHAFT1 ) );
563 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalPitchShaft1(NMHDR *pNMHDR, LRESULT *pResult) {
564 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
565 if ( pNMUpDown->iDelta < 0 ) {
566 m_pitchShaft1 += 1.0f;
569 m_pitchShaft1 -= 1.0f;
576 void DialogAFConstraintUniversal::OnEnChangeEditUniversalYawShaft1() {
577 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_YAW_SHAFT1 ) ) ) {
581 m_yawShaft1 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_YAW_SHAFT1 ) );
585 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalYawShaft1(NMHDR *pNMHDR, LRESULT *pResult) {
586 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
587 if ( pNMUpDown->iDelta < 0 ) {
598 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalBoneShaft2() {
599 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_BONE_SHAFT2 ) ) {
601 constraint->shaft[1].type = idAFVector::VEC_BONEDIR;
607 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalAnglesShaft2() {
608 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_ANGLES_SHAFT2 ) ) {
610 constraint->shaft[1].type = idAFVector::VEC_COORDS;
616 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalJoint1Shaft2() {
618 GetSafeComboBoxSelection( &m_comboJoint1Shaft2, str, -1 );
619 UnsetSafeComboBoxSelection( &m_comboJoint2Shaft2, str );
623 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalJoint2Shaft2() {
625 GetSafeComboBoxSelection( &m_comboJoint2Shaft2, str, -1 );
626 UnsetSafeComboBoxSelection( &m_comboJoint1Shaft2, str );
630 void DialogAFConstraintUniversal::OnEnChangeEditUniversalPitchShaft2() {
631 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_PITCH_SHAFT2 ) ) ) {
635 m_pitchShaft2 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_PITCH_SHAFT2 ) );
639 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalPitchShaft2(NMHDR *pNMHDR, LRESULT *pResult) {
640 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
641 if ( pNMUpDown->iDelta < 0 ) {
642 m_pitchShaft2 += 1.0f;
645 m_pitchShaft2 -= 1.0f;
652 void DialogAFConstraintUniversal::OnEnChangeEditUniversalYawShaft2() {
653 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_YAW_SHAFT2 ) ) ) {
657 m_yawShaft2 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_YAW_SHAFT2 ) );
661 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalYawShaft2(NMHDR *pNMHDR, LRESULT *pResult) {
662 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
663 if ( pNMUpDown->iDelta < 0 ) {
674 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalLimitNone() {
675 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_LIMIT_NONE ) ) {
677 constraint->limit = idDeclAF_Constraint::LIMIT_NONE;
683 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalLimitCone() {
684 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_LIMIT_CONE ) ) {
686 constraint->limit = idDeclAF_Constraint::LIMIT_CONE;
692 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalLimitPyramid() {
693 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_LIMIT_PYRAMID ) ) {
695 constraint->limit = idDeclAF_Constraint::LIMIT_PYRAMID;
701 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitConeAngle() {
702 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_CONE_ANGLE ) ) ) {
706 m_coneAngle = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_CONE_ANGLE ), false );
710 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitConeAngle(NMHDR *pNMHDR, LRESULT *pResult) {
711 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
712 if ( pNMUpDown->iDelta < 0 ) {
715 else if ( m_coneAngle > 0.0f ) {
723 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitPyramidAngle1() {
724 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE1 ) ) ) {
728 m_pyramidAngle1 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE1 ), false );
732 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitPyramidAngle1(NMHDR *pNMHDR, LRESULT *pResult) {
733 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
734 if ( pNMUpDown->iDelta < 0 ) {
735 m_pyramidAngle1 += 1.0f;
737 else if ( m_pyramidAngle1 > 0.0f ) {
738 m_pyramidAngle1 -= 1.0f;
745 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitPyramidAngle2() {
746 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE2 ) ) ) {
750 m_pyramidAngle2 = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PYRAMID_ANGLE2 ), false );
754 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitPyramidAngle2(NMHDR *pNMHDR, LRESULT *pResult) {
755 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
756 if ( pNMUpDown->iDelta < 0 ) {
757 m_pyramidAngle2 += 1.0f;
759 else if ( m_pyramidAngle2 > 0.0f ) {
760 m_pyramidAngle2 -= 1.0f;
767 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitRoll() {
768 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_ROLL ) ) ) {
772 m_limitRoll = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_ROLL ) );
776 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitRoll(NMHDR *pNMHDR, LRESULT *pResult) {
777 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
778 if ( pNMUpDown->iDelta < 0 ) {
789 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalLimitBone() {
790 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_LIMIT_BONE ) ) {
792 constraint->limitAxis.type = idAFVector::VEC_BONEDIR;
798 void DialogAFConstraintUniversal::OnBnClickedRadioUniversalLimitAngles() {
799 if ( IsDlgButtonChecked( IDC_RADIO_UNIVERSAL_LIMIT_ANGLES ) ) {
801 constraint->limitAxis.type = idAFVector::VEC_COORDS;
807 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalLimitJoint1() {
809 GetSafeComboBoxSelection( &m_comboLimitJoint1, str, -1 );
810 UnsetSafeComboBoxSelection( &m_comboLimitJoint2, str );
814 void DialogAFConstraintUniversal::OnCbnSelchangeComboUniversalLimitJoint2() {
816 GetSafeComboBoxSelection( &m_comboLimitJoint2, str, -1 );
817 UnsetSafeComboBoxSelection( &m_comboLimitJoint1, str );
821 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitPitch() {
822 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PITCH ) ) ) {
826 m_limitPitch = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_PITCH ) );
830 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitPitch(NMHDR *pNMHDR, LRESULT *pResult) {
831 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
832 if ( pNMUpDown->iDelta < 0 ) {
833 m_limitPitch += 1.0f;
836 m_limitPitch -= 1.0f;
843 void DialogAFConstraintUniversal::OnEnChangeEditUniversalLimitYaw() {
844 if ( EditControlEnterHit( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_YAW ) ) ) {
848 m_limitYaw = EditVerifyFloat( (CEdit *) GetDlgItem( IDC_EDIT_UNIVERSAL_LIMIT_YAW ) );
852 void DialogAFConstraintUniversal::OnDeltaposSpinUniversalLimitYaw(NMHDR *pNMHDR, LRESULT *pResult) {
853 LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
854 if ( pNMUpDown->iDelta < 0 ) {