Switch to PartDesign workbench as soon as a PartDesign feature is edited

This commit is contained in:
jrheinlaender 2013-04-25 13:49:56 +04:30 committed by Stefan Tröger
parent ce224298a7
commit 8682b5f490
15 changed files with 71 additions and 33 deletions

View File

@ -43,6 +43,9 @@ public:
void updateData(const App::Property*);
virtual bool onDelete(const std::vector<std::string> &);
protected:
std::string oldWb;
};

View File

@ -85,8 +85,9 @@ bool ViewProviderChamfer::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if(ModNum == 1)
// Gui::Command::openCommand("Change chamfer parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
@ -103,10 +104,10 @@ bool ViewProviderChamfer::setEdit(int ModNum)
void ViewProviderChamfer::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -85,8 +85,9 @@ bool ViewProviderDraft::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if(ModNum == 1)
// Gui::Command::openCommand("Change draft parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (draftDlg)
@ -103,10 +104,10 @@ bool ViewProviderDraft::setEdit(int ModNum)
void ViewProviderDraft::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
// and update the draft
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -85,8 +85,9 @@ bool ViewProviderFillet::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if(ModNum == 1)
// Gui::Command::openCommand("Change fillet parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
@ -103,10 +104,10 @@ bool ViewProviderFillet::setEdit(int ModNum)
void ViewProviderFillet::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -102,8 +102,9 @@ bool ViewProviderGroove::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if (ModNum == 1)
// Gui::Command::openCommand("Change Groove parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
@ -120,10 +121,10 @@ bool ViewProviderGroove::setEdit(int ModNum)
void ViewProviderGroove::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -46,6 +46,9 @@ bool ViewProviderLinearPattern::setEdit(int ModNum)
TaskDlgLinearPatternParameters *linearpatternDlg = NULL;
if (checkDlgOpen(linearpatternDlg)) {
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (linearpatternDlg)
Gui::Control().showDialog(linearpatternDlg);

View File

@ -46,6 +46,9 @@ bool ViewProviderMirrored::setEdit(int ModNum)
TaskDlgMirroredParameters *mirroredDlg = NULL;
if (checkDlgOpen(mirroredDlg)) {
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (mirroredDlg)
Gui::Control().showDialog(mirroredDlg);

View File

@ -46,6 +46,9 @@ bool ViewProviderMultiTransform::setEdit(int ModNum)
TaskDlgMultiTransformParameters *multitransformDlg = NULL;
if (checkDlgOpen(multitransformDlg)) {
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (multitransformDlg)
Gui::Control().showDialog(multitransformDlg);

View File

@ -100,6 +100,9 @@ bool ViewProviderPad::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
Gui::Control().showDialog(padDlg);
@ -115,10 +118,10 @@ bool ViewProviderPad::setEdit(int ModNum)
void ViewProviderPad::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -92,8 +92,9 @@ bool ViewProviderPocket::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if(ModNum == ViewProvider::Default)
// Gui::Command::openCommand("Change pocket parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
@ -110,10 +111,10 @@ bool ViewProviderPocket::setEdit(int ModNum)
void ViewProviderPocket::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -46,6 +46,9 @@ bool ViewProviderPolarPattern::setEdit(int ModNum)
TaskDlgPolarPatternParameters *polarpatternDlg = NULL;
if (checkDlgOpen(polarpatternDlg)) {
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (polarpatternDlg)
Gui::Control().showDialog(polarpatternDlg);

View File

@ -102,8 +102,9 @@ bool ViewProviderRevolution::setEdit(int ModNum)
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if (ModNum == 1)
// Gui::Command::openCommand("Change revolution parameters");
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (padDlg)
@ -120,10 +121,10 @@ bool ViewProviderRevolution::setEdit(int ModNum)
void ViewProviderRevolution::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// and update the pad
//getSketchObject()->getDocument()->recompute();
// 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();
}

View File

@ -46,6 +46,9 @@ bool ViewProviderScaled::setEdit(int ModNum)
TaskDlgScaledParameters *scaledDlg = NULL;
if (checkDlgOpen(scaledDlg)) {
// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
// start the edit dialog
if (scaledDlg)
Gui::Control().showDialog(scaledDlg);

View File

@ -51,6 +51,7 @@
#include "TaskTransformedParameters.h"
#include <Base/Console.h>
#include <Gui/Control.h>
#include <Gui/Command.h>
#include <Gui/Application.h>
#include <Mod/Part/App/TopoShape.h>
#include <Mod/PartDesign/App/FeatureAdditive.h>
@ -129,6 +130,9 @@ bool ViewProviderTransformed::setEdit(int ModNum)
void ViewProviderTransformed::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();

View File

@ -37,6 +37,7 @@
#include <Gui/Command.h>
#include <Gui/Selection.h>
#include <Gui/ToolBoxManager.h>
#include <Gui/MainWindow.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Base/Console.h>
@ -58,6 +59,12 @@ StartGui::Workbench::~Workbench()
void StartGui::Workbench::activated()
{
// Ensure that we don't open the Start page multiple times
QList<QWidget*> ch = Gui::getMainWindow()->windows();
for (QList<QWidget*>::const_iterator c = ch.begin(); c != ch.end(); c++)
if ((*c)->windowTitle() == QObject::tr("Start page"))
return;
try {
Gui::Command::doCommand(Gui::Command::Gui,"import WebGui");
Gui::Command::doCommand(Gui::Command::Gui,"from StartPage import StartPage");