[TD]Centralize preference getters
This commit is contained in:
@@ -155,6 +155,8 @@ SET(TechDraw_SRCS
|
||||
LineGroup.h
|
||||
ArrowPropEnum.cpp
|
||||
ArrowPropEnum.h
|
||||
Preferences.cpp
|
||||
Preferences.h
|
||||
)
|
||||
|
||||
SET(Geometry_SRCS
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <Mod/TechDraw/App/CosmeticVertexPy.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
#include "Preferences.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "Geometry.h"
|
||||
#include "DrawViewPart.h"
|
||||
@@ -105,9 +106,7 @@ std::string LineFormat::toString(void) const
|
||||
//static preference getters.
|
||||
double LineFormat::getDefEdgeWidth()
|
||||
{
|
||||
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 width = lg->getWeight("Graphic");
|
||||
@@ -117,11 +116,7 @@ double LineFormat::getDefEdgeWidth()
|
||||
|
||||
App::Color LineFormat::getDefEdgeColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000)); //black
|
||||
return fcColor;
|
||||
return Preferences::normalColor();
|
||||
}
|
||||
|
||||
int LineFormat::getDefEdgeStyle()
|
||||
@@ -139,14 +134,9 @@ TYPESYSTEM_SOURCE(TechDraw::CosmeticVertex, Base::Persistence)
|
||||
CosmeticVertex::CosmeticVertex() : TechDraw::Vertex()
|
||||
{
|
||||
point(Base::Vector3d(0.0, 0.0, 0.0));
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x00000000));
|
||||
|
||||
permaPoint = Base::Vector3d(0.0, 0.0, 0.0);
|
||||
linkGeom = -1;
|
||||
color = fcColor;
|
||||
color = Preferences::vertexColor();
|
||||
size = 3.0;
|
||||
style = 1;
|
||||
visible = true;
|
||||
@@ -172,14 +162,9 @@ CosmeticVertex::CosmeticVertex(const TechDraw::CosmeticVertex* cv) : TechDraw::V
|
||||
|
||||
CosmeticVertex::CosmeticVertex(Base::Vector3d loc) : TechDraw::Vertex(loc)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0xff000000));
|
||||
|
||||
permaPoint = loc;
|
||||
linkGeom = -1;
|
||||
color = fcColor;
|
||||
color = Preferences::vertexColor();
|
||||
//TODO: size = hGrp->getFloat("VertexSize",30.0);
|
||||
size = 30.0;
|
||||
style = 1; //TODO: implement styled vertexes
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
#include "Preferences.h"
|
||||
#include "DrawPage.h"
|
||||
#include "DrawProjGroupItem.h"
|
||||
#include "DrawProjGroup.h"
|
||||
@@ -1250,10 +1251,7 @@ std::vector<DrawProjGroupItem*> DrawProjGroup::getViewsAsDPGI()
|
||||
|
||||
int DrawProjGroup::getDefProjConv(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
int defProjConv = hGrp->GetInt("ProjectionAngle",0);
|
||||
return defProjConv;
|
||||
return Preferences::projectionAngle();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "DrawUtil.h"
|
||||
|
||||
@@ -499,9 +500,8 @@ double DrawUtil::sensibleScale(double working_scale)
|
||||
|
||||
double DrawUtil::getDefaultLineWeight(std::string lineType)
|
||||
{
|
||||
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 = LineGroup::lineGroupFactory(lgName);
|
||||
|
||||
double weight = lg->getWeight(lineType);
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "DrawProjGroup.h"
|
||||
#include "DrawProjGroupItem.h"
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "Preferences.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "Geometry.h"
|
||||
#include "Cosmetic.h"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "DrawViewAnnotation.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
@@ -58,15 +59,12 @@ DrawViewAnnotation::DrawViewAnnotation(void)
|
||||
{
|
||||
static const char *vgroup = "Annotation";
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
double defFontSize = hGrp->GetFloat("LabelSize", 5.0);
|
||||
|
||||
ADD_PROPERTY_TYPE(Text ,("Default Text"),vgroup,App::Prop_None,"Annotation text");
|
||||
ADD_PROPERTY_TYPE(Font ,(fontName.c_str()),vgroup,App::Prop_None, "Font name");
|
||||
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
|
||||
vgroup,App::Prop_None, "Font name");
|
||||
ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"Text color");
|
||||
ADD_PROPERTY_TYPE(TextSize,(defFontSize),vgroup,App::Prop_None,"Text size");
|
||||
ADD_PROPERTY_TYPE(TextSize, (Preferences::labelFontSizeMM()),
|
||||
vgroup,App::Prop_None,"Text size");
|
||||
ADD_PROPERTY_TYPE(MaxWidth,(-1.0),vgroup,App::Prop_None,"Maximum width of the annotation block.\n -1 means no maximum width.");
|
||||
ADD_PROPERTY_TYPE(LineSpace,(80),vgroup,App::Prop_None,"Line spacing in %. 100 means the height of a line.");
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <Mod/Measure/App/Measurement.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "Geometry.h"
|
||||
#include "DrawViewPart.h"
|
||||
#include "DrawViewBalloon.h"
|
||||
@@ -273,12 +274,8 @@ int DrawViewBalloon::prefShape(void) const
|
||||
}
|
||||
|
||||
int DrawViewBalloon::prefEnd(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
int end = hGrp->GetInt("BalloonArrow", 1);
|
||||
return end;
|
||||
{
|
||||
return Preferences::balloonArrow();
|
||||
}
|
||||
|
||||
Base::Vector3d DrawViewBalloon::getOriginOffset() const
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "Cosmetic.h"
|
||||
@@ -446,14 +447,6 @@ void DrawViewDetail::unsetupObject()
|
||||
|
||||
void DrawViewDetail::getParameters()
|
||||
{
|
||||
// what parameters are useful?
|
||||
// handleFaces
|
||||
// radiusFudge?
|
||||
|
||||
// Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
// .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw");
|
||||
// m_mattingStyle = hGrp->GetInt("MattingStyle", 0);
|
||||
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
#include <Mod/Measure/App/Measurement.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "Geometry.h"
|
||||
#include "DrawViewPart.h"
|
||||
#include "DrawViewDimension.h"
|
||||
@@ -1164,12 +1165,8 @@ bool DrawViewDimension::showUnits() const
|
||||
}
|
||||
|
||||
bool DrawViewDimension::useDecimals() const
|
||||
{
|
||||
bool result = false;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
result = hGrp->GetBool("UseGlobalDecimals", true);
|
||||
return result;
|
||||
{
|
||||
return Preferences::useGlobalDecimals();
|
||||
}
|
||||
|
||||
std::string DrawViewDimension::getPrefix() const
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/PropertyTopoShape.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "Cosmetic.h"
|
||||
#include "DrawGeomHatch.h"
|
||||
#include "DrawHatch.h"
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "Cosmetic.h"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "DrawViewSpreadsheet.h"
|
||||
|
||||
#include <Mod/Spreadsheet/App/Cell.h>
|
||||
@@ -58,15 +59,12 @@ DrawViewSpreadsheet::DrawViewSpreadsheet(void)
|
||||
{
|
||||
static const char *vgroup = "Spreadsheet";
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
|
||||
ADD_PROPERTY_TYPE(Source ,(0),vgroup,App::Prop_None,"Spreadsheet to view");
|
||||
Source.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(CellStart ,("A1"),vgroup,App::Prop_None,"The top left cell of the range to display");
|
||||
ADD_PROPERTY_TYPE(CellEnd ,("B2"),vgroup,App::Prop_None,"The bottom right cell of the range to display");
|
||||
ADD_PROPERTY_TYPE(Font ,((fontName.c_str())),vgroup,App::Prop_None,"The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
|
||||
vgroup,App::Prop_None,"The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The default color of the text and lines");
|
||||
ADD_PROPERTY_TYPE(TextSize,(12.0),vgroup,App::Prop_None,"The size of the text");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the cell lines");
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
#include "LineGroup.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
@@ -173,16 +174,7 @@ LineGroup* LineGroup::lineGroupFactory(std::string groupName)
|
||||
{
|
||||
LineGroup* lg = new LineGroup(groupName);
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/LineGroup/";
|
||||
std::string defaultFileName = defaultDir + "LineGroup.csv";
|
||||
|
||||
std::string lgFileName = hGrp->GetASCII("LineGroupFile",defaultFileName.c_str());
|
||||
if (lgFileName.empty()) {
|
||||
lgFileName = defaultFileName;
|
||||
}
|
||||
std::string lgFileName = Preferences::lineGroupFile();
|
||||
|
||||
std::string lgRecord = LineGroup::getRecordFromFile(lgFileName, groupName);
|
||||
|
||||
@@ -202,11 +194,9 @@ LineGroup* LineGroup::lineGroupFactory(std::string groupName)
|
||||
double LineGroup::getDefaultWidth(std::string weightName, std::string groupName)
|
||||
{
|
||||
//default line weights
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
std::string lgName = groupName;
|
||||
if (groupName.empty()) {
|
||||
lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
lgName = Preferences::lineGroup();
|
||||
}
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
|
||||
|
||||
|
||||
212
src/Mod/TechDraw/App/Preferences.cpp
Normal file
212
src/Mod/TechDraw/App/Preferences.cpp
Normal file
@@ -0,0 +1,212 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <string>
|
||||
#include <QString>
|
||||
//#include <QFont>
|
||||
//#include <QColor>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "Preferences.h"
|
||||
|
||||
//getters for parameters used in multiple places.
|
||||
//ensure this is in sync with preference page uis
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
const double Preferences::DefaultFontSizeInMM = 5.0;
|
||||
|
||||
std::string Preferences::labelFont()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return fontName;
|
||||
}
|
||||
|
||||
QString Preferences::labelFontQString()
|
||||
{
|
||||
std::string fontName = labelFont();
|
||||
return QString::fromStdString(fontName);
|
||||
}
|
||||
|
||||
double Preferences::labelFontSizeMM()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Labels");
|
||||
return hGrp->GetFloat("LabelSize", DefaultFontSizeInMM);
|
||||
}
|
||||
|
||||
double Preferences::dimFontSizeMM()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
return hGrp->GetFloat("FontSize", DefaultFontSizeInMM);
|
||||
}
|
||||
|
||||
App::Color Preferences::normalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x000000FF)); //#000000 black
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
App::Color Preferences::selectColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("View");
|
||||
unsigned int defColor = hGrp->GetUnsigned("SelectionColor", 0x00FF00FF); //#00FF00 lime
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", defColor));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
App::Color Preferences::preselectColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("View");
|
||||
unsigned int defColor = hGrp->GetUnsigned("HighlightColor", 0xFFFF00FF); //#FFFF00 yellow
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", defColor));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
App::Color Preferences::vertexColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x000000FF)); //#000000 black
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
|
||||
//lightgray #D3D3D3
|
||||
|
||||
bool Preferences::keepPagesUpToDate()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/General");
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", true);
|
||||
return autoUpdate;
|
||||
}
|
||||
|
||||
bool Preferences::useGlobalDecimals()
|
||||
{
|
||||
bool result = false;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().
|
||||
GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
result = hGrp->GetBool("UseGlobalDecimals", true);
|
||||
return result;
|
||||
}
|
||||
|
||||
int Preferences::projectionAngle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/General");
|
||||
int projType = hGrp->GetInt("ProjectionAngle", 0); //First Angle
|
||||
return projType;
|
||||
}
|
||||
|
||||
std::string Preferences::lineGroup()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
return lgName;
|
||||
}
|
||||
|
||||
int Preferences::balloonArrow()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
int end = hGrp->GetInt("BalloonArrow", 0);
|
||||
return end;
|
||||
}
|
||||
|
||||
QString Preferences::defaultTemplate()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Files");
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates/";
|
||||
std::string defaultFileName = defaultDir + "A4_LandscapeTD.svg";
|
||||
QString templateFileName = QString::fromStdString(hGrp->GetASCII("TemplateFile",defaultFileName.c_str()));
|
||||
if (templateFileName.isEmpty()) {
|
||||
templateFileName = QString::fromStdString(defaultFileName);
|
||||
}
|
||||
return templateFileName;
|
||||
}
|
||||
|
||||
QString Preferences::defaultTemplateDir()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates";
|
||||
QString templateDir = QString::fromStdString(hGrp->GetASCII("TemplateDir", defaultDir.c_str()));
|
||||
return templateDir;
|
||||
}
|
||||
|
||||
std::string Preferences::lineGroupFile()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().
|
||||
GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/LineGroup/";
|
||||
std::string defaultFileName = defaultDir + "LineGroup.csv";
|
||||
|
||||
std::string lgFileName = hGrp->GetASCII("LineGroupFile",defaultFileName.c_str());
|
||||
return lgFileName;
|
||||
}
|
||||
75
src/Mod/TechDraw/App/Preferences.h
Normal file
75
src/Mod/TechDraw/App/Preferences.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 _Preferences_h_
|
||||
#define _Preferences_h_
|
||||
|
||||
#include <string>
|
||||
|
||||
//#include <QString>
|
||||
//#include <QFont>
|
||||
|
||||
//class QFont;
|
||||
class QString;
|
||||
//class QColor;
|
||||
|
||||
namespace App
|
||||
{
|
||||
class Color;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
//getters for parameters used in multiple places.
|
||||
class TechDrawExport Preferences {
|
||||
|
||||
public:
|
||||
static std::string labelFont();
|
||||
static QString labelFontQString();
|
||||
static double labelFontSizeMM();
|
||||
static double dimFontSizeMM();
|
||||
|
||||
static App::Color normalColor();
|
||||
static App::Color selectColor();
|
||||
static App::Color preselectColor();
|
||||
static App::Color vertexColor();
|
||||
|
||||
static bool useGlobalDecimals();
|
||||
static bool keepPagesUpToDate();
|
||||
|
||||
static int projectionAngle();
|
||||
static std::string lineGroup();
|
||||
|
||||
static int balloonArrow();
|
||||
|
||||
static QString defaultTemplate();
|
||||
static QString defaultTemplateDir();
|
||||
static std::string lineGroupFile();
|
||||
|
||||
|
||||
|
||||
static const double DefaultFontSizeInMM;
|
||||
};
|
||||
|
||||
} //end namespace TechDraw
|
||||
#endif
|
||||
@@ -219,6 +219,8 @@ SET(TechDrawGui_SRCS
|
||||
TaskDetail.ui
|
||||
TaskDetail.cpp
|
||||
TaskDetail.h
|
||||
PreferencesGui.cpp
|
||||
PreferencesGui.h
|
||||
)
|
||||
|
||||
SET(TechDrawGuiView_SRCS
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include <Mod/TechDraw/Gui/QGVPage.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "TaskProjGroup.h"
|
||||
#include "TaskSectionView.h"
|
||||
@@ -85,9 +86,9 @@
|
||||
#include "ViewProviderPage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
using namespace std;
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_PageDefault
|
||||
//===========================================================================
|
||||
@@ -109,15 +110,8 @@ CmdTechDrawPageDefault::CmdTechDrawPageDefault()
|
||||
void CmdTechDrawPageDefault::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates/";
|
||||
std::string defaultFileName = defaultDir + "A4_LandscapeTD.svg";
|
||||
QString templateFileName = QString::fromStdString(hGrp->GetASCII("TemplateFile",defaultFileName.c_str()));
|
||||
if (templateFileName.isEmpty()) {
|
||||
templateFileName = QString::fromStdString(defaultFileName);
|
||||
}
|
||||
QString templateFileName = Preferences::defaultTemplate();
|
||||
|
||||
std::string PageName = getUniqueObjectName("Page");
|
||||
std::string TemplateName = getUniqueObjectName("Template");
|
||||
@@ -179,11 +173,7 @@ CmdTechDrawPageTemplate::CmdTechDrawPageTemplate()
|
||||
void CmdTechDrawPageTemplate::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates";
|
||||
QString templateDir = QString::fromStdString(hGrp->GetASCII("TemplateDir", defaultDir.c_str()));
|
||||
QString templateDir = Preferences::defaultTemplateDir();
|
||||
QString templateFileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
|
||||
QString::fromUtf8(QT_TR_NOOP("Select a Template File")),
|
||||
templateDir,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>460</height>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -221,7 +221,7 @@
|
||||
<cstring>AutoHorizontal</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/LeaderLines</cstring>
|
||||
<cstring>Mod/TechDraw/LeaderLine</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "DlgPrefsTechDrawAnnotationImp.h"
|
||||
|
||||
|
||||
@@ -113,11 +114,7 @@ void DlgPrefsTechDrawAnnotationImp::changeEvent(QEvent *e)
|
||||
|
||||
int DlgPrefsTechDrawAnnotationImp::prefBalloonArrow(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
int end = hGrp->GetInt("BalloonArrow", 0);
|
||||
return end;
|
||||
return Preferences::balloonArrow();
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawAnnotationImp.cpp>
|
||||
|
||||
@@ -117,6 +117,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Hidden line color</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>HiddenColor</cstring>
|
||||
</property>
|
||||
@@ -146,7 +153,7 @@
|
||||
<color>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>20</blue>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
@@ -176,9 +183,9 @@
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>225</red>
|
||||
<green>225</green>
|
||||
<blue>225</blue>
|
||||
<red>211</red>
|
||||
<green>211</green>
|
||||
<blue>211</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
@@ -208,9 +215,9 @@
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>28</red>
|
||||
<green>173</green>
|
||||
<blue>28</blue>
|
||||
<red>0</red>
|
||||
<green>255</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
@@ -233,6 +240,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Section line color</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>SectionColor</cstring>
|
||||
</property>
|
||||
@@ -260,9 +274,9 @@
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>80</red>
|
||||
<green>80</green>
|
||||
<blue>80</blue>
|
||||
<red>211</red>
|
||||
<green>211</green>
|
||||
<blue>211</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
@@ -376,6 +390,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Centerline color</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CenterColor</cstring>
|
||||
</property>
|
||||
@@ -396,6 +417,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Color of vertices in views</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>VertexColor</cstring>
|
||||
</property>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "DlgPrefsTechDrawDimensionsImp.h"
|
||||
|
||||
|
||||
@@ -72,10 +73,11 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings()
|
||||
//set defaults for Quantity widgets if property not found
|
||||
//Quantity widgets do not use preset value since they are based on
|
||||
//QAbstractSpinBox
|
||||
double arrowDefault = 5.0;
|
||||
plsb_ArrowSize->setValue(arrowDefault);
|
||||
double fontDefault = 4.0;
|
||||
double fontDefault = Preferences::dimFontSizeMM();
|
||||
plsb_FontSize->setValue(fontDefault);
|
||||
// double arrowDefault = 5.0;
|
||||
// plsb_ArrowSize->setValue(arrowDefault);
|
||||
plsb_ArrowSize->setValue(fontDefault);
|
||||
|
||||
cbGlobalDecimals->onRestore();
|
||||
cbHiddenLineStyle->onRestore();
|
||||
@@ -107,13 +109,9 @@ void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
int DlgPrefsTechDrawDimensionsImp::prefArrowStyle(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 0);
|
||||
return style;
|
||||
int DlgPrefsTechDrawDimensionsImp::prefArrowStyle(void) const
|
||||
{
|
||||
return PreferencesGui::dimArrowStyle();
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawDimensionsImp.cpp>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>510</height>
|
||||
<width>496</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -277,7 +277,10 @@ for ProjectionGroups</string>
|
||||
<string>Font for labels</string>
|
||||
</property>
|
||||
<property name="currentFont">
|
||||
<font/>
|
||||
<font>
|
||||
<family>osifont</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>LabelFont</cstring>
|
||||
@@ -616,6 +619,12 @@ for ProjectionGroups</string>
|
||||
<property name="toolTip">
|
||||
<string>Name of the default PAT pattern</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Diamond</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>NamePattern</cstring>
|
||||
</property>
|
||||
|
||||
@@ -25,10 +25,15 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawGeomHatch.h>
|
||||
|
||||
#include "DlgPrefsTechDrawGeneralImp.h"
|
||||
#include <Gui/PrefWidgets.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
DlgPrefsTechDrawGeneralImp::DlgPrefsTechDrawGeneralImp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
@@ -64,8 +69,18 @@ void DlgPrefsTechDrawGeneralImp::saveSettings()
|
||||
|
||||
void DlgPrefsTechDrawGeneralImp::loadSettings()
|
||||
{
|
||||
double labelDefault = 8.0;
|
||||
// double labelDefault = 8.0;
|
||||
double labelDefault = Preferences::labelFontSizeMM();
|
||||
plsb_LabelSize->setValue(labelDefault);
|
||||
pfb_LabelFont->setCurrentText(Preferences::labelFontQString());
|
||||
|
||||
|
||||
pfc_DefTemp->setFileName(Preferences::defaultTemplate());
|
||||
pfc_DefDir->setFileName(Preferences::defaultTemplateDir());
|
||||
pfc_HatchFile->setFileName(QString::fromStdString(DrawHatch::prefSvgHatch()));
|
||||
pfc_FilePattern->setFileName(QString::fromStdString(DrawGeomHatch::prefGeomHatchFile()));
|
||||
pfc_Welding->setFileName(PreferencesGui::weldingDirectory());
|
||||
pfc_LineGroup->setFileName(QString::fromUtf8(Preferences::lineGroupFile().c_str()));
|
||||
|
||||
pfc_DefTemp->onRestore();
|
||||
pfc_DefDir->onRestore();
|
||||
|
||||
207
src/Mod/TechDraw/Gui/PreferencesGui.cpp
Normal file
207
src/Mod/TechDraw/Gui/PreferencesGui.cpp
Normal file
@@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <string>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "PreferencesGui.h"
|
||||
|
||||
//getters for parameters used in multiple places.
|
||||
//ensure this is in sync with preference page uis
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QFont PreferencesGui::labelFontQFont()
|
||||
{
|
||||
QString name = Preferences::labelFontQString();
|
||||
QFont f(name);
|
||||
return f;
|
||||
}
|
||||
|
||||
int PreferencesGui::labelFontSizePX()
|
||||
{
|
||||
return (int) (Rez::guiX(Preferences::labelFontSizeMM()) + 0.5);
|
||||
}
|
||||
|
||||
int PreferencesGui::dimFontSizePX()
|
||||
{
|
||||
return (int) (Rez::guiX(Preferences::dimFontSizeMM()) + 0.5);
|
||||
}
|
||||
|
||||
QColor PreferencesGui::normalQColor()
|
||||
{
|
||||
App::Color fcColor = Preferences::normalColor();
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
QColor PreferencesGui::selectQColor()
|
||||
{
|
||||
App::Color fcColor = Preferences::selectColor();
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
QColor PreferencesGui::preselectQColor()
|
||||
{
|
||||
App::Color fcColor = Preferences::preselectColor();
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
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));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
QColor PreferencesGui::sectionLineQColor()
|
||||
{
|
||||
return sectionLineColor().asValue<QColor>();
|
||||
}
|
||||
|
||||
App::Color PreferencesGui::centerColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x000000FF));
|
||||
return fcColor;
|
||||
}
|
||||
|
||||
QColor PreferencesGui::centerQColor()
|
||||
{
|
||||
return centerColor().asValue<QColor>();
|
||||
}
|
||||
|
||||
QColor PreferencesGui::vertexQColor()
|
||||
{
|
||||
return Preferences::vertexColor().asValue<QColor>();
|
||||
}
|
||||
|
||||
App::Color PreferencesGui::dimColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor PreferencesGui::dimQColor()
|
||||
{
|
||||
return PreferencesGui::dimColor().asValue<QColor>();
|
||||
}
|
||||
|
||||
|
||||
App::Color PreferencesGui::leaderColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/LeaderLine");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor PreferencesGui::leaderQColor()
|
||||
{
|
||||
return PreferencesGui::leaderColor().asValue<QColor>();
|
||||
}
|
||||
|
||||
int PreferencesGui::dimArrowStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 0);
|
||||
return style;
|
||||
}
|
||||
|
||||
double PreferencesGui::dimArrowSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
double size = hGrp->GetFloat("ArrowSize", Preferences::dimFontSizeMM());
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
double PreferencesGui::edgeFuzz()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/General");
|
||||
double result = hGrp->GetFloat("EdgeFuzz",10.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
Qt::PenStyle PreferencesGui::sectionLineStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("SectionLine", 2));
|
||||
return sectStyle;
|
||||
}
|
||||
|
||||
|
||||
int PreferencesGui::mattingStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
int style = hGrp->GetInt("MattingStyle", 0);
|
||||
return style;
|
||||
}
|
||||
|
||||
//lightgray #D3D3D3
|
||||
|
||||
QString PreferencesGui::weldingDirectory()
|
||||
{
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Symbols/Welding/AWS/";
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string symbolDir = hGrp->GetASCII("WeldingDir", defaultDir.c_str());
|
||||
QString qSymbolDir = QString::fromUtf8(symbolDir.c_str());
|
||||
return qSymbolDir;
|
||||
}
|
||||
|
||||
69
src/Mod/TechDraw/Gui/PreferencesGui.h
Normal file
69
src/Mod/TechDraw/Gui/PreferencesGui.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 _PreferencesGui_h_
|
||||
#define _PreferencesGui_h_
|
||||
|
||||
class QFont;
|
||||
class QString;
|
||||
class QColor;
|
||||
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
//getters for parameters used in multiple places.
|
||||
class TechDrawGuiExport PreferencesGui {
|
||||
|
||||
public:
|
||||
static QFont labelFontQFont();
|
||||
static int labelFontSizePX();
|
||||
static int dimFontSizePX();
|
||||
|
||||
static QColor normalQColor();
|
||||
static QColor selectQColor();
|
||||
static QColor preselectQColor();
|
||||
static App::Color sectionLineColor();
|
||||
static QColor sectionLineQColor();
|
||||
static App::Color centerColor();
|
||||
static QColor centerQColor();
|
||||
static QColor vertexQColor();
|
||||
static App::Color leaderColor();
|
||||
static QColor leaderQColor();
|
||||
static App::Color dimColor();
|
||||
static QColor dimQColor();
|
||||
|
||||
static int dimArrowStyle();
|
||||
static double dimArrowSize();
|
||||
|
||||
static double edgeFuzz();
|
||||
|
||||
static Qt::PenStyle sectionLineStyle();
|
||||
static int mattingStyle();
|
||||
|
||||
static QString weldingDirectory();
|
||||
|
||||
};
|
||||
|
||||
} //end namespace TechDrawGui
|
||||
#endif
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGICMark.h"
|
||||
#include "QGIView.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGCustomText.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -186,29 +187,17 @@ void QGCustomText::paint ( QPainter * painter, const QStyleOptionGraphicsItem *
|
||||
|
||||
QColor QGCustomText::getNormalColor() //preference!
|
||||
{
|
||||
// Base::Console().Message("QGCT::getNormalColor() - pref\n");
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
return PreferencesGui::normalQColor();
|
||||
}
|
||||
|
||||
QColor QGCustomText::getPreColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0xFFFF0000));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::preselectQColor();
|
||||
}
|
||||
|
||||
QColor QGCustomText::getSelectColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x00FF0000));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::selectQColor();
|
||||
}
|
||||
|
||||
Base::Reference<ParameterGrp> QGCustomText::getParmGroup()
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIVertex.h"
|
||||
#include "QGIView.h"
|
||||
@@ -419,10 +420,7 @@ QPainterPath QGEPath::shape() const
|
||||
|
||||
double QGEPath::getEdgeFuzz(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double result = hGrp->GetFloat("EdgeFuzz",10.0);
|
||||
return result;
|
||||
return PreferencesGui::edgeFuzz();
|
||||
}
|
||||
|
||||
void QGEPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIArrow.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -310,19 +311,12 @@ QPainterPath QGIArrow::makePyramid(Base::Vector3d dir, double length)
|
||||
|
||||
int QGIArrow::getPrefArrowStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 0);
|
||||
return style;
|
||||
return PreferencesGui::dimArrowStyle();
|
||||
}
|
||||
|
||||
double QGIArrow::getPrefArrowSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double style = hGrp->GetFloat("ArrowSize", 3.5);
|
||||
return style;
|
||||
return PreferencesGui::dimArrowSize();
|
||||
}
|
||||
|
||||
double QGIArrow::getOverlapAdjust(int style, double size)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGICenterLine.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -71,10 +72,7 @@ void QGICenterLine::setBounds(double x1,double y1,double x2,double y2)
|
||||
|
||||
QColor QGICenterLine::getCenterColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x00000000));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::centerQColor();
|
||||
}
|
||||
|
||||
Qt::PenStyle QGICenterLine::getCenterStyle()
|
||||
|
||||
@@ -37,12 +37,14 @@
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGICMark.h"
|
||||
#include "QGIDecoration.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIDecoration::QGIDecoration() :
|
||||
m_colCurrent(Qt::black),
|
||||
@@ -91,35 +93,17 @@ void QGIDecoration::setColor(QColor c)
|
||||
|
||||
QColor QGIDecoration::prefNormalColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
return PreferencesGui::normalQColor();
|
||||
}
|
||||
|
||||
QColor QGIDecoration::prefPreColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
return PreferencesGui::preselectQColor();
|
||||
}
|
||||
|
||||
QColor QGIDecoration::prefSelectColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
return PreferencesGui::selectQColor();
|
||||
}
|
||||
|
||||
void QGIDecoration::makeMark(double x, double y)
|
||||
|
||||
@@ -36,9 +36,11 @@
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIDimLines.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIDimLines::QGIDimLines()
|
||||
{
|
||||
@@ -65,10 +67,7 @@ QPainterPath QGIDimLines::shape() const
|
||||
|
||||
double QGIDimLines::getEdgeFuzz(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double result = hGrp->GetFloat("EdgeFuzz",10.0);
|
||||
return result;
|
||||
return PreferencesGui::edgeFuzz();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,11 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIEdge.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIEdge::QGIEdge(int index) :
|
||||
projIndex(index),
|
||||
@@ -83,7 +85,7 @@ 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", 0x08080800));
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("HiddenColor", 0x000000FF));
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
@@ -99,10 +101,7 @@ Qt::PenStyle QGIEdge::getHiddenStyle()
|
||||
|
||||
double QGIEdge::getEdgeFuzz(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double result = hGrp->GetFloat("EdgeFuzz",10.0);
|
||||
return result;
|
||||
return PreferencesGui::edgeFuzz();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,10 +35,12 @@
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include <qmath.h>
|
||||
#include "Rez.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIGhostHighlight.h"
|
||||
|
||||
@@ -52,7 +54,7 @@ QGIGhostHighlight::QGIGhostHighlight()
|
||||
|
||||
//make the ghost very visible
|
||||
QFont f(QGIView::getPrefFont());
|
||||
double fontSize = QGIView::getPrefFontSize();
|
||||
double fontSize = Preferences::labelFontSizeMM();
|
||||
setFont(f, fontSize);
|
||||
setReference("drag");
|
||||
setStyle(Qt::SolidLine);
|
||||
|
||||
@@ -37,10 +37,12 @@
|
||||
#include <qmath.h>
|
||||
#include "Rez.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIHighlight.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIHighlight::QGIHighlight()
|
||||
{
|
||||
@@ -175,26 +177,17 @@ void QGIHighlight::setFont(QFont f, double fsize)
|
||||
|
||||
QColor QGIHighlight::getHighlightColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionColor", 0x08080800));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::sectionLineQColor();
|
||||
}
|
||||
|
||||
Qt::PenStyle QGIHighlight::getHighlightStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw");
|
||||
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("SectionLine",2));
|
||||
return sectStyle;
|
||||
return PreferencesGui::sectionLineStyle();
|
||||
}
|
||||
|
||||
int QGIHighlight::getHoleStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
int style = hGrp->GetInt("MattingStyle", 0);
|
||||
return style;
|
||||
return PreferencesGui::mattingStyle();
|
||||
}
|
||||
|
||||
void QGIHighlight::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIArrow.h"
|
||||
#include "ViewProviderLeader.h"
|
||||
#include "MDIViewPage.h"
|
||||
@@ -67,9 +68,8 @@
|
||||
|
||||
#include "QGILeaderLine.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
//**************************************************************
|
||||
QGILeaderLine::QGILeaderLine() :
|
||||
@@ -577,21 +577,13 @@ TechDraw::DrawLeaderLine* QGILeaderLine::getFeature(void)
|
||||
|
||||
double QGILeaderLine::getEdgeFuzz(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double result = hGrp->GetFloat("EdgeFuzz",10.0);
|
||||
return result;
|
||||
return PreferencesGui::edgeFuzz();
|
||||
}
|
||||
|
||||
QColor QGILeaderLine::getNormalColor()
|
||||
{
|
||||
// Base::Console().Message("QGILL::getNormalColor()\n");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/LeaderLines");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
m_colNormal = PreferencesGui::leaderQColor();
|
||||
|
||||
auto lead( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
|
||||
if( lead == nullptr ) {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <qmath.h>
|
||||
#include <QRectF>
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGCustomRect.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "QGIMatting.h"
|
||||
@@ -103,10 +104,7 @@ void QGIMatting::draw()
|
||||
|
||||
int QGIMatting::getHoleStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
int style = hGrp->GetInt("MattingStyle", 0l);
|
||||
return style;
|
||||
return PreferencesGui::mattingStyle();
|
||||
}
|
||||
|
||||
//need this because QQGIG only updates BR when items added/deleted.
|
||||
|
||||
@@ -35,10 +35,12 @@
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIView.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIPrimPath::QGIPrimPath():
|
||||
m_width(0),
|
||||
@@ -164,10 +166,7 @@ QColor QGIPrimPath::getNormalColor()
|
||||
if (parent != nullptr) {
|
||||
result = parent->getNormalColor();
|
||||
} else {
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
result = PreferencesGui::normalQColor();
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -187,10 +186,7 @@ QColor QGIPrimPath::getPreColor()
|
||||
if (parent != nullptr) {
|
||||
result = parent->getPreColor();
|
||||
} else {
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0xFFFF0000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
result = PreferencesGui::preselectQColor();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -209,10 +205,7 @@ QColor QGIPrimPath::getSelectColor()
|
||||
if (parent != nullptr) {
|
||||
result = parent->getSelectColor();
|
||||
} else {
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x00FF0000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
result = PreferencesGui::selectQColor();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -58,12 +58,14 @@
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIArrow.h"
|
||||
#include "ViewProviderRichAnno.h"
|
||||
#include "MDIViewPage.h"
|
||||
@@ -342,22 +344,13 @@ QPen QGIRichAnno::rectPen() const
|
||||
|
||||
QFont QGIRichAnno::prefFont(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
QString family = Base::Tools::fromStdString(fontName);
|
||||
QFont result;
|
||||
result.setFamily(family);
|
||||
return result;
|
||||
return PreferencesGui::labelFontQFont();
|
||||
}
|
||||
|
||||
double QGIRichAnno::prefPointSize(void)
|
||||
{
|
||||
// Base::Console().Message("QGIRA::prefPointSize()\n");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", 5.0); // this is mm, not pts!
|
||||
|
||||
double fontSize = Preferences::dimFontSizeMM();
|
||||
//this conversion is only approximate. the factor changes for different fonts.
|
||||
// double mmToPts = 2.83; //theoretical value
|
||||
double mmToPts = 2.00; //practical value. seems to be reasonable for common fonts.
|
||||
|
||||
@@ -32,10 +32,12 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include <qmath.h>
|
||||
#include "Rez.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGISectionLine.h"
|
||||
|
||||
@@ -282,10 +284,7 @@ void QGISectionLine::setSectionColor(QColor c)
|
||||
|
||||
QColor QGISectionLine::getSectionColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionColor", 0x00000000));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::sectionLineQColor();
|
||||
}
|
||||
|
||||
//SectionLineStyle
|
||||
@@ -297,10 +296,7 @@ void QGISectionLine::setSectionStyle(int style)
|
||||
|
||||
Qt::PenStyle QGISectionLine::getSectionStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (hGrp->GetInt("SectionLine", 2));
|
||||
return sectStyle;
|
||||
return PreferencesGui::sectionLineStyle();
|
||||
}
|
||||
|
||||
//ASME("traditional") vs ISO("reference arrow method") arrows
|
||||
|
||||
@@ -36,18 +36,21 @@
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
|
||||
#include <qmath.h>
|
||||
#include "Rez.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIWeldSymbol.h"
|
||||
#include "QGITile.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGITile::QGITile(TechDraw::DrawTileWeld* dtw) :
|
||||
m_textL(QString::fromUtf8(" ")),
|
||||
@@ -189,7 +192,7 @@ void QGITile::makeText(void)
|
||||
}
|
||||
|
||||
double vertAdjust = 0.0;
|
||||
double minVertAdjust = prefFontSize() * 0.1;
|
||||
double minVertAdjust = PreferencesGui::labelFontSizePX() * 0.1;
|
||||
if (m_font.pixelSize() > m_high) {
|
||||
vertAdjust = ((m_font.pixelSize() - m_high) / 2.0) + minVertAdjust;
|
||||
}
|
||||
@@ -381,19 +384,14 @@ double QGITile::getSymbolFactor(void) const
|
||||
|
||||
double QGITile::prefFontSize(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double sizeMM = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
double fontSize = QGIView::calculateFontPixelSize(sizeMM);
|
||||
return fontSize;
|
||||
// Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
// GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
return Preferences::dimFontSizeMM();
|
||||
}
|
||||
|
||||
QString QGITile::prefTextFont(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return QString::fromStdString(fontName);
|
||||
return Preferences::labelFontQString();
|
||||
}
|
||||
|
||||
void QGITile::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIVertex.h"
|
||||
|
||||
@@ -44,12 +45,7 @@ QGIVertex::QGIVertex(int index) :
|
||||
projIndex(index),
|
||||
m_radius(2)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x00000000));
|
||||
QColor vertexColor = fcColor.asValue<QColor>();
|
||||
|
||||
QColor vertexColor = PreferencesGui::vertexQColor();
|
||||
setFill(vertexColor, Qt::SolidPattern);
|
||||
|
||||
setRadius(m_radius);
|
||||
|
||||
@@ -72,9 +72,11 @@
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIView.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
const float labelCaptionFudge = 0.2f; // temp fiddle for devel
|
||||
|
||||
@@ -96,7 +98,8 @@ QGIView::QGIView()
|
||||
m_pen.setColor(m_colCurrent);
|
||||
|
||||
//Border/Label styling
|
||||
m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
// m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
m_font.setPixelSize(PreferencesGui::labelFontSizePX());
|
||||
|
||||
m_decorPen.setStyle(Qt::DashLine);
|
||||
m_decorPen.setWidth(0); // 0 => 1px "cosmetic pen"
|
||||
@@ -437,7 +440,8 @@ void QGIView::drawCaption()
|
||||
QRectF displayArea = customChildrenBoundingRect();
|
||||
m_caption->setDefaultTextColor(m_colCurrent);
|
||||
m_font.setFamily(getPrefFont());
|
||||
m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
// m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
m_font.setPixelSize(PreferencesGui::labelFontSizePX());
|
||||
m_caption->setFont(m_font);
|
||||
QString captionStr = QString::fromUtf8(getViewObject()->Caption.getValue());
|
||||
m_caption->setPlainText(captionStr);
|
||||
@@ -449,7 +453,8 @@ void QGIView::drawCaption()
|
||||
if (getFrameState() || vp->KeepLabel.getValue()) { //place below label if label visible
|
||||
m_caption->setY(displayArea.bottom() + labelHeight);
|
||||
} else {
|
||||
m_caption->setY(displayArea.bottom() + labelCaptionFudge * getPrefFontSize());
|
||||
// m_caption->setY(displayArea.bottom() + labelCaptionFudge * getPrefFontSize());
|
||||
m_caption->setY(displayArea.bottom() + labelCaptionFudge * Preferences::labelFontSizeMM());
|
||||
}
|
||||
m_caption->show();
|
||||
}
|
||||
@@ -478,7 +483,8 @@ void QGIView::drawBorder()
|
||||
|
||||
m_label->setDefaultTextColor(m_colCurrent);
|
||||
m_font.setFamily(getPrefFont());
|
||||
m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
// m_font.setPixelSize(calculateFontPixelSize(getPrefFontSize()));
|
||||
m_font.setPixelSize(PreferencesGui::labelFontSizePX());
|
||||
|
||||
m_label->setFont(m_font);
|
||||
QString labelStr = QString::fromUtf8(getViewObject()->Label.getValue());
|
||||
@@ -668,29 +674,17 @@ void QGIView::addArbitraryItem(QGraphicsItem* qgi)
|
||||
//TODO: change name to prefNormalColor()
|
||||
QColor QGIView::getNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroupCol();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
return m_colNormal;
|
||||
return PreferencesGui::normalQColor();
|
||||
}
|
||||
|
||||
QColor QGIView::getPreColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroupCol();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0xFFFF0000));
|
||||
m_colPre = fcColor.asValue<QColor>();
|
||||
return m_colPre;
|
||||
return PreferencesGui::preselectQColor();
|
||||
}
|
||||
|
||||
QColor QGIView::getSelectColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroupCol();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x00FF0000));
|
||||
m_colSel = fcColor.asValue<QColor>();
|
||||
return m_colSel;
|
||||
return PreferencesGui::selectQColor();
|
||||
}
|
||||
|
||||
Base::Reference<ParameterGrp> QGIView::getParmGroupCol()
|
||||
@@ -702,24 +696,17 @@ Base::Reference<ParameterGrp> QGIView::getParmGroupCol()
|
||||
|
||||
QString QGIView::getPrefFont()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return QString::fromStdString(fontName);
|
||||
return Preferences::labelFontQString();
|
||||
}
|
||||
|
||||
double QGIView::getPrefFontSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
return hGrp->GetFloat("LabelSize", DefaultFontSizeInMM);
|
||||
return Preferences::labelFontSizeMM();
|
||||
}
|
||||
|
||||
double QGIView::getDimFontSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
return hGrp->GetFloat("FontSize", DefaultFontSizeInMM);
|
||||
return Preferences::dimFontSizeMM();
|
||||
}
|
||||
|
||||
int QGIView::calculateFontPixelSize(double sizeInMillimetres)
|
||||
|
||||
@@ -57,9 +57,11 @@
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIArrow.h"
|
||||
#include "QGIDimLines.h"
|
||||
#include "QGIViewBalloon.h"
|
||||
@@ -399,6 +401,11 @@ void QGIViewBalloon::updateView(bool update)
|
||||
QString labelText = QString::fromUtf8(balloon->Text.getStrValue().data());
|
||||
balloonLabel->setDimString(labelText, Rez::guiX(balloon->TextWrapLen.getValue()));
|
||||
balloonLabel->setColor(getNormalColor());
|
||||
balloonLines->setNormalColor(getNormalColor());
|
||||
balloonShape->setNormalColor(getNormalColor());
|
||||
arrow->setNormalColor(getNormalColor());
|
||||
arrow->setFillColor(getNormalColor());
|
||||
|
||||
}
|
||||
|
||||
updateBalloon();
|
||||
@@ -836,11 +843,7 @@ void QGIViewBalloon::setPens(void)
|
||||
|
||||
QColor QGIViewBalloon::getNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
m_colNormal = PreferencesGui::dimQColor();
|
||||
|
||||
auto balloon( dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()) );
|
||||
if( balloon == nullptr )
|
||||
@@ -857,10 +860,7 @@ QColor QGIViewBalloon::getNormalColor()
|
||||
|
||||
int QGIViewBalloon::prefDefaultArrow() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
int arrow = hGrp->GetInt("BalloonArrow", QGIArrow::getPrefArrowStyle());
|
||||
return arrow;
|
||||
return Preferences::balloonArrow();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,9 +58,11 @@
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
|
||||
#include "QGCustomLabel.h"
|
||||
#include "QGCustomBorder.h"
|
||||
@@ -360,12 +362,13 @@ int QGIDatumLabel::getPrecision(void)
|
||||
{
|
||||
int precision;
|
||||
bool global = false;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
global = hGrp->GetBool("UseGlobalDecimals", true);
|
||||
global = Preferences::useGlobalDecimals();
|
||||
if (global) {
|
||||
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);
|
||||
}
|
||||
return precision;
|
||||
@@ -2079,12 +2082,7 @@ void QGIViewDimension::drawAngle(TechDraw::DrawViewDimension *dimension, ViewPro
|
||||
|
||||
QColor QGIViewDimension::prefNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00110000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
m_colNormal = PreferencesGui::dimQColor();
|
||||
|
||||
// auto dim( dynamic_cast<TechDraw::DrawViewDimension*>(getViewObject()) );
|
||||
TechDraw::DrawViewDimension* dim = nullptr;
|
||||
@@ -2109,7 +2107,7 @@ QColor QGIViewDimension::prefNormalColor()
|
||||
return m_colNormal;
|
||||
}
|
||||
|
||||
fcColor = vpDim->Color.getValue();
|
||||
App::Color fcColor = vpDim->Color.getValue();
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
return m_colNormal;
|
||||
}
|
||||
|
||||
@@ -60,9 +60,11 @@
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/Cosmetic.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIFace.h"
|
||||
#include "QGIEdge.h"
|
||||
#include "QGIVertex.h"
|
||||
@@ -540,11 +542,7 @@ void QGIViewPart::drawViewPart()
|
||||
#endif //#if MOD_TECHDRAW_HANDLE_FACES
|
||||
|
||||
// Draw Edges
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcEdgeColor;
|
||||
fcEdgeColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
QColor edgeColor = fcEdgeColor.asValue<QColor>();
|
||||
QColor edgeColor = PreferencesGui::normalQColor();
|
||||
|
||||
const std::vector<TechDraw::BaseGeom *> &geoms = viewPart->getEdgeGeometry();
|
||||
std::vector<TechDraw::BaseGeom *>::const_iterator itGeom = geoms.begin();
|
||||
@@ -623,14 +621,10 @@ void QGIViewPart::drawViewPart()
|
||||
|
||||
|
||||
// Draw Vertexs:
|
||||
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0);
|
||||
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x00000000));
|
||||
QColor vertexColor = fcColor.asValue<QColor>();
|
||||
QColor vertexColor = PreferencesGui::vertexQColor();
|
||||
|
||||
bool showVertices = true;
|
||||
bool showCenterMarks = true;
|
||||
@@ -907,7 +901,8 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
|
||||
double sectionFudge = Rez::guiX(10.0);
|
||||
double xVal, yVal;
|
||||
// double fontSize = getPrefFontSize();
|
||||
double fontSize = getDimFontSize();
|
||||
// double fontSize = getDimFontSize();
|
||||
double fontSize = Preferences::dimFontSizeMM();
|
||||
if (horiz) {
|
||||
double width = Rez::guiX(viewPart->getBoxX());
|
||||
double height = Rez::guiX(viewPart->getBoxY());
|
||||
@@ -1011,7 +1006,8 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
|
||||
}
|
||||
|
||||
if (b) {
|
||||
double fontSize = getPrefFontSize();
|
||||
// double fontSize = getPrefFontSize();
|
||||
double fontSize = Preferences::labelFontSizeMM();
|
||||
QGIHighlight* highlight = new QGIHighlight();
|
||||
addToGroup(highlight);
|
||||
highlight->setPos(0.0,0.0); //sb setPos(center.x,center.y)?
|
||||
|
||||
@@ -55,9 +55,11 @@
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "ViewProviderWeld.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
@@ -252,7 +254,8 @@ void QGIWeldSymbol::drawAllAround(void)
|
||||
m_allAround->setNormalColor(getCurrentColor());
|
||||
|
||||
m_allAround->setFill(Qt::NoBrush);
|
||||
m_allAround->setRadius(calculateFontPixelSize(getDimFontSize()));
|
||||
// m_allAround->setRadius(calculateFontPixelSize(getDimFontSize()));
|
||||
m_allAround->setRadius(PreferencesGui::dimFontSizePX());
|
||||
double width = m_qgLead->getLineWidth();
|
||||
m_allAround->setWidth(width);
|
||||
m_allAround->setZValue(ZVALUE::DIMENSION);
|
||||
@@ -323,7 +326,8 @@ void QGIWeldSymbol::drawFieldFlag()
|
||||
QPointF(-2.0, -2.5),
|
||||
QPointF(0.0, -2.0) };
|
||||
//flag sb about 2x text?
|
||||
double scale = calculateFontPixelSize(getDimFontSize()) / 2.0;
|
||||
// double scale = calculateFontPixelSize(getDimFontSize()) / 2.0;
|
||||
double scale = PreferencesGui::dimFontSizePX() / 2.0;
|
||||
QPainterPath path;
|
||||
path.moveTo(flagPoints.at(0) * scale);
|
||||
int i = 1;
|
||||
@@ -510,29 +514,18 @@ TechDraw::DrawWeldSymbol* QGIWeldSymbol::getFeature(void)
|
||||
//preference
|
||||
QColor QGIWeldSymbol::prefNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/LeaderLines");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
m_colNormal = PreferencesGui::leaderQColor();
|
||||
return m_colNormal;
|
||||
}
|
||||
|
||||
double QGIWeldSymbol::prefArrowSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double size = Rez::guiX(hGrp->GetFloat("ArrowSize", 3.5));
|
||||
return size;
|
||||
return PreferencesGui::dimArrowSize();
|
||||
}
|
||||
|
||||
double QGIWeldSymbol::prefFontSize(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double sizeMM = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
double fontSize = QGIView::calculateFontPixelSize(sizeMM);
|
||||
return fontSize;
|
||||
return Preferences::labelFontSizeMM();
|
||||
}
|
||||
|
||||
QRectF QGIWeldSymbol::boundingRect() const
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <Mod/TechDraw/Gui/ui_TaskCenterLine.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
@@ -419,9 +420,7 @@ void TaskCenterLine::enableTaskButtons(bool b)
|
||||
|
||||
double TaskCenterLine::getCenterWidth()
|
||||
{
|
||||
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 width = lg->getWeight("Graphic");
|
||||
@@ -444,10 +443,7 @@ Qt::PenStyle TaskCenterLine::getCenterStyle()
|
||||
|
||||
QColor TaskCenterLine::getCenterColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x00000000));
|
||||
return fcColor.asValue<QColor>();
|
||||
return PreferencesGui::centerQColor();
|
||||
}
|
||||
|
||||
double TaskCenterLine::getExtendBy(void)
|
||||
|
||||
@@ -47,10 +47,12 @@
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskLeaderLine.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
@@ -757,18 +759,12 @@ void TaskLeaderLine::enableTaskButtons(bool b)
|
||||
|
||||
int TaskLeaderLine::getPrefArrowStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 0);
|
||||
return style;
|
||||
return PreferencesGui::dimArrowStyle();
|
||||
}
|
||||
|
||||
double TaskLeaderLine::prefWeight() const
|
||||
{
|
||||
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("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
@@ -777,14 +773,9 @@ double TaskLeaderLine::prefWeight() const
|
||||
|
||||
App::Color TaskLeaderLine::prefLineColor(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Markups");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
return result;
|
||||
return PreferencesGui::leaderColor();
|
||||
}
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
bool TaskLeaderLine::accept()
|
||||
|
||||
@@ -48,10 +48,12 @@
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskRichAnno.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
@@ -314,10 +316,7 @@ void TaskRichAnno::onEditorExit(void)
|
||||
|
||||
double TaskRichAnno::prefWeight() const
|
||||
{
|
||||
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("Graphic");
|
||||
delete lg; //Coverity CID 174670
|
||||
@@ -326,11 +325,7 @@ double TaskRichAnno::prefWeight() const
|
||||
|
||||
App::Color TaskRichAnno::prefLineColor(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Markups");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
return result;
|
||||
return PreferencesGui::leaderColor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,10 +57,12 @@
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/Cosmetic.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskWeldingSymbol.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
@@ -195,7 +197,7 @@ void TaskWeldingSymbol::setUiPrimary()
|
||||
{
|
||||
// Base::Console().Message("TWS::setUiPrimary()\n");
|
||||
setWindowTitle(QObject::tr("Create Welding Symbol"));
|
||||
m_currDir = QString::fromUtf8(prefSymbolDir().c_str());
|
||||
m_currDir = PreferencesGui::weldingDirectory();
|
||||
ui->fcSymbolDir->setFileName(m_currDir);
|
||||
|
||||
ui->pbArrowSymbol->setFocus();
|
||||
@@ -215,7 +217,7 @@ void TaskWeldingSymbol::setUiEdit()
|
||||
// Base::Console().Message("TWS::setUiEdit()\n");
|
||||
setWindowTitle(QObject::tr("Edit Welding Symbol"));
|
||||
|
||||
m_currDir = QString::fromUtf8(prefSymbolDir().c_str()); //sb path part of 1st symbol file??
|
||||
m_currDir = PreferencesGui::weldingDirectory();
|
||||
ui->fcSymbolDir->setFileName(m_currDir);
|
||||
|
||||
ui->cbAllAround->setChecked(m_weldFeat->AllAround.getValue());
|
||||
@@ -634,16 +636,6 @@ void TaskWeldingSymbol::enableTaskButtons(bool b)
|
||||
m_btnCancel->setEnabled(b);
|
||||
}
|
||||
|
||||
std::string TaskWeldingSymbol::prefSymbolDir()
|
||||
{
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Symbols/Welding/AWS/";
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string symbolDir = hGrp->GetASCII("WeldingDir", defaultDir.c_str());
|
||||
return symbolDir;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
bool TaskWeldingSymbol::accept()
|
||||
|
||||
@@ -47,11 +47,14 @@
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "TaskBalloon.h"
|
||||
#include "ViewProviderBalloon.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderBalloon, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
@@ -64,28 +67,17 @@ ViewProviderBalloon::ViewProviderBalloon()
|
||||
|
||||
static const char *group = "Balloon Format";
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
ADD_PROPERTY_TYPE(Font,(fontName.c_str()),group,App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize,(fontSize),group,(App::PropertyType)(App::Prop_None),"Dimension text size in units");
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
ADD_PROPERTY_TYPE(Font,(Preferences::labelFont().c_str()),group,App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize,(Preferences::dimFontSizeMM()),
|
||||
group,(App::PropertyType)(App::Prop_None),"Balloon text size in units");
|
||||
std::string lgName = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
|
||||
double weight = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
ADD_PROPERTY_TYPE(LineWidth,(weight),group,(App::PropertyType)(App::Prop_None),"Leader line width");
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
ADD_PROPERTY_TYPE(Color,(fcColor),group,App::Prop_None,"Color of the text");
|
||||
ADD_PROPERTY_TYPE(Color,(PreferencesGui::dimColor()),
|
||||
group,App::Prop_None,"Color of the balloon");
|
||||
}
|
||||
|
||||
ViewProviderBalloon::~ViewProviderBalloon()
|
||||
@@ -188,4 +180,4 @@ bool ViewProviderBalloon::canDelete(App::DocumentObject *obj) const
|
||||
// thus we can pass this action
|
||||
Q_UNUSED(obj)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,14 @@
|
||||
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/LandmarkDimension.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIViewDimension.h"
|
||||
#include "ViewProviderDimension.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
const char *ViewProviderDimension::StandardAndStyleEnums[]=
|
||||
{ "ISO Oriented", "ISO Referencing", "ASME Inlined", "ASME Referencing", NULL };
|
||||
@@ -64,8 +67,10 @@ ViewProviderDimension::ViewProviderDimension()
|
||||
|
||||
static const char *group = "Dim Format";
|
||||
|
||||
ADD_PROPERTY_TYPE(Font, (prefFont().c_str()), group, App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize, (prefFontSize()), group, (App::PropertyType)(App::Prop_None),
|
||||
ADD_PROPERTY_TYPE(Font, (Preferences::labelFont().c_str()),
|
||||
group, App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize, (Preferences::dimFontSizeMM()),
|
||||
group, (App::PropertyType)(App::Prop_None),
|
||||
"Dimension text size in units");
|
||||
ADD_PROPERTY_TYPE(LineWidth, (prefWeight()), group, (App::PropertyType)(App::Prop_None),
|
||||
"Dimension line width");
|
||||
@@ -162,39 +167,23 @@ TechDraw::DrawViewDimension* ViewProviderDimension::getViewObject() const
|
||||
}
|
||||
|
||||
App::Color ViewProviderDimension::prefColor() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00001100));
|
||||
return fcColor;
|
||||
{
|
||||
return PreferencesGui::dimColor();
|
||||
}
|
||||
|
||||
std::string ViewProviderDimension::prefFont() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return fontName;
|
||||
{
|
||||
return Preferences::labelFont();
|
||||
}
|
||||
|
||||
double ViewProviderDimension::prefFontSize() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
return fontSize;
|
||||
return Preferences::dimFontSizeMM();
|
||||
}
|
||||
|
||||
double ViewProviderDimension::prefWeight() const
|
||||
{
|
||||
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("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
|
||||
@@ -55,10 +55,12 @@
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include "TaskGeomHatch.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "ViewProviderDrawingView.h"
|
||||
#include "ViewProviderGeomHatch.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderGeomHatch, Gui::ViewProviderDocumentObject)
|
||||
|
||||
@@ -184,10 +186,7 @@ void ViewProviderGeomHatch::updateGraphic(void)
|
||||
|
||||
void ViewProviderGeomHatch::getParameters(void)
|
||||
{
|
||||
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("Graphic");
|
||||
delete lg; //Coverity CID 174667
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
@@ -62,6 +63,7 @@
|
||||
#include "ViewProviderLeader.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderLeader, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
@@ -198,8 +200,7 @@ TechDraw::DrawLeaderLine* ViewProviderLeader::getFeature() const
|
||||
double ViewProviderLeader::getDefLineWeight(void)
|
||||
{
|
||||
double result = 0.0;
|
||||
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);
|
||||
result = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
@@ -207,12 +208,8 @@ double ViewProviderLeader::getDefLineWeight(void)
|
||||
}
|
||||
|
||||
App::Color ViewProviderLeader::getDefLineColor(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Markups");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
return result;
|
||||
{
|
||||
return PreferencesGui::leaderColor();
|
||||
}
|
||||
|
||||
void ViewProviderLeader::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGITemplate.h"
|
||||
@@ -71,6 +72,7 @@
|
||||
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
#define _SHOWDRAWING 10
|
||||
#define _TOGGLEUPDATE 11
|
||||
@@ -406,10 +408,7 @@ void ViewProviderPage::finishRestoring()
|
||||
m_docReady = true;
|
||||
//control drawing opening on restore based on Preference
|
||||
//mantis #2967 ph2 - don't even show blank page
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", 1l);
|
||||
if (autoUpdate) {
|
||||
if (Preferences::keepPagesUpToDate()) {
|
||||
static_cast<void>(showMDIViewPage());
|
||||
}
|
||||
Gui::ViewProviderDocumentObject::finishRestoring();
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
@@ -56,6 +58,7 @@
|
||||
#include "ViewProviderRichAnno.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
// there are only 5 frame line styles
|
||||
App::PropertyIntegerConstraint::Constraints ViewProviderRichAnno::LineStyleRange = {0, 5, 1};
|
||||
@@ -164,37 +167,24 @@ TechDraw::DrawRichAnno* ViewProviderRichAnno::getFeature() const
|
||||
}
|
||||
|
||||
App::Color ViewProviderRichAnno::getDefLineColor(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Markups");
|
||||
App::Color result;
|
||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
return result;
|
||||
{
|
||||
return PreferencesGui::leaderColor();
|
||||
}
|
||||
|
||||
std::string ViewProviderRichAnno::getDefFont(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return fontName;
|
||||
{
|
||||
return Preferences::labelFont();
|
||||
}
|
||||
|
||||
double ViewProviderRichAnno::getDefFontSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", 5.0);
|
||||
return fontSize;
|
||||
return Preferences::dimFontSizeMM();
|
||||
}
|
||||
|
||||
double ViewProviderRichAnno::getDefLineWeight(void)
|
||||
{
|
||||
double result = 0.0;
|
||||
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);
|
||||
result = lg->getWeight("Graphics");
|
||||
delete lg;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -48,9 +48,10 @@
|
||||
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawGeomHatch.h>
|
||||
//#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "TaskSectionView.h"
|
||||
|
||||
#include "ViewProviderViewSection.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -185,7 +186,7 @@ void ViewProviderViewSection::getParameters(void)
|
||||
{
|
||||
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", 0xC8C8C800));
|
||||
App::Color cutColor = App::Color((uint32_t) hGrp->GetUnsigned("CutSurfaceColor", 0xD3D3D3FF));
|
||||
CutSurfaceColor.setValue(cutColor);
|
||||
|
||||
// App::Color hatchColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionHatchColor", 0x00000000));
|
||||
|
||||
@@ -45,11 +45,12 @@
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "TaskWeldingSymbol.h"
|
||||
|
||||
#include "ViewProviderWeld.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderWeld, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
@@ -163,20 +164,12 @@ bool ViewProviderWeld::doubleClicked(void)
|
||||
|
||||
std::string ViewProviderWeld::prefFontName(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return fontName;
|
||||
return Preferences::labelFont();
|
||||
}
|
||||
|
||||
double ViewProviderWeld::prefFontSize(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
return fontSize;
|
||||
return Preferences::labelFontSizeMM();
|
||||
}
|
||||
|
||||
double ViewProviderWeld::prefTileTextAdjust(void)
|
||||
|
||||
@@ -54,13 +54,18 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "mrichtextedit.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
m_lastBlockList = 0;
|
||||
f_textedit->setTabStopWidth(40);
|
||||
setDefFontSize(getDefFontSizeNum());
|
||||
// setDefFontSize(getDefFontSizeNum());
|
||||
setDefFontSize(TechDrawGui::PreferencesGui::labelFontSizePX());
|
||||
m_defFont = getDefFont().family();
|
||||
f_textedit->setFont(getDefFont());
|
||||
|
||||
@@ -750,9 +755,7 @@ void MRichTextEdit::setDefFontSize(int fs)
|
||||
int MRichTextEdit::getDefFontSizeNum(void)
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSizeNum()\n");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double fontSize = hGrp->GetFloat("FontSize", 5.0); // this is mm, not pts!
|
||||
double fontSize = TechDraw::Preferences::dimFontSizeMM();
|
||||
|
||||
//this conversion is only approximate. the factor changes for different fonts.
|
||||
// double mmToPts = 2.83; //theoretical value
|
||||
@@ -777,10 +780,7 @@ void MRichTextEdit::setDefFont(QString f)
|
||||
|
||||
QFont MRichTextEdit::getDefFont(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
QString family = Base::Tools::fromStdString(fontName);
|
||||
QString family = Base::Tools::fromStdString(Preferences::labelFont());
|
||||
m_defFont = family;
|
||||
QFont result;
|
||||
result.setFamily(family);
|
||||
|
||||
Reference in New Issue
Block a user