Skip to content

Commit

Permalink
[TD]fix application of SectionLine preference
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Feb 20, 2020
1 parent d0f749b commit 4db7fc9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
19 changes: 11 additions & 8 deletions src/Mod/TechDraw/Gui/DlgPrefsTechDraw3.ui
Expand Up @@ -284,7 +284,7 @@
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize" native="true">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand All @@ -294,7 +294,7 @@
<property name="toolTip">
<string>Dimension font size</string>
</property>
<property name="value" stdset="0">
<property name="value">
<double>4.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
Expand All @@ -306,7 +306,7 @@
</widget>
</item>
<item row="8" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize" native="true">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand All @@ -316,7 +316,7 @@
<property name="toolTip">
<string>Dimension arrowhead size</string>
</property>
<property name="value" stdset="0">
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
Expand Down Expand Up @@ -821,20 +821,23 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionLineStyle</cstring>
<cstring>SectionLineStandard</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/General</cstring>
<cstring>Mod/TechDraw/Standards</cstring>
</property>
<item>
<property name="text">
<string>ISO</string>
<string>ANSI</string>
</property>
</item>
<item>
<property name="text">
<string>ANSI</string>
<string>ISO</string>
</property>
</item>
</widget>
Expand Down
21 changes: 12 additions & 9 deletions src/Mod/TechDraw/Gui/QGISectionLine.cpp
Expand Up @@ -39,6 +39,9 @@
#include "QGIView.h"
#include "QGISectionLine.h"

#define ANSISTANDARD 0
#define ISOSTANDARD 1

using namespace TechDrawGui;
using namespace TechDraw;

Expand Down Expand Up @@ -82,8 +85,8 @@ void QGISectionLine::makeLine()
QPointF beginExtLine1,beginExtLine2; //ext line start pts for measure Start side and measure End side
QPointF endExtLine1, endExtLine2;
QPointF offsetDir(m_arrowDir.x,-m_arrowDir.y);
int format = getPrefSectionFormat();
if (format == 0) { //"ASME"
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) { //"ASME"/"ANSI"
//draw from section line endpoint
QPointF offsetBegin = m_extLen * offsetDir;
beginExtLine1 = m_start; //from
Expand Down Expand Up @@ -115,8 +118,8 @@ void QGISectionLine::makeLine()

void QGISectionLine::makeArrows()
{
int format = getPrefSectionFormat();
if (format == 0) {
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) {
makeArrowsTrad();
} else {
makeArrowsISO();
Expand Down Expand Up @@ -180,8 +183,8 @@ void QGISectionLine::makeArrowsTrad()

void QGISectionLine::makeSymbols()
{
int format = getPrefSectionFormat();
if (format == 0) {
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) {
makeSymbolsTrad();
} else {
makeSymbolsISO();
Expand Down Expand Up @@ -291,11 +294,11 @@ Qt::PenStyle QGISectionLine::getSectionStyle()
}

//ASME("traditional") vs ISO("reference arrow method") arrows
int QGISectionLine::getPrefSectionFormat()
int QGISectionLine::getPrefSectionStandard()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Format");
int format = hGrp->GetInt("SectionFormat", 0);
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Standards");
int format = hGrp->GetInt("SectionLineStandard", ISOSTANDARD);
return format;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/QGISectionLine.h
Expand Up @@ -67,7 +67,7 @@ class TechDrawGuiExport QGISectionLine : public QGIDecoration
void makeSymbolsTrad();
void makeSymbolsISO();
void setTools();
int getPrefSectionFormat();
int getPrefSectionStandard();

private:
char* m_symbol;
Expand Down

0 comments on commit 4db7fc9

Please sign in to comment.