auto WB switching for editing Sketches and new TaskWatcher
This commit is contained in:
parent
f5cfa8d72a
commit
db460cff8a
|
@ -169,4 +169,5 @@ bool TaskWatcherCommandsEmptySelection::shouldShow()
|
|||
return (App::GetApplication().getActiveDocument() && Gui::Selection().size() == 0);
|
||||
}
|
||||
|
||||
|
||||
#include "moc_TaskWatcher.cpp"
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <Gui/ToolBarManager.h>
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
|
@ -44,6 +46,9 @@ using namespace PartDesignGui;
|
|||
qApp->translate("Gui::TaskView::TaskWatcherCommands", "Create Geometry");
|
||||
#endif
|
||||
|
||||
extern PartDesign::Body *ActivePartObject;
|
||||
|
||||
|
||||
/// @namespace PartDesignGui @class Workbench
|
||||
TYPESYSTEM_SOURCE(PartDesignGui::Workbench, Gui::StdWorkbench)
|
||||
|
||||
|
@ -62,16 +67,7 @@ void Workbench::activated()
|
|||
|
||||
std::vector<Gui::TaskView::TaskWatcher*> Watcher;
|
||||
|
||||
//Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
// "FROM Robot SELECT TrajectoryObject COUNT 1"
|
||||
// "FROM Robot SELECT RobotObject COUNT 1",
|
||||
// RobotAndTrac,
|
||||
// "Trajectory tools",
|
||||
// "Robot_InsertWaypoint"
|
||||
//));
|
||||
|
||||
//Watcher.push_back(new TaskWatcherRobot);
|
||||
|
||||
|
||||
const char* Edge[] = {
|
||||
"PartDesign_Fillet",
|
||||
"PartDesign_Chamfer",
|
||||
|
@ -149,15 +145,27 @@ void Workbench::activated()
|
|||
|
||||
addTaskWatcher(Watcher);
|
||||
Gui::Control().showTaskView();
|
||||
|
||||
// set the previous used active Body
|
||||
if(oldActive != "")
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"PartDesignGui.setActivePart(App.activeDocument().%s)",oldActive.c_str());
|
||||
|
||||
}
|
||||
|
||||
void Workbench::deactivated()
|
||||
{
|
||||
// remember the body for later activation
|
||||
if(ActivePartObject)
|
||||
oldActive = ActivePartObject->getNameInDocument();
|
||||
else
|
||||
oldActive = "";
|
||||
// reset the active Body
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"PartDesignGui.setActivePart(None)");
|
||||
|
||||
Gui::Workbench::deactivated();
|
||||
removeTaskWatcher();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
|
|
|
@ -48,6 +48,8 @@ protected:
|
|||
Gui::MenuItem* setupMenuBar() const;
|
||||
Gui::ToolBarItem* setupToolBars() const;
|
||||
Gui::ToolBarItem* setupCommandBars() const;
|
||||
|
||||
std::string oldActive;
|
||||
};
|
||||
|
||||
} // namespace PartDesignGui
|
||||
|
|
|
@ -4156,6 +4156,9 @@ void ViewProviderSketch::setupContextMenu(QMenu *menu, QObject *receiver, const
|
|||
|
||||
bool ViewProviderSketch::setEdit(int ModNum)
|
||||
{
|
||||
// always change to sketcher WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("SketcherWorkbench");
|
||||
|
||||
// When double-clicking on the item for this sketch the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
|
@ -4580,6 +4583,9 @@ void ViewProviderSketch::unsetEdit(int ModNum)
|
|||
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
|
||||
// return to the WB before edeting the sketch
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
}
|
||||
|
||||
void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int ModNum)
|
||||
|
|
|
@ -382,6 +382,7 @@ protected:
|
|||
bool relative;
|
||||
|
||||
Gui::Rubberband* rubberband;
|
||||
std::string oldWb;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
|
Loading…
Reference in New Issue
Block a user