Moved unsetEdit() to ViewProvider to avoid code duplication in all feature ViewProviders

This commit is contained in:
jrheinlaender
2013-05-10 15:32:13 +04:30
committed by Stefan Tröger
parent ba17aa2839
commit bc7dff7339
16 changed files with 25 additions and 106 deletions

View File

@@ -31,6 +31,7 @@
#include <Mod/PartDesign/App/Body.h>
#include <Mod/Part/App/PropertyTopoShape.h>
#include <Gui/Command.h>
#include <Gui/Control.h>
#include <Gui/Application.h>
#include <Base/Exception.h>
@@ -60,6 +61,27 @@ bool ViewProvider::doubleClicked(void)
return true;
}
void ViewProvider::unsetEdit(int ModNum)
{
// return to the WB we were in before editing the PartDesign feature
Gui::Command::assureWorkbench(oldWb.c_str());
if (ModNum == ViewProvider::Default) {
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();
if ((PartDesignGui::ActivePartObject != NULL) && (oldTip != NULL)) {
Gui::Selection().clearSelection();
Gui::Selection().addSelection(oldTip->getDocument()->getName(), oldTip->getNameInDocument());
Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')");
}
oldTip = NULL;
}
else {
PartGui::ViewProviderPart::unsetEdit(ModNum);
oldTip = NULL;
}
}
void ViewProvider::updateData(const App::Property* prop)
{
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId() &&