Moved ActivePartObject etc. to PartDesignGui namespace and added extern declaration to Workbench.h as suggested by logari81
This commit is contained in:
parent
2f658733b7
commit
10c8ba7e9b
|
@ -36,30 +36,32 @@
|
|||
|
||||
#include <Mod/PartDesign/App/BodyPy.h>
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
// pointer to the active assembly object
|
||||
PartDesign::Body *ActivePartObject =0;
|
||||
Gui::Document *ActiveGuiDoc =0;
|
||||
App::Document *ActiveAppDoc =0;
|
||||
Gui::ViewProviderDocumentObject *ActiveVp =0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static PyObject * setActivePart(PyObject *self, PyObject *args)
|
||||
{
|
||||
if(ActivePartObject){
|
||||
if(PartDesignGui::ActivePartObject){
|
||||
// check if the document not already closed
|
||||
std::vector<App::Document*> docs = App::GetApplication().getDocuments();
|
||||
for(std::vector<App::Document*>::const_iterator it=docs.begin();it!=docs.end();++it)
|
||||
if(*it == ActiveAppDoc){
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Underlined,false);
|
||||
if(*it == PartDesignGui::ActiveAppDoc){
|
||||
PartDesignGui::ActiveGuiDoc->signalHighlightObject(*PartDesignGui::ActiveVp,Gui::Underlined,false);
|
||||
break;
|
||||
}
|
||||
|
||||
ActivePartObject->IsActive.setValue(false);
|
||||
ActivePartObject = 0;
|
||||
ActiveGuiDoc =0;
|
||||
ActiveAppDoc =0;
|
||||
ActiveVp =0;
|
||||
PartDesignGui::ActivePartObject->IsActive.setValue(false);
|
||||
PartDesignGui::ActivePartObject = 0;
|
||||
PartDesignGui::ActiveGuiDoc =0;
|
||||
PartDesignGui::ActiveAppDoc =0;
|
||||
PartDesignGui::ActiveVp =0;
|
||||
}
|
||||
|
||||
PyObject *object=0;
|
||||
|
@ -69,11 +71,11 @@ static PyObject * setActivePart(PyObject *self, PyObject *args)
|
|||
assert(Item);
|
||||
|
||||
Item->IsActive.setValue(true);
|
||||
ActivePartObject = Item;
|
||||
ActiveAppDoc = Item->getDocument();
|
||||
ActiveGuiDoc = Gui::Application::Instance->getDocument(ActiveAppDoc);
|
||||
ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*> (ActiveGuiDoc->getViewProvider(Item)) ;
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Underlined,true);
|
||||
PartDesignGui::ActivePartObject = Item;
|
||||
PartDesignGui::ActiveAppDoc = Item->getDocument();
|
||||
PartDesignGui::ActiveGuiDoc = Gui::Application::Instance->getDocument(PartDesignGui::ActiveAppDoc);
|
||||
PartDesignGui::ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*> (PartDesignGui::ActiveGuiDoc->getViewProvider(Item)) ;
|
||||
PartDesignGui::ActiveGuiDoc->signalHighlightObject(*PartDesignGui::ActiveVp,Gui::Underlined,true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -59,11 +59,10 @@
|
|||
#include <Mod/PartDesign/App/FeatureRevolution.h>
|
||||
|
||||
#include "FeaturePickDialog.h"
|
||||
#include "Workbench.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern PartDesign::Body *ActivePartObject;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Helper for Body
|
||||
|
@ -71,7 +70,7 @@ extern PartDesign::Body *ActivePartObject;
|
|||
|
||||
PartDesign::Body *getBody(void)
|
||||
{
|
||||
if(!ActivePartObject){
|
||||
if(!PartDesignGui::ActivePartObject){
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),
|
||||
QObject::tr("In order to use PartDesign you need an active Body object in the document. "
|
||||
"Please make one active or create one. If you have a legacy document "
|
||||
|
@ -79,7 +78,7 @@ PartDesign::Body *getBody(void)
|
|||
"PartDesign to put them into a Body."
|
||||
));
|
||||
}
|
||||
return ActivePartObject;
|
||||
return PartDesignGui::ActivePartObject;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@ 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)
|
||||
|
@ -208,8 +206,8 @@ void Workbench::deactivated()
|
|||
removeTaskWatcher();
|
||||
// remember the body for later activation
|
||||
// TODO: Remove this if the IsActive Property of Body works OK
|
||||
if(ActivePartObject)
|
||||
oldActive = ActivePartObject->getNameInDocument();
|
||||
if(PartDesignGui::ActivePartObject)
|
||||
oldActive = PartDesignGui::ActivePartObject->getNameInDocument();
|
||||
else
|
||||
oldActive = "";
|
||||
// reset the active Body
|
||||
|
|
|
@ -29,11 +29,25 @@
|
|||
namespace Gui {
|
||||
|
||||
class MenuItem;
|
||||
class Document;
|
||||
class ViewProviderDocumentObject;
|
||||
|
||||
}
|
||||
|
||||
namespace PartDesign {
|
||||
|
||||
class Body;
|
||||
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
// pointer to the active assembly object
|
||||
extern PartDesign::Body *ActivePartObject;
|
||||
extern Gui::Document *ActiveGuiDoc;
|
||||
extern App::Document *ActiveAppDoc;
|
||||
extern Gui::ViewProviderDocumentObject *ActiveVp;
|
||||
|
||||
/**
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user