+ Implement observer for active analysis object

This commit is contained in:
wmayer
2013-11-08 18:51:47 +01:00
parent 44e70a6435
commit 09b896f40e
5 changed files with 206 additions and 48 deletions

View File

@@ -59,16 +59,15 @@
#include "Hypothesis.h"
#include "ActiveAnalysisObserver.h"
using namespace std;
extern Fem::FemAnalysis *ActiveAnalysis;
bool getConstraintPrerequisits(Fem::FemAnalysis **Analysis)
{
if(!ActiveAnalysis || !ActiveAnalysis->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){
Fem::FemAnalysis* ActiveAnalysis = FemGui::ActiveAnalysisObserver::instance()->getActiveObject();
if (!ActiveAnalysis || !ActiveAnalysis->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Analysis"),
QObject::tr("You need to create or activate a Analysis"));
return true;
@@ -164,12 +163,11 @@ void CmdFemCreateAnalysis::activated(int iMsg)
commitCommand();
updateActive();
}
bool CmdFemCreateAnalysis::isActive(void)
{
return !ActiveAnalysis;
return !FemGui::ActiveAnalysisObserver::instance()->hasActiveObject();
}