[TechDraw] Simplify retrievement of user preferences

for all TechDraw files
This commit is contained in:
Benjamin Bræstrup Sayoc
2023-04-09 16:18:55 +02:00
committed by WandererFan
parent 50c2b7e9d8
commit 5d05acc87e
36 changed files with 101 additions and 355 deletions

View File

@@ -81,20 +81,16 @@ QColor PreferencesGui::preselectQColor()
App::Color PreferencesGui::sectionLineColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("SectionColor", 0x000000FF));
fcColor.setPackedValue(Preferences::getPreferenceGroup("Decorations")->GetUnsigned("SectionColor", 0x000000FF));
return fcColor;
}
QColor PreferencesGui::sectionLineQColor()
{
//if the App::Color version has already lightened the color, we don't want to do it again
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("SectionColor", 0x000000FF));
fcColor.setPackedValue(Preferences::getPreferenceGroup("Decorations")->GetUnsigned("SectionColor", 0x000000FF));
return fcColor.asValue<QColor>();
}

View File

@@ -30,16 +30,16 @@
# include <QStyleOptionGraphicsItem>
#endif
#include <App/Application.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "QGCustomText.h"
#include "PreferencesGui.h"
#include "QGICMark.h"
#include "ZVALUE.h"
using namespace TechDraw;
using namespace TechDrawGui;
QGCustomText::QGCustomText(QGraphicsItem* parent) :
@@ -235,9 +235,7 @@ QColor QGCustomText::getSelectColor()
Base::Reference<ParameterGrp> QGCustomText::getParmGroup()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
return hGrp;
return Preferences::getPreferenceGroup("Colors");
}
void QGCustomText::makeMark(double x, double y)

View File

@@ -29,13 +29,14 @@
# include <QStyleOptionGraphicsItem>
#endif
#include <App/Application.h>
#include <App/Material.h>
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "QGICMark.h"
#include "PreferencesGui.h"
using namespace TechDraw;
using namespace TechDrawGui;
QGICMark::QGICMark(int index) : QGIVertex(index)
@@ -100,9 +101,7 @@ QPainterPath QGICMark::shape() const
double QGICMark::getMarkFuzz() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
double result = hGrp->GetFloat("MarkFuzz", 5.0);
double result = Preferences::getPreferenceGroup("General")->GetFloat("MarkFuzz", 5.0);
return result;
}

View File

@@ -29,13 +29,14 @@
# include <QStyleOptionGraphicsItem>
#endif
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "QGICenterLine.h"
#include "PreferencesGui.h"
using namespace TechDraw;
using namespace TechDrawGui;
QGICenterLine::QGICenterLine()
@@ -77,9 +78,7 @@ QColor QGICenterLine::getCenterColor()
Qt::PenStyle QGICenterLine::getCenterStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
Qt::PenStyle centerStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("CenterLine", 2));
Qt::PenStyle centerStyle = static_cast<Qt::PenStyle> (Preferences::getPreferenceGroup("Decorations")->GetInt("CenterLine", 2));
return centerStyle;
}

View File

@@ -82,19 +82,15 @@ void QGIEdge::setPrettyNormal() {
QColor QGIEdge::getHiddenColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("HiddenColor", 0x000000FF));
App::Color fcColor = App::Color((uint32_t) Preferences::getPreferenceGroup("Colors")->GetUnsigned("HiddenColor", 0x000000FF));
return PreferencesGui::getAccessibleQColor(fcColor.asValue<QColor>());
}
Qt::PenStyle QGIEdge::getHiddenStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
//Qt::PenStyle - NoPen, Solid, Dashed, ...
//Preferences::General - Solid, Dashed
Qt::PenStyle hidStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("HiddenLine", 0) + 1);
Qt::PenStyle hidStyle = static_cast<Qt::PenStyle> (Preferences::getPreferenceGroup("General")->GetInt("HiddenLine", 0) + 1);
return hidStyle;
}

View File

@@ -704,23 +704,13 @@ void QGIFace::setLineWeight(double w) {
void QGIFace::getParameters()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
m_maxSeg = Preferences::getPreferenceGroup("PAT")->GetInt("MaxSeg", 10000l);
m_maxTile = Preferences::getPreferenceGroup("Decorations")->GetInt("MaxSVGTile", 10000l);
m_maxSeg = hGrp->GetInt("MaxSeg", 10000l);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
m_maxTile = hGrp->GetInt("MaxSVGTile", 10000l);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color temp {static_cast<uint32_t>(hGrp->GetUnsigned("FaceColor",0xffffffff))};
App::Color temp {static_cast<uint32_t>(Preferences::getPreferenceGroup("Colors")->GetUnsigned("FaceColor",0xffffffff))};
setFillColor(temp.asValue<QColor>());
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
m_defClearFace = hGrp->GetBool("ClearFace", false);
m_defClearFace = Preferences::getPreferenceGroup("Colors")->GetBool("ClearFace", false);
}
QRectF QGIFace::boundingRect() const

View File

@@ -243,19 +243,15 @@ void QGIPrimPath::setCapStyle(Qt::PenCapStyle c)
Base::Reference<ParameterGrp> QGIPrimPath::getParmGroup()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
return hGrp;
return Preferences::getPreferenceGroup("Colors");
}
//EdgeCapStyle param changed from UInt (Qt::PenCapStyle) to Int (QComboBox index)
Qt::PenCapStyle QGIPrimPath::prefCapStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
Qt::PenCapStyle result;
int newStyle;
newStyle = hGrp->GetInt("EdgeCapStyle", 32); //0x00 FlatCap, 0x10 SquareCap, 0x20 RoundCap
newStyle = Preferences::getPreferenceGroup("General")->GetInt("EdgeCapStyle", 32); //0x00 FlatCap, 0x10 SquareCap, 0x20 RoundCap
switch (newStyle) {
case 0:
result = static_cast<Qt::PenCapStyle>(0x20); //round;

View File

@@ -165,12 +165,7 @@ void QGISVGTemplate::createClickHandles()
//TODO: Find location of special fields (first/third angle) and make graphics items for them
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
double editClickBoxSize = Rez::guiX(hGrp->GetFloat("TemplateDotSize", 3.0));
double editClickBoxSize = Rez::guiX(Preferences::getPreferenceGroup("General")->GetFloat("TemplateDotSize", 3.0));
QColor editClickBoxColor = Qt::green;
editClickBoxColor.setAlpha(128);//semi-transparent

View File

@@ -487,9 +487,7 @@ Qt::PenStyle QGISectionLine::getSectionStyle()
//ASME("traditional") vs ISO("reference arrow method") arrows
int QGISectionLine::getPrefSectionStandard()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Standards");
int format = hGrp->GetInt("SectionLineStandard", ISOSTANDARD);
int format = Preferences::getPreferenceGroup("Standards")->GetInt("SectionLineStandard", ISOSTANDARD);
return format;
}

View File

@@ -322,17 +322,13 @@ bool QGITile::getAltWeld()
//TODO: this is Pen, not Brush. sb Brush to colour background
QColor QGITile::getTileColor() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("TileColor", 0x00000000));
App::Color fcColor = App::Color((uint32_t) Preferences::getPreferenceGroup("Colors")->GetUnsigned("TileColor", 0x00000000));
return PreferencesGui::getAccessibleQColor( fcColor.asValue<QColor>());
}
double QGITile::getSymbolWidth() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
double w = hGrp->GetFloat("SymbolSize", 64);
double w = Preferences::getPreferenceGroup("Dimensions")->GetFloat("SymbolSize", 64);
// symbols are only nominally 64x64. they actually have a "border" of 4 - 0.5*stroke(0.5)
// so we'll say effectively 62x62? 60 x 60
// double w = 64.0;
@@ -344,9 +340,7 @@ double QGITile::getSymbolWidth() const
double QGITile::getSymbolHeight() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
double h = hGrp->GetFloat("SymbolSize", 64);
double h = Preferences::getPreferenceGroup("Dimensions")->GetFloat("SymbolSize", 64);
double fudge = 4.0;
h = h - fudge;
// double h = 60.0;
@@ -357,17 +351,14 @@ double QGITile::getSymbolHeight() const
//make symbols larger or smaller than standard
double QGITile::getSymbolFactor() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
double s = hGrp->GetFloat("SymbolFactor", 1.25);
double s = Preferences::getPreferenceGroup("Decorations")->GetFloat("SymbolFactor", 1.25);
// double s = 1.25;
return s;
}
double QGITile::prefFontSize() const
{
// Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
// GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
// Base::Reference<ParameterGrp> hGrp = Preferences::getPreferenceGroup("Dimensions");
return Preferences::dimFontSizeMM();
}

View File

@@ -942,12 +942,7 @@ int QGIViewBalloon::prefDefaultArrow() const { return Preferences::balloonArrow(
//when would you want a crooked pyramid?
bool QGIViewBalloon::prefOrthoPyramid() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Decorations");
bool ortho = hGrp->GetBool("PyramidOrtho", true);
bool ortho = Preferences::getPreferenceGroup("Decorations")->GetBool("PyramidOrtho", true);
return ortho;
}

View File

@@ -407,12 +407,7 @@ int QGIDatumLabel::getPrecision()
precision = Base::UnitsApi::getDecimals();
}
else {
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Dimensions");
precision = hGrp->GetInt("AltDecimals", 2);
precision = Preferences::getPreferenceGroup("Dimensions")->GetInt("AltDecimals", 2);
}
return precision;
}
@@ -420,12 +415,7 @@ int QGIDatumLabel::getPrecision()
double QGIDatumLabel::getTolAdjust()
{
double adjust;
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Dimensions");
adjust = hGrp->GetFloat("TolSizeAdjust", 0.50);
adjust = Preferences::getPreferenceGroup("Dimensions")->GetFloat("TolSizeAdjust", 0.50);
return adjust;
}

View File

@@ -566,12 +566,7 @@ void QGIViewPart::drawViewPart()
// Draw Vertexs:
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0);
double vertexScaleFactor = Preferences::getPreferenceGroup("General")->GetFloat("VertexScale", 3.0);
QColor vertexColor = PreferencesGui::getAccessibleQColor(PreferencesGui::vertexQColor());
bool showVertices = true;
bool showCenterMarks = true;
@@ -1285,22 +1280,12 @@ void QGIViewPart::rotateView() {}
bool QGIViewPart::prefFaceEdges()
{
bool result = false;
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
result = hGrp->GetBool("DrawFaceEdges", 0l);
result = Preferences::getPreferenceGroup("General")->GetBool("DrawFaceEdges", 0l);
return result;
}
bool QGIViewPart::prefPrintCenters()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Decorations");
bool printCenters = hGrp->GetBool("PrintCenterMarks", false);//true matches v0.18 behaviour
bool printCenters = Preferences::getPreferenceGroup("Decorations")->GetBool("PrintCenterMarks", false);//true matches v0.18 behaviour
return printCenters;
}

View File

@@ -32,7 +32,6 @@
#include <QTextStream>
#endif
#include <App/Application.h>
#include <App/Document.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
@@ -60,6 +59,7 @@
#include <Mod/TechDraw/App/DrawViewSpreadsheet.h>
#include <Mod/TechDraw/App/DrawViewSymbol.h>
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "MDIViewPage.h"
#include "QGIDrawingTemplate.h"
@@ -1271,13 +1271,8 @@ TechDraw::DrawPage* QGSPage::getDrawPage() { return m_vpPage->getDrawPage(); }
QColor QGSPage::getBackgroundColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Background", 0x70707000));
fcColor.setPackedValue(Preferences::getPreferenceGroup("Colors")->GetUnsigned("Background", 0x70707000));
return fcColor.asValue<QColor>();
}

View File

@@ -35,9 +35,9 @@
# include <QTransform>
#endif
#include <App/Application.h>
#include <Base/Console.h>
#include <Mod/TechDraw/App/DrawUtil.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "PreferencesGui.h"
#include "QGTracker.h"
@@ -47,6 +47,7 @@
#include "ZVALUE.h"
using namespace TechDraw;
using namespace TechDrawGui;
QGTracker::QGTracker(QGSPage* inScene, TrackerMode m):
@@ -475,9 +476,7 @@ void QGTracker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QColor QGTracker::getTrackerColor()
{
QColor result;
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Tracker");
App::Color trackColor = App::Color((uint32_t) hGrp->GetUnsigned("TrackerColor", 0xFF000000));
App::Color trackColor = App::Color((uint32_t) Preferences::getPreferenceGroup("Tracker")->GetUnsigned("TrackerColor", 0xFF000000));
result = PreferencesGui::getAccessibleQColor(trackColor.asValue<QColor>());
return result;
}
@@ -485,9 +484,7 @@ QColor QGTracker::getTrackerColor()
double QGTracker::getTrackerWeight()
{
double result = 1.0;
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Tracker");
result = hGrp->GetFloat("TrackerWeight", 4.0);
result = Preferences::getPreferenceGroup("Tracker")->GetFloat("TrackerWeight", 4.0);
return result;
}

View File

@@ -30,12 +30,14 @@
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/DrawPage.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "QGSPage.h"
#include "QGVNavStyle.h"
#include "QGVPage.h"
using namespace TechDraw;
using namespace TechDrawGui;
namespace TechDrawGui
@@ -63,13 +65,8 @@ void QGVNavStyle::initialize()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetFloat("ZoomStep", 0.2f);
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
m_reversePan = hGrp->GetInt("KbPan", 1);
m_reverseScroll = hGrp->GetInt("KbScroll", 1);
m_reversePan = Preferences::getPreferenceGroup("General")->GetInt("KbPan", 1);
m_reverseScroll = Preferences::getPreferenceGroup("General")->GetInt("KbScroll", 1);
panningActive = false;
zoomingActive = false;

View File

@@ -126,13 +126,8 @@ public:
page->m_invertZoom = hGrp->GetBool("InvertZoom", 0l);
page->m_zoomIncrement = hGrp->GetFloat("ZoomStep", 0.02);
auto hTDPref = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/General");
page->m_reversePan = hTDPref->GetInt("KbPan", 1);
page->m_reverseScroll = hTDPref->GetInt("KbScroll", 1);
page->m_reversePan = Preferences::getPreferenceGroup("General")->GetInt("KbPan", 1);
page->m_reverseScroll = Preferences::getPreferenceGroup("General")->GetInt("KbScroll", 1);
}
/// Observer message from the ParameterGrp
void OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::MessageType Reason) override
@@ -504,13 +499,8 @@ TechDraw::DrawPage* QGVPage::getDrawPage() { return m_vpPage->getDrawPage(); }
QColor QGVPage::getBackgroundColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Background", 0x70707000));
fcColor.setPackedValue(Preferences::getPreferenceGroup("Colors")->GetUnsigned("Background", 0x70707000));
return fcColor.asValue<QColor>();
}

View File

@@ -22,12 +22,12 @@
#include "PreCompiled.h"
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "Rez.h"
using namespace TechDraw;
using namespace TechDrawGui;
//*** initial static var outside methods!
@@ -123,9 +123,7 @@ QSize Rez::appSize(QSize s)
double Rez::getParameter()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Rez");
double rezFactor = hGrp->GetFloat("Resolution", 10.0);
double rezFactor = Preferences::getPreferenceGroup("Rez")->GetFloat("Resolution", 10.0);
return rezFactor;
}

View File

@@ -417,9 +417,7 @@ double TaskCenterLine::getCenterWidth()
Qt::PenStyle TaskCenterLine::getCenterStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
Qt::PenStyle centerStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("CenterLine", 2));
Qt::PenStyle centerStyle = static_cast<Qt::PenStyle> (Preferences::getPreferenceGroup("Decorations")->GetInt("CenterLine", 2));
return centerStyle;
}
@@ -430,9 +428,7 @@ QColor TaskCenterLine::getCenterColor()
double TaskCenterLine::getExtendBy()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
double ext = hGrp->GetFloat("CosmoCLExtend", 3.0);
double ext = Preferences::getPreferenceGroup("Decorations")->GetFloat("CosmoCLExtend", 3.0);
return ext;
}

View File

@@ -244,10 +244,7 @@ double ViewProviderDimension::prefWeight() const
int ViewProviderDimension::prefStandardAndStyle() const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->
GetGroup("Mod/TechDraw/Dimensions");
int standardStyle = hGrp->GetInt("StandardAndStyle", STD_STYLE_ISO_ORIENTED);
int standardStyle = Preferences::getPreferenceGroup("Dimensions")->GetInt("StandardAndStyle", STD_STYLE_ISO_ORIENTED);
return standardStyle;
}

View File

@@ -92,11 +92,8 @@ ViewProviderViewPart::ViewProviderViewPart()
weight = TechDraw::LineGroup::getDefaultWidth("Extra");
ADD_PROPERTY_TYPE(ExtraWidth, (weight), group, App::Prop_None, "The thickness of LineGroup Extra lines, if enabled");
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
double defScale = hGrp->GetFloat("CenterMarkScale", 0.50);
bool defShowCenters = hGrp->GetBool("ShowCenterMarks", false);
double defScale = Preferences::getPreferenceGroup("Decorations")->GetFloat("CenterMarkScale", 0.50);
bool defShowCenters = Preferences::getPreferenceGroup("Decorations")->GetBool("ShowCenterMarks", false);
//decorations
ADD_PROPERTY_TYPE(HorizCenterLine ,(false), dgroup, App::Prop_None, "Show a horizontal centerline through view");
@@ -357,18 +354,14 @@ App::Color ViewProviderViewPart::prefSectionColor()
App::Color ViewProviderViewPart::prefHighlightColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("HighlightColor", 0x00000000));
fcColor.setPackedValue(Preferences::getPreferenceGroup("Decorations")->GetUnsigned("HighlightColor", 0x00000000));
return fcColor;
}
int ViewProviderViewPart::prefHighlightStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
return hGrp->GetInt("HighlightStyle", 2);
return Preferences::getPreferenceGroup("Decorations")->GetInt("HighlightStyle", 2);
}

View File

@@ -30,7 +30,6 @@
# endif
#endif
#include <App/Application.h>
#include <App/DocumentObject.h>
#include <Base/Parameter.h>
#include <Gui/Control.h>
@@ -39,12 +38,16 @@
#include <Mod/TechDraw/App/DrawComplexSection.h>
#include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "TaskSectionView.h"
#include "TaskComplexSection.h"
#include "ViewProviderViewSection.h"
#include "QGIView.h"
using namespace TechDraw;
using namespace TechDrawGui;
PROPERTY_SOURCE(TechDrawGui::ViewProviderViewSection, TechDrawGui::ViewProviderViewPart)
@@ -144,17 +147,13 @@ bool ViewProviderViewSection::doubleClicked()
void ViewProviderViewSection::getParameters()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color cutColor = App::Color((uint32_t) hGrp->GetUnsigned("CutSurfaceColor", 0xD3D3D3FF));
App::Color cutColor = App::Color((uint32_t) Preferences::getPreferenceGroup("Colors")->GetUnsigned("CutSurfaceColor", 0xD3D3D3FF));
CutSurfaceColor.setValue(cutColor);
// App::Color hatchColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionHatchColor", 0x00000000));
// HatchColor.setValue(hatchColor);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
double lineWeight = hGrp->GetFloat("GeomWeight", 0.1);
double lineWeight = Preferences::getPreferenceGroup("PAT")->GetFloat("GeomWeight", 0.1);
WeightPattern.setValue(lineWeight);
}

View File

@@ -126,10 +126,7 @@ double ViewProviderWeld::prefFontSize()
double ViewProviderWeld::prefTileTextAdjust()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->
GetGroup("Mod/TechDraw/Dimensions");
double adjust = hGrp->GetFloat("TileTextAdjust", 0.75);
double adjust = Preferences::getPreferenceGroup("Dimensions")->GetFloat("TileTextAdjust", 0.75);
return adjust;
}