void DialogAFConstraint::OnBnClickedButtonRenameconstraint() {
	int i;
	CString name, newName;
	DialogAFName nameDlg;

	if ( !file || !constraint ) {
		return;
	}

	i = m_comboConstraintList.GetCurSel();
	if ( i != CB_ERR ) {
		m_comboConstraintList.GetLBText( i, name );
		nameDlg.SetName( name );
		nameDlg.SetComboBox( &m_comboConstraintList );
		if ( nameDlg.DoModal() == IDOK ) {
			nameDlg.GetName( newName );
			// rename constraint;
			file->RenameConstraint( name, newName );
			m_comboConstraintList.DeleteString( i );
			m_comboConstraintList.SetCurSel( m_comboConstraintList.AddString( newName ) );
			LoadConstraint( newName );
			gameEdit->AF_UpdateEntities( file->GetName() );
			AFDialogSetFileModified();
		}
	}
}
Пример #2
0
void DialogAFBody::OnBnClickedButtonRenamebody() {
	int i;
	CString name, newName;
	DialogAFName nameDlg;
	if( !file || !body ) {
		return;
	}
	i = bodyList.GetCurSel();
	if( i != CB_ERR ) {
		bodyList.GetLBText( i, name );
		nameDlg.SetName( name );
		nameDlg.SetComboBox( &bodyList );
		if( nameDlg.DoModal() == IDOK ) {
			nameDlg.GetName( newName );
			// rename body
			file->RenameBody( name, newName );
			bodyList.DeleteString( i );
			bodyList.SetCurSel( bodyList.AddString( newName ) );
			LoadBody( newName );
			constraintDlg->LoadFile( file );
			gameEdit->AF_UpdateEntities( file->GetName() );
			AFDialogSetFileModified();
		}
	}
}
Пример #3
0
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();
}
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();
}
Пример #5
0
/*
================
DialogAF::OnBnClickedButtonAfNew
================
*/
void DialogAF::OnBnClickedButtonAfNew() {
	DialogAFName nameDlg;
	CString name;
	idStr fileName;
	nameDlg.SetComboBox( &AFList );
	if( nameDlg.DoModal() != IDOK ) {
		return;
	}
	nameDlg.GetName( name );
	CFileDialog dlgSave( FALSE, "map", NULL, OFN_OVERWRITEPROMPT, "AF Files (*.af)|*.af|All Files (*.*)|*.*||", AfxGetMainWnd() );
	if( dlgSave.DoModal() != IDOK ) {
		return;
	}
	fileName = fileSystem->OSPathToRelativePath( dlgSave.m_ofn.lpstrFile );
	// create a new .af file
	AFList.AddString( name );
	AFList.SetCurSel( AFList.FindString( -1, name ) );
	idDeclAF *decl = static_cast<idDeclAF *>( declManager->CreateNewDecl( DECL_AF, name, fileName ) );
	LoadFile( decl );
	AFDialogSetFileModified();
}