HatchColor & HatchScale prop to Gui side
This commit is contained in:
@@ -25,24 +25,33 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <Precision.hxx>
|
||||
|
||||
#endif
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Sequencer.h>
|
||||
//#include <Base/Exception.h>
|
||||
//#include <Base/Sequencer.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Gui/Selection.h>
|
||||
//#include <Gui/SoFCSelection.h>
|
||||
//#include <Gui/Selection.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include "ViewProviderHatch.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderHatch::scaleRange = {Precision::Confusion(),
|
||||
std::numeric_limits<double>::max(),
|
||||
pow(10,- Base::UnitsApi::getDecimals())};
|
||||
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderHatch, Gui::ViewProviderDocumentObject)
|
||||
|
||||
//**************************************************************************
|
||||
@@ -51,6 +60,16 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderHatch, Gui::ViewProviderDocumentObject)
|
||||
ViewProviderHatch::ViewProviderHatch()
|
||||
{
|
||||
sPixmap = "TechDraw_Tree_Hatch";
|
||||
|
||||
static const char *vgroup = "Hatch";
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Hatch", 0x00FF0000));
|
||||
|
||||
ADD_PROPERTY_TYPE(HatchColor,(fcColor),vgroup,App::Prop_None,"The color of the hatch pattern");
|
||||
ADD_PROPERTY_TYPE(HatchScale,(1.0),vgroup,App::Prop_None,"Hatch pattern size adjustment");
|
||||
HatchScale.setConstraints(&scaleRange);
|
||||
}
|
||||
|
||||
ViewProviderHatch::~ViewProviderHatch()
|
||||
@@ -76,9 +95,19 @@ std::vector<std::string> ViewProviderHatch::getDisplayModes(void) const
|
||||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderHatch::onChanged(const App::Property* prop)
|
||||
{
|
||||
if ((prop == &HatchScale) ||
|
||||
(prop == &HatchColor)) {
|
||||
TechDraw::DrawViewPart* parent = getViewObject()->getSourceView();
|
||||
if (parent) {
|
||||
parent->requestPaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
void ViewProviderHatch::updateData(const App::Property* prop)
|
||||
{
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
}
|
||||
|
||||
TechDraw::DrawHatch* ViewProviderHatch::getViewObject() const
|
||||
|
||||
Reference in New Issue
Block a user