[TD]SectionLine colour property
This commit is contained in:
@@ -275,6 +275,10 @@ void QGISectionLine::setFont(QFont f, double fsize)
|
||||
m_symSize = fsize;
|
||||
}
|
||||
|
||||
void QGISectionLine::setSectionColor(QColor c)
|
||||
{
|
||||
setColor(c);
|
||||
}
|
||||
|
||||
QColor QGISectionLine::getSectionColor()
|
||||
{
|
||||
@@ -354,11 +358,12 @@ void QGISectionLine::setTools()
|
||||
// m_arrow2->setPen(m_pen);
|
||||
// m_arrow1->setBrush(m_brush);
|
||||
// m_arrow2->setBrush(m_brush);
|
||||
m_arrow1->setNormalColor(getSectionColor());
|
||||
m_arrow1->setFillColor(getSectionColor());
|
||||
|
||||
m_arrow1->setNormalColor(m_colCurrent);
|
||||
m_arrow1->setFillColor(m_colCurrent);
|
||||
m_arrow1->setPrettyNormal();
|
||||
m_arrow2->setNormalColor(getSectionColor());
|
||||
m_arrow2->setFillColor(getSectionColor());
|
||||
m_arrow2->setNormalColor(m_colCurrent);
|
||||
m_arrow2->setFillColor(m_colCurrent);
|
||||
m_arrow2->setPrettyNormal();
|
||||
|
||||
m_symbol1->setDefaultTextColor(m_colCurrent);
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
void setDirection(Base::Vector3d dir);
|
||||
void setFont(QFont f, double fsize);
|
||||
void setSectionStyle(int style);
|
||||
void setSectionColor(QColor c);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -848,6 +848,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
|
||||
addToGroup(sectionLine);
|
||||
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
|
||||
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
|
||||
sectionLine->setSectionColor(vp->SectionLineColor.getValue().asValue<QColor>());
|
||||
|
||||
//TODO: handle oblique section lines?
|
||||
//find smallest internal angle(normalDir,get?Dir()) and use -1*get?Dir() +/- angle
|
||||
|
||||
@@ -56,12 +56,12 @@ using namespace TechDrawGui;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
const char* ViewProviderViewPart::LineStyleEnums[] = { "NoLine",
|
||||
"Continuous",
|
||||
"Dash",
|
||||
"Dot",
|
||||
"DashDot",
|
||||
"DashDotDot",
|
||||
const char* ViewProviderViewPart::LineStyleEnums[] = { "NoLine",
|
||||
"Continuous",
|
||||
"Dash",
|
||||
"Dot",
|
||||
"DashDot",
|
||||
"DashDotDot",
|
||||
NULL };
|
||||
|
||||
//**************************************************************************
|
||||
@@ -110,7 +110,10 @@ ViewProviderViewPart::ViewProviderViewPart()
|
||||
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, "Set section line style if applicable");
|
||||
ADD_PROPERTY_TYPE(SectionLineStyle, (defLineStyle), 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");
|
||||
|
||||
//properties that affect Detail Highlights
|
||||
ADD_PROPERTY_TYPE(HighlightAdjust,(0.0),hgroup,App::Prop_None,"Adjusts the rotation of the Detail highlight");
|
||||
@@ -139,6 +142,7 @@ void ViewProviderViewPart::onChanged(const App::Property* prop)
|
||||
prop == &(CenterScale) ||
|
||||
prop == &(ShowSectionLine) ||
|
||||
prop == &(SectionLineStyle) ||
|
||||
prop == &(SectionLineColor) ||
|
||||
prop == &(HorizCenterLine) ||
|
||||
prop == &(VertCenterLine) ) {
|
||||
// redraw QGIVP
|
||||
@@ -290,13 +294,13 @@ bool ViewProviderViewPart::onDelete(const std::vector<std::string> &)
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
else if (!viewLeader.empty()) {
|
||||
bodyMessageStream << qApp->translate("Std_Delete",
|
||||
"You cannot delete this view because it has a leader line that would become broken.");
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
else if (!viewLeader.empty()) {
|
||||
bodyMessageStream << qApp->translate("Std_Delete",
|
||||
"You cannot delete this view because it has a leader line that would become broken.");
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
@@ -310,3 +314,13 @@ bool ViewProviderViewPart::canDelete(App::DocumentObject *obj) const
|
||||
Q_UNUSED(obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
App::PropertyBool VertCenterLine;
|
||||
App::PropertyBool ShowSectionLine;
|
||||
App::PropertyEnumeration SectionLineStyle;
|
||||
App::PropertyColor SectionLineColor;
|
||||
App::PropertyFloat HighlightAdjust;
|
||||
App::PropertyBool ShowAllEdges;
|
||||
|
||||
@@ -70,6 +71,7 @@ public:
|
||||
virtual void onChanged(const App::Property *prop);
|
||||
virtual void updateData(const App::Property*);
|
||||
virtual void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop);
|
||||
App::Color prefSectionColor(void);
|
||||
|
||||
|
||||
virtual std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
|
||||
Reference in New Issue
Block a user