Drop into insert mode when user double-clicks on a PartDesign feature in the Tree
This commit is contained in:
parent
bc7dff7339
commit
3b95517a70
|
@ -199,6 +199,9 @@ void CmdPartDesignMoveTip::activated(int iMsg)
|
|||
prevSolidFeature = pcActiveBody->getPrevSolidFeature();
|
||||
if ((prevSolidFeature != NULL) && !PartDesign::Body::isSolidFeature(selFeature))
|
||||
doCommand(Gui,"Gui.activeDocument().show(\"%s\")", prevSolidFeature->getNameInDocument());
|
||||
|
||||
// TOOD: Hide all datum features after the Tip feature? But the user might have already hidden some and wants to see
|
||||
// others, so we would have to remember their state somehow
|
||||
}
|
||||
|
||||
bool CmdPartDesignMoveTip::isActive(void)
|
||||
|
|
|
@ -41,6 +41,8 @@ PROPERTY_SOURCE(PartDesignGui::ViewProvider,PartGui::ViewProviderPart)
|
|||
|
||||
ViewProvider::ViewProvider()
|
||||
{
|
||||
oldWb = "";
|
||||
oldTip = NULL;
|
||||
}
|
||||
|
||||
ViewProvider::~ViewProvider()
|
||||
|
@ -52,6 +54,15 @@ bool ViewProvider::doubleClicked(void)
|
|||
std::string Msg("Edit ");
|
||||
Msg += this->pcObject->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
if (PartDesignGui::ActivePartObject != 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();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')");
|
||||
} else {
|
||||
oldTip = NULL;
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s',0)",this->pcObject->getNameInDocument());
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ protected:
|
|||
virtual void unsetEdit(int ModNum);
|
||||
|
||||
std::string oldWb;
|
||||
App::DocumentObject* oldTip;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ ViewProviderDatum::ViewProviderDatum()
|
|||
{
|
||||
pShapeSep = new SoSeparator();
|
||||
pShapeSep->ref();
|
||||
|
||||
oldWb = "";
|
||||
oldTip = NULL;
|
||||
}
|
||||
|
||||
ViewProviderDatum::~ViewProviderDatum()
|
||||
|
@ -253,6 +256,24 @@ bool ViewProviderDatum::setEdit(int ModNum)
|
|||
}
|
||||
}
|
||||
|
||||
bool ViewProviderDatum::doubleClicked(void)
|
||||
{
|
||||
std::string Msg("Edit ");
|
||||
Msg += this->pcObject->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
if (PartDesignGui::ActivePartObject != 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();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')");
|
||||
} else {
|
||||
oldTip = NULL;
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s',0)",this->pcObject->getNameInDocument());
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderDatum::unsetEdit(int ModNum)
|
||||
{
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
|
@ -261,6 +282,15 @@ void ViewProviderDatum::unsetEdit(int ModNum)
|
|||
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 {
|
||||
oldTip = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Gui::ViewProviderGeometryObject::unsetEdit(ModNum);
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
virtual void attach(App::DocumentObject *);
|
||||
virtual bool onDelete(const std::vector<std::string> &);
|
||||
virtual void updateData(const App::Property* prop) { Gui::ViewProviderGeometryObject::updateData(prop); }
|
||||
virtual bool doubleClicked(void);
|
||||
std::vector<std::string> getDisplayModes(void) const;
|
||||
void setDisplayMode(const char* ModeName);
|
||||
|
||||
|
@ -66,6 +67,7 @@ protected:
|
|||
protected:
|
||||
SoSeparator* pShapeSep;
|
||||
std::string oldWb;
|
||||
App::DocumentObject* oldTip;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
# include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "ViewProviderTransformed.h"
|
||||
#include "TaskTransformedParameters.h"
|
||||
#include <Base/Console.h>
|
||||
|
@ -136,7 +137,15 @@ void ViewProviderTransformed::unsetEdit(int ModNum)
|
|||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
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 {
|
||||
oldTip = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PartGui::ViewProviderPart::unsetEdit(ModNum);
|
||||
|
|
Loading…
Reference in New Issue
Block a user