Moved unsetEdit() to ViewProvider to avoid code duplication in all feature ViewProviders
This commit is contained in:
committed by
Stefan Tröger
parent
ba17aa2839
commit
bc7dff7339
@@ -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() &&
|
||||
|
||||
Reference in New Issue
Block a user