/* ================ DialogAFConstraint::OnInitDialog ================ */ BOOL DialogAFConstraint::OnInitDialog() { CDialog::OnInitDialog(); // initialize the constraint types m_comboConstraintType.ResetContent(); for ( int i = 0; constraintTypes[i].name; i++ ) { m_comboConstraintType.AddString( constraintTypes[i].name ); } fixedDlg = new DialogAFConstraintFixed( this ); fixedDlg->ShowWindow( SW_HIDE ); ballAndSocketDlg = new DialogAFConstraintBallAndSocket( this ); ballAndSocketDlg->ShowWindow( SW_HIDE ); universalDlg = new DialogAFConstraintUniversal( this ); universalDlg->ShowWindow( SW_HIDE ); hingeDlg = new DialogAFConstraintHinge( this ); hingeDlg->ShowWindow( SW_HIDE ); sliderDlg = new DialogAFConstraintSlider( this ); sliderDlg->ShowWindow( SW_HIDE ); springDlg = new DialogAFConstraintSpring( this ); springDlg->ShowWindow( SW_HIDE ); constraintDlg = NULL; InitNewRenameDeleteButtons(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/* ================ DialogAFBody::LoadFile ================ */ void DialogAFBody::LoadFile( idDeclAF *af ) { file = af; body = NULL; InitJointLists(); InitBodyList(); InitNewRenameDeleteButtons(); }
void DialogAFBody::OnBnClickedButtonNewbody() { DialogAFName nameDlg; CString str; INT_PTR res; // the names 'origin' and 'world' are reserved for constraints bound to the world bodyList.AddString( "origin" ); bodyList.AddString( "world" ); nameDlg.SetComboBox( &bodyList ); res = nameDlg.DoModal(); bodyList.DeleteString( bodyList.FindString( -1, "origin" ) ); bodyList.DeleteString( bodyList.FindString( -1, "world" ) ); if ( res == IDOK ) { nameDlg.GetName( str ); // create new body file->NewBody( str ); bodyList.SetCurSel( bodyList.AddString( str ) ); LoadBody( str ); constraintDlg->LoadFile( file ); gameEdit->AF_UpdateEntities( file->GetName() ); AFDialogSetFileModified(); } InitNewRenameDeleteButtons(); }
/* ================ DialogAFConstraint::LoadFile ================ */ void DialogAFConstraint::LoadFile( idDeclAF *af ) { file = af; constraint = NULL; ballAndSocketDlg->LoadFile( af ); universalDlg->LoadFile( af ); hingeDlg->LoadFile( af ); sliderDlg->LoadFile( af ); springDlg->LoadFile( af ); InitBodyLists(); InitConstraintList(); InitNewRenameDeleteButtons(); }
/* ================ DialogAFBody::OnInitDialog ================ */ BOOL DialogAFBody::OnInitDialog() { CDialog::OnInitDialog(); // initialize the collision model types cm_comboType.ResetContent(); for( int i = 0; modelTypes[i].name; i++ ) { if( modelTypes[i].type == TRM_INVALID || modelTypes[i].type == TRM_CUSTOM ) { continue; } cm_comboType.AddString( modelTypes[i].name ); } InitNewRenameDeleteButtons(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void DialogAFConstraint::OnBnClickedButtonNewconstraint() { DialogAFName nameDlg; CString str; nameDlg.SetComboBox( &m_comboConstraintList ); if ( nameDlg.DoModal() == IDOK ) { nameDlg.GetName( str ); // create new constraint file->NewConstraint( str ); m_comboConstraintList.SetCurSel( m_comboConstraintList.AddString( str ) ); LoadConstraint( str ); gameEdit->AF_UpdateEntities( file->GetName() ); AFDialogSetFileModified(); } InitNewRenameDeleteButtons(); }
void DialogAFBody::OnBnClickedButtonDeletebody() { int i; CString str; if( !file || !body ) { return; } i = bodyList.GetCurSel(); if( i != CB_ERR ) { if( MessageBox( "Are you sure you want to delete this body and all attached constraints ?", "Delete Body", MB_YESNO | MB_ICONQUESTION ) == IDYES ) { bodyList.GetLBText( i, str ); // delete currently selected body file->DeleteBody( str ); bodyList.DeleteString( i ); body = NULL; OnCbnSelchangeComboBodies(); constraintDlg->LoadFile( file ); gameEdit->AF_UpdateEntities( file->GetName() ); AFDialogSetFileModified(); } } InitNewRenameDeleteButtons(); }
void DialogAFConstraint::OnBnClickedButtonDeleteconstraint() { int i; CString str; if ( !file || !constraint ) { return; } i = m_comboConstraintList.GetCurSel(); if ( i != CB_ERR ) { if ( MessageBox( "Are you sure you want to delete this constraint ?", "Delete Constraint", MB_YESNO | MB_ICONQUESTION ) == IDYES ) { m_comboConstraintList.GetLBText( i, str ); // delete current constraint file->DeleteConstraint( str ); constraint = NULL; m_comboConstraintList.DeleteString( i ); OnCbnSelchangeComboConstraints(); gameEdit->AF_UpdateEntities( file->GetName() ); AFDialogSetFileModified(); } } InitNewRenameDeleteButtons(); }