[TD]Centralize preference getters
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include "DrawViewDimension.h"
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "Preferences.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPagePy.h> // generated from DrawPagePy.xml
|
||||
|
||||
@@ -77,12 +78,9 @@ DrawPage::DrawPage(void)
|
||||
static const char *group = "Page";
|
||||
nowUnsetting = false;
|
||||
forceRedraw(false);
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", true); //this is the default value for new pages!
|
||||
|
||||
ADD_PROPERTY_TYPE(KeepUpdated, (autoUpdate), group, (App::PropertyType)(App::Prop_Output), "Keep page in sync with model");
|
||||
ADD_PROPERTY_TYPE(KeepUpdated, (Preferences::keepPagesUpToDate()),
|
||||
group, (App::PropertyType)(App::Prop_Output), "Keep page in sync with model");
|
||||
ADD_PROPERTY_TYPE(Template, (0), group, (App::PropertyType)(App::Prop_None), "Attached Template");
|
||||
Template.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(Views, (0), group, (App::PropertyType)(App::Prop_None), "Attached Views");
|
||||
@@ -90,25 +88,18 @@ DrawPage::DrawPage(void)
|
||||
|
||||
// Projection Properties
|
||||
ProjectionType.setEnums(ProjectionTypeEnums);
|
||||
ADD_PROPERTY(ProjectionType, ((long)Preferences::projectionAngle()));
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/General");
|
||||
double defScale = hGrp->GetFloat("DefaultScale",1.0);
|
||||
ADD_PROPERTY_TYPE(Scale, (defScale), group, (App::PropertyType)(App::Prop_None), "Scale factor for this Page");
|
||||
|
||||
// In preferences, 0 -> First Angle 1 -> Third Angle
|
||||
int projType = hGrp->GetInt("ProjectionAngle", -1);
|
||||
|
||||
if (projType == -1) {
|
||||
ADD_PROPERTY(ProjectionType, ((long)0)); // Default to first angle
|
||||
} else {
|
||||
ADD_PROPERTY(ProjectionType, ((long)projType));
|
||||
}
|
||||
|
||||
ADD_PROPERTY_TYPE(Scale, (1.0), group, (App::PropertyType)(App::Prop_None), "Scale factor for this Page");
|
||||
ADD_PROPERTY_TYPE(NextBalloonIndex, (1), group, (App::PropertyType)(App::Prop_None),
|
||||
"Auto-numbering for Balloons");
|
||||
|
||||
Scale.setConstraints(&scaleRange);
|
||||
double defScale = hGrp->GetFloat("DefaultScale",1.0);
|
||||
Scale.setValue(defScale);
|
||||
balloonPlacing = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user