diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index 1ef743919..f8dad5bf8 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -94,8 +94,8 @@ set(FemGui_UIC_SRCS TaskAnalysisInfo.ui TaskDriver.ui ) -if(BUILD_FEM_VTK) - set(FemGui_UIC_SRCS +if(BUILD_FEM_VTK) + set(FemGui_UIC_SRCS ${FemGui_UIC_SRCS} TaskPostDisplay.ui TaskPostClip.ui @@ -105,7 +105,7 @@ if(BUILD_FEM_VTK) PlaneWidget.ui SphereWidget.ui ) -endif(BUILD_FEM_VTK) +endif(BUILD_FEM_VTK) qt4_wrap_ui(FemGui_UIC_HDRS ${FemGui_UIC_SRCS}) SET(FemGui_DLG_SRCS diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 1f4adf8e6..cd78add89 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -769,7 +769,7 @@ bool CmdFemCreateNodesSet::isActive(void) #ifdef FC_USE_VTK void setupFilter(Gui::Command* cmd, std::string Name) { - + std::vector pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType(); if (!pipelines.empty()) { Fem::FemPostPipeline *pipeline = pipelines.front(); @@ -782,7 +782,7 @@ void setupFilter(Gui::Command* cmd, std::string Name) { cmd->doCommand(Gui::Command::Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); cmd->doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument()); cmd->doCommand(Gui::Command::Doc,"del __list__"); - + cmd->updateActive(); cmd->doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); @@ -792,7 +792,7 @@ void setupFilter(Gui::Command* cmd, std::string Name) { qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); } - + }; DEF_STD_CMD_A(CmdFemPostCreateClipFilter); @@ -912,7 +912,7 @@ CmdFemPostFunctions::CmdFemPostFunctions() void CmdFemPostFunctions::activated(int iMsg) { - + std::string name; if (iMsg==0) name = "Plane"; @@ -927,7 +927,7 @@ void CmdFemPostFunctions::activated(int iMsg) Fem::FemPostPipeline *pipeline = pipelines.front(); openCommand("Create function"); - + //check if the pipeline has a filter provider and add one if needed Fem::FemPostFunctionProvider* provider; if(!pipeline->Functions.getValue() || pipeline->Functions.getValue()->getTypeId() != Fem::FemPostFunctionProvider::getClassTypeId()) { @@ -938,7 +938,7 @@ void CmdFemPostFunctions::activated(int iMsg) } else provider = static_cast(pipeline->Functions.getValue()); - + //build the object std::string FeatName = getUniqueObjectName(name.c_str()); doCommand(Doc,"App.activeDocument().addObject('Fem::FemPost%sFunction','%s')", name.c_str(), FeatName.c_str()); @@ -946,14 +946,14 @@ void CmdFemPostFunctions::activated(int iMsg) doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str()); doCommand(Doc,"App.ActiveDocument.%s.Functions = __list__", provider->getNameInDocument()); doCommand(Doc,"del __list__"); - + //set the default values, for this get the bounding box vtkBoundingBox box = pipeline->getBoundingBox(); - + double center[3]; box.GetCenter(center); - - if (iMsg==0) + + if (iMsg==0) doCommand(Doc,"App.ActiveDocument.%s.Origin = App.Vector(%f, %f, %f)", FeatName.c_str(), center[0], center[1], center[2]); else if (iMsg==1) { @@ -961,8 +961,8 @@ void CmdFemPostFunctions::activated(int iMsg) center[1] + box.GetLength(1)/2, center[2] + box.GetLength(2)/2); doCommand(Doc,"App.ActiveDocument.%s.Radius = %f", FeatName.c_str(), box.GetDiagonalLength()/2); } - - + + this->updateActive(); //most of the times functions are added inside of a filter, make sure this still works if(Gui::Application::Instance->activeDocument()->getInEdit() == NULL) @@ -973,7 +973,7 @@ void CmdFemPostFunctions::activated(int iMsg) qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"), qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please.")); } - + // Since the default icon is reset when enabing/disabling the command we have // to explicitly set the icon of the used command. Gui::ActionGroup* pcAction = qobject_cast(_pcAction); @@ -991,10 +991,10 @@ Gui::Action * CmdFemPostFunctions::createAction(void) QAction* cmd0 = pcAction->addAction(QString()); cmd0->setIcon(Gui::BitmapFactory().pixmap("fem-plane")); - + QAction* cmd1 = pcAction->addAction(QString()); cmd1->setIcon(Gui::BitmapFactory().pixmap("fem-sphere")); - + _pcAction = pcAction; languageChange(); @@ -1018,12 +1018,12 @@ void CmdFemPostFunctions::languageChange() cmd->setText(QApplication::translate("CmdFemPostFunctions","Plane")); cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a plane function, defined by its orgin and normal")); cmd->setStatusTip(cmd->toolTip()); - + cmd = a[1]; cmd->setText(QApplication::translate("CmdFemPostFunctions","Sphere")); cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a phere function, defined by its center and radius")); cmd->setStatusTip(cmd->toolTip()); - + } bool CmdFemPostFunctions::isActive(void) @@ -1053,7 +1053,7 @@ CmdFemPostApllyChanges::CmdFemPostApllyChanges() void CmdFemPostApllyChanges::activated(int iMsg) { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); - + if (iMsg == 1) hGrp->SetBool("PostAutoRecompute", true); else @@ -1074,7 +1074,7 @@ Gui::Action * CmdFemPostApllyChanges::createAction(void) pcAction->setCheckable(true); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); pcAction->setChecked(hGrp->GetBool("PostAutoRecompute", false)); - + return pcAction; } @@ -1096,9 +1096,9 @@ CmdFemPostPipelineFromResult::CmdFemPostPipelineFromResult() void CmdFemPostPipelineFromResult::activated(int iMsg) { Gui::SelectionFilter ResultFilter("SELECT Fem::FemResultObject COUNT 1"); - + if (ResultFilter.match()) { - + Fem::FemResultObject* result = static_cast(ResultFilter.Result[0][0].getObject()); std::string FeatName = getUniqueObjectName("Pipeline"); @@ -1107,9 +1107,9 @@ void CmdFemPostPipelineFromResult::activated(int iMsg) //TODO: use python function call for this static_cast(getDocument()->getObject(FeatName.c_str()))->load(result); - + this->updateActive(); - + } else { QMessageBox::warning(Gui::getMainWindow(),