void NewCompCmd::Execute () { Editor* ed = GetEditor(); Component* orig = ed->GetComponent(); Component* comp = prototype_->Copy(); CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar"); ModifStatusVar* modifVar = (ModifStatusVar*)ed->GetState("ModifStatusVar"); if (OnlyOneEditorOf(orig) && !ReadyToClose(ed)) { return; } if (compNameVar != nil) compNameVar->SetComponent(comp); if (modifVar != nil) modifVar->SetComponent(comp); ed->SetComponent(comp); ed->Update(); if (orig != nil && unidraw->FindAny(orig) == nil) { Component* root = orig->GetRoot(); delete root; } }