[TD]common preference getters for hatches

This commit is contained in:
wandererfan
2020-03-17 19:32:12 -04:00
committed by WandererFan
parent 69af481235
commit 7a9a87fa6c
6 changed files with 45 additions and 32 deletions

View File

@@ -627,6 +627,15 @@ std::string DrawGeomHatch::prefGeomHatchName()
return result;
}
App::Color DrawGeomHatch::prefGeomHatchColor()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("GeomHatch", 0x00FF0000));
return fcColor;
}
// Python Drawing feature ---------------------------------------------------------

View File

@@ -23,9 +23,10 @@
#ifndef _TechDraw_DrawGeomHatch_h_
#define _TechDraw_DrawGeomHatch_h_
# include <App/DocumentObject.h>
# include <App/FeaturePython.h>
# include <App/PropertyLinks.h>
#include <App/DocumentObject.h>
#include <App/FeaturePython.h>
#include <App/Material.h>
#include <App/PropertyLinks.h>
#include <App/PropertyFile.h>
class TopoDS_Edge;
@@ -80,6 +81,8 @@ public:
static TopoDS_Face extractFace(DrawViewPart* source, int iface );
static std::string prefGeomHatchFile(void);
static std::string prefGeomHatchName();
static App::Color prefGeomHatchColor();
protected:
virtual void onDocumentRestored() override;

View File

@@ -261,7 +261,7 @@ void DrawHatch::unsetupObject(void)
App::DocumentObject::unsetupObject();
}
//standard preference getter
//standard preference getters
std::string DrawHatch::prefSvgHatch(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
@@ -273,6 +273,16 @@ std::string DrawHatch::prefSvgHatch(void)
return result;
}
App::Color DrawHatch::prefSvgHatchColor(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Hatch", 0x00FF0000));
return fcColor;
}
// Python Drawing feature ---------------------------------------------------------
namespace App {

View File

@@ -23,9 +23,10 @@
#ifndef _TechDraw_DrawHatch_h_
#define _TechDraw_DrawHatch_h_
# include <App/DocumentObject.h>
# include <App/FeaturePython.h>
# include <App/PropertyLinks.h>
#include <App/DocumentObject.h>
#include <App/FeaturePython.h>
#include <App/Material.h>
#include <App/PropertyLinks.h>
#include <App/PropertyFile.h>
namespace TechDraw
@@ -62,7 +63,8 @@ public:
bool empty(void);
static bool faceIsHatched(int i,std::vector<TechDraw::DrawHatch*> hatchObjs);
static std::string prefSvgHatch(void);
static App::Color prefSvgHatchColor(void);
protected:
void onChanged(const App::Property* prop) override;
virtual void onDocumentRestored() override;