Moved ActivePartObject etc. to PartDesignGui namespace and added extern declaration to Workbench.h as suggested by logari81

This commit is contained in:
jrheinlaender
2013-04-05 20:06:23 +04:30
committed by Stefan Tröger
parent 2f658733b7
commit 10c8ba7e9b
4 changed files with 35 additions and 22 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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
*/