Fem: move handling of PostAutoRecompute to a central class and by default set its value to true
This commit is contained in:
@@ -313,6 +313,8 @@ SET(FemGui_SRCS_Module
|
||||
ActiveAnalysisObserver.cpp
|
||||
ActiveAnalysisObserver.h
|
||||
Command.cpp
|
||||
FemSettings.cpp
|
||||
FemSettings.h
|
||||
Resources/Fem.qrc
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <Mod/Fem/App/FemSetNodesObject.h>
|
||||
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
#include "FemSettings.h"
|
||||
|
||||
#ifdef FC_USE_VTK
|
||||
#include <Mod/Fem/App/FemPostPipeline.h>
|
||||
@@ -1744,12 +1745,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
|
||||
hGrp->SetBool("PostAutoRecompute", false);
|
||||
FemGui::FemSettings().setPostAutoRecompute(iMsg == 1);
|
||||
}
|
||||
|
||||
bool CmdFemPostApllyChanges::isActive(void)
|
||||
@@ -1764,8 +1760,7 @@ Gui::Action* CmdFemPostApllyChanges::createAction(void)
|
||||
{
|
||||
Gui::Action* pcAction = Command::createAction();
|
||||
pcAction->setCheckable(true);
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
pcAction->setChecked(hGrp->GetBool("PostAutoRecompute", false));
|
||||
pcAction->setChecked(FemGui::FemSettings().getPostAutoRecompute());
|
||||
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
44
src/Mod/Fem/Gui/FemSettings.cpp
Normal file
44
src/Mod/Fem/Gui/FemSettings.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "FemSettings.h"
|
||||
#include <App/Application.h>
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
|
||||
FemSettings::FemSettings()
|
||||
{
|
||||
pGroup = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
}
|
||||
|
||||
void FemSettings::setPostAutoRecompute(bool on)
|
||||
{
|
||||
pGroup->SetBool("PostAutoRecompute", on);
|
||||
}
|
||||
|
||||
bool FemSettings::getPostAutoRecompute() const
|
||||
{
|
||||
return pGroup->GetBool("PostAutoRecompute", true);
|
||||
}
|
||||
44
src/Mod/Fem/Gui/FemSettings.h
Normal file
44
src/Mod/Fem/Gui/FemSettings.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef FEMGUI_SETTINGS_H
|
||||
#define FEMGUI_SETTINGS_H
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
namespace FemGui {
|
||||
|
||||
class FemSettings
|
||||
{
|
||||
public:
|
||||
FemSettings();
|
||||
void setPostAutoRecompute(bool);
|
||||
bool getPostAutoRecompute() const;
|
||||
|
||||
private:
|
||||
ParameterGrp::handle pGroup;
|
||||
};
|
||||
|
||||
} //namespace FemGui
|
||||
|
||||
#endif // FEMGUI_SETTINGS_H
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "ui_TaskPostScalarClip.h"
|
||||
#include "ui_TaskPostWarpVector.h"
|
||||
|
||||
#include "FemSettings.h"
|
||||
#include "TaskPostBoxes.h"
|
||||
#include "ViewProviderFemPostFilter.h"
|
||||
#include "ViewProviderFemPostFunction.h"
|
||||
@@ -300,8 +301,7 @@ TaskPostBox::~TaskPostBox() {
|
||||
|
||||
bool TaskPostBox::autoApply() {
|
||||
|
||||
ParameterGrp::handle pGroup = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
return pGroup->GetBool("PostAutoRecompute", false);
|
||||
return FemSettings().getPostAutoRecompute();
|
||||
}
|
||||
|
||||
void TaskPostBox::recompute() {
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
#include "ViewProviderFemPostFunction.h"
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
#include "FemSettings.h"
|
||||
#include "TaskPostBoxes.h"
|
||||
|
||||
#include "ui_PlaneWidget.h"
|
||||
@@ -268,8 +269,7 @@ void ViewProviderFemPostFunction::dragStartCallback(void* data, SoDragger*)
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = true;
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem");
|
||||
that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false);
|
||||
that->m_autoRecompute = FemSettings().getPostAutoRecompute();
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::dragFinishCallback(void* data, SoDragger*)
|
||||
|
||||
Reference in New Issue
Block a user