Changing active object handling in PartDesign

This commit is contained in:
jriegel
2015-01-06 22:45:01 +01:00
committed by Stefan Tröger
parent 775744c1ac
commit 45f7c99c1c
24 changed files with 255 additions and 169 deletions

View File

@@ -60,6 +60,7 @@
#include <Gui/Control.h>
#include <Gui/Command.h>
#include <Gui/Application.h>
#include <Gui/MDIView.h>
#include <Mod/PartDesign/App/Body.h>
using namespace PartDesignGui;
@@ -275,10 +276,11 @@ bool ViewProviderDatum::doubleClicked(void)
std::string Msg("Edit ");
Msg += this->pcObject->Label.getValue();
Gui::Command::openCommand(Msg.c_str());
if (PartDesignGui::ActivePartObject != NULL) {
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
if (activeBody != NULL) {
// Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree
// Also, this way the user won't be tempted to use future geometry as external references for the sketch
oldTip = ActivePartObject->Tip.getValue();
oldTip = activeBody->Tip.getValue();
if (oldTip != this->pcObject)
Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')");
else
@@ -299,8 +301,9 @@ void ViewProviderDatum::unsetEdit(int ModNum)
if (ModNum == ViewProvider::Default) {
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
if ((PartDesignGui::ActivePartObject != NULL) && (oldTip != NULL)) {
if ((activeBody != NULL) && (oldTip != NULL)) {
Gui::Selection().clearSelection();
Gui::Selection().addSelection(oldTip->getDocument()->getName(), oldTip->getNameInDocument());
Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')");