/** * Deletes the selected stage when the user selects the delete menu option. */ void StageView::OnDeleteStage() { CListCtrl &list = GetListCtrl(); POSITION pos = list.GetFirstSelectedItemPosition(); int nItem = -1; if( pos ) { nItem = list.GetNextSelectedItem( pos ); if( nItem > 0 ) { int result = MessageBox( "Are you sure you want to delete this stage?", "Delete?", MB_ICONQUESTION | MB_YESNO ); if( result == IDYES ) { MaterialDoc *material = materialDocManager->GetCurrentMaterialDoc(); material->RemoveStage( nItem - 1 ); } } } }
/** * Performs a paste operation when the user selects the menu option. */ void StageView::OnPaste() { if( materialDocManager->IsCopyStage() ) { MaterialDoc *material = materialDocManager->GetCurrentMaterialDoc(); int type; idStr name; materialDocManager->GetCopyStageInfo( type, name ); int existingIndex = material->FindStage( type, name ); if( type != MaterialDoc::STAGE_TYPE_SPECIALMAP || existingIndex == -1 ) { materialDocManager->PasteStage( material ); } else { if( MessageBox( va( "Do you want to replace '%s' stage?", name.c_str() ), "Replace?", MB_ICONQUESTION | MB_YESNO ) == IDYES ) { material->RemoveStage( existingIndex ); materialDocManager->PasteStage( material ); } } } }
/** * Performs an undo operation of an inserted stage. */ void StageInsertModifier::Undo() { MaterialDoc *material = manager->CreateMaterialDoc(materialName); material->RemoveStage(stageNum, false); }
/** * Performs a redo operation of a deleted stage. */ void StageDeleteModifier::Redo() { MaterialDoc *material = manager->CreateMaterialDoc(materialName); material->RemoveStage(stageNum, false); }