[TD]Centralize preference getters

This commit is contained in:
wandererfan
2020-04-12 20:44:08 -04:00
committed by WandererFan
parent a2b8aa6b23
commit e80c576241
61 changed files with 881 additions and 501 deletions

View File

@@ -58,11 +58,14 @@
#include <Mod/TechDraw/App/LineGroup.h>
#include<Mod/TechDraw/App/DrawPage.h>
#include "PreferencesGui.h"
#include "QGIView.h"
#include "TaskDetail.h"
#include "ViewProviderViewPart.h"
using namespace TechDrawGui;
using namespace TechDraw;
PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDrawingView)
@@ -86,9 +89,7 @@ ViewProviderViewPart::ViewProviderViewPart()
static const char *hgroup = "Highlight";
//default line weights
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
std::string lgName = Preferences::lineGroup();
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
double weight = lg->getWeight("Thick");
@@ -104,7 +105,7 @@ ViewProviderViewPart::ViewProviderViewPart()
ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled");
delete lg; //Coverity CID 174664
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
double defScale = hGrp->GetFloat("CenterMarkScale",0.50);
@@ -118,9 +119,8 @@ ViewProviderViewPart::ViewProviderViewPart()
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable");
int defLineStyle = hGrp->GetInt("SectionLine", 2);
SectionLineStyle.setEnums(LineStyleEnums);
ADD_PROPERTY_TYPE(SectionLineStyle, (defLineStyle), dgroup, App::Prop_None,
ADD_PROPERTY_TYPE(SectionLineStyle, (PreferencesGui::sectionLineStyle()), dgroup, App::Prop_None,
"Set section line style if applicable");
ADD_PROPERTY_TYPE(SectionLineColor, (prefSectionColor()), dgroup, App::Prop_None,
"Set section line color if applicable");
@@ -388,11 +388,7 @@ bool ViewProviderViewPart::canDelete(App::DocumentObject *obj) const
App::Color ViewProviderViewPart::prefSectionColor(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("SectionColor", 0x00FF0000));
return fcColor;
return PreferencesGui::sectionLineColor();
}
App::Color ViewProviderViewPart::prefHighlightColor(void)