[TD]assorted Preference updates

- section line convention label
- remove superfluous save/restore on changeEvent
- change default scrub count
- add preference for default symbol dir
- add preference for display of section cut line
This commit is contained in:
wandererfan
2024-05-17 18:31:36 -04:00
committed by WandererFan
parent 6a947afda5
commit ff17df2ff5
20 changed files with 574 additions and 442 deletions

View File

@@ -250,6 +250,24 @@ bool Preferences::showDetailHighlight()
return getPreferenceGroup("General")->GetBool("ShowDetailHighlight", true);
}
//! returns the default or preferred directory to search for svg symbols
QString Preferences::defaultSymbolDir()
{
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates";
std::string prefSymbolDir = getPreferenceGroup("Files")->GetASCII("DirSymbol", defaultDir.c_str());
if (prefSymbolDir.empty()) {
prefSymbolDir = defaultDir;
}
QString symbolDir = QString::fromStdString(prefSymbolDir);
Base::FileInfo fi(prefSymbolDir);
if (!fi.isReadable()) {
Base::Console().Warning("Symbol Directory: %s is not readable\n",
prefSymbolDir.c_str());
symbolDir = QString::fromStdString(defaultDir);
}
return symbolDir;
}
std::string Preferences::svgFile()
{
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/";
@@ -402,7 +420,7 @@ bool Preferences::autoCorrectDimRefs()
//! number of times to clean the output edges from HLR
int Preferences::scrubCount()
{
return getPreferenceGroup("General")->GetInt("ScrubCount", 0);
return getPreferenceGroup("General")->GetInt("ScrubCount", 1);
}
//! Returns the factor for the overlap of svg tiles when hatching faces
@@ -540,6 +558,19 @@ int Preferences::sectionLineConvention()
return getPreferenceGroup("Standards")->GetInt("SectionLineStandard", 1);
}
//! true if a section line annotation should be drawn on the source view. If false,
//! no cut line, change marks, arrows or symbol will be drawn.
bool Preferences::showSectionLine()
{
return getPreferenceGroup("Decorations")->GetBool("ShowSectionLine", true);
}
//! true if the section cut line should be drawn on the source view. Some conventions do not draw the
//! actual cut line, but only the change points, arrows and symbols.
bool Preferences::includeCutLine()
{
return getPreferenceGroup("Decorations")->GetBool("IncludeCutLine", true);
}
//! true if the GeometryMatcher should be used in correcting Dimension references
bool Preferences::useExactMatchOnDims()

View File

@@ -85,6 +85,8 @@ public:
static std::string svgFile();
static std::string patFile();
static QString defaultSymbolDir();
static std::string bitmapFill();
static double GapISO();
@@ -126,6 +128,8 @@ public:
static std::string currentElementDefFile();
static int sectionLineConvention();
static bool showSectionLine();
static bool includeCutLine();
static bool useExactMatchOnDims();
};

View File

@@ -435,13 +435,14 @@ void CmdTechDrawView::activated(int iMsg)
}
}
QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
QObject::tr("Select a SVG or Image file to open"), QString(),
QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
QObject::tr("Select a SVG or Image file to open"),
Preferences::defaultSymbolDir(),
QString::fromLatin1("%1 (*.svg *.svgz *.jpg *.jpeg *.png *.bmp);;%2 (*.*)")
.arg(QObject::tr("SVG or Image files"), QObject::tr("All Files")));
if (!filename.isEmpty()) {
if (filename.endsWith(QString::fromLatin1(".svg"), Qt::CaseInsensitive)
if (filename.endsWith(QString::fromLatin1(".svg"), Qt::CaseInsensitive)
|| filename.endsWith(QString::fromLatin1(".svgz"), Qt::CaseInsensitive)) {
std::string FeatName = getUniqueObjectName("Symbol");
filename = Base::Tools::escapeEncodeFilename(filename);
@@ -1501,7 +1502,8 @@ void CmdTechDrawSymbol::activated(int iMsg)
// Reading an image
QString filename = Gui::FileDialog::getOpenFileName(
Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString(),
Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"),
Preferences::defaultSymbolDir(),
QString::fromLatin1("%1 (*.svg *.svgz);;%2 (*.*)")
.arg(QObject::tr("Scalable Vector Graphic"), QObject::tr("All Files")));

View File

@@ -45,6 +45,7 @@
#include <Mod/TechDraw/App/DrawUtil.h>
#include <Mod/TechDraw/App/DrawView.h>
#include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/Preferences.h>
#include "DrawGuiUtil.h"
#include "MDIViewPage.h"
@@ -55,6 +56,7 @@
using namespace TechDrawGui;
using namespace TechDraw;
//internal functions
bool _checkSelectionHatch(Gui::Command* cmd);
@@ -256,7 +258,7 @@ void CmdTechDrawImage::activated(int iMsg)
// Reading an image
QString fileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
QString::fromUtf8(QT_TR_NOOP("Select an Image File")),
QString(),
Preferences::defaultSymbolDir(),
QString::fromUtf8(QT_TR_NOOP("Image files (*.jpg *.jpeg *.png *.bmp);;All files (*)")));
if (fileName.isEmpty()) {
return;

View File

@@ -499,6 +499,9 @@ can be a performance penalty in complex models.</string>
<property name="prefix">
<string/>
</property>
<property name="value">
<number>1</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>ScrubCount</cstring>
</property>

View File

@@ -84,9 +84,7 @@ void DlgPrefsTechDrawAdvancedImp::loadSettings()
void DlgPrefsTechDrawAdvancedImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>580</width>
<height>687</height>
<height>795</height>
</rect>
</property>
<property name="sizePolicy">
@@ -34,131 +34,8 @@
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,0,1">
<item row="8" column="2">
<widget class="Gui::PrefCheckBox" name="cbAutoHoriz">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Forces last leader line segment to be horizontal</string>
</property>
<property name="text">
<string>Leader Line Auto Horizontal</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AutoHorizontal</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/LeaderLine</cstring>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="Gui::PrefCheckBox" name="cbShowCenterMarks">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Show arc center marks in views</string>
</property>
<property name="text">
<string>Show Center Marks</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowCenterMarks</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="cbComplexMarks">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Show or hide marks at direction changes on ComplexSection lines.</string>
</property>
<property name="text">
<string>Complex Section Line Marks</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionLineMarks</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_19">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Section Cut Surface</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_18">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Length of horizontal portion of Balloon leader</string>
</property>
<property name="text">
<string>Ballon Leader Kink Length</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefComboBox" name="pcbMatting">
<item row="9" column="2">
<widget class="Gui::PrefUnitSpinBox" name="pdsbBalloonKink">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -172,35 +49,108 @@
</size>
</property>
<property name="toolTip">
<string>Outline shape for detail views</string>
<string>Length of balloon leader line kink</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>MattingStyle</cstring>
<cstring>BalloonKink</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Dimensions</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::PrefComboBox" name="cbCutSurface">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Default appearance of cut surface in section view</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>CutSurfaceDisplay</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Decorations</cstring>
</property>
<item>
<property name="text">
<string>Circle</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/circular.svg</normaloff>:/icons/circular.svg</iconset>
<string>Hide</string>
</property>
</item>
<item>
<property name="text">
<string>Square</string>
<string>Solid Color</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/square.svg</normaloff>:/icons/square.svg</iconset>
</item>
<item>
<property name="text">
<string>SVG Hatch</string>
</property>
</item>
<item>
<property name="text">
<string>PAT Hatch</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<item row="8" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Balloon Leader End</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<italic>false</italic>
</font>
</property>
<property name="text">
<string>Detail View Outline Shape</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="Gui::PrefCheckBox" name="pcbDetailMatting">
<property name="toolTip">
<string>This checkbox controls whether or not to display the outline around a detail view.</string>
</property>
<property name="text">
<string>Detail View Show Matting</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowDetailMatting</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="Gui::PrefComboBox" name="pcbBalloonShape">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -297,8 +247,20 @@
</item>
</widget>
</item>
<item row="7" column="2">
<widget class="Gui::PrefUnitSpinBox" name="pdsbBalloonKink">
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Balloon Shape</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefComboBox" name="pcbMatting">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -312,23 +274,59 @@
</size>
</property>
<property name="toolTip">
<string>Length of balloon leader line kink</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="value">
<double>5.000000000000000</double>
<string>Outline shape for detail views</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BalloonKink</cstring>
<cstring>MattingStyle</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Dimensions</cstring>
<cstring>/Mod/TechDraw/Decorations</cstring>
</property>
<item>
<property name="text">
<string>Circle</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/circular.svg</normaloff>:/icons/circular.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Square</string>
</property>
<property name="icon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/square.svg</normaloff>:/icons/square.svg</iconset>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="cbComplexMarks">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Show or hide marks at direction changes on ComplexSection lines.</string>
</property>
<property name="text">
<string>Complex Section Line Marks</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionLineMarks</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="10" column="0">
<widget class="Gui::PrefCheckBox" name="cbPyramidOrtho">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -359,7 +357,104 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="8" column="2">
<widget class="Gui::PrefComboBox" name="pcbBalloonArrow">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Style for balloon leader line ends</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BalloonArrow</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="Gui::PrefCheckBox" name="cbAutoHoriz">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Forces last leader line segment to be horizontal</string>
</property>
<property name="text">
<string>Leader Line Auto Horizontal</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AutoHorizontal</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/LeaderLine</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_19">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Section Cut Surface</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="cb_ShowSectionLine">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>If checked, the section annotation will be drawn on the Source view. If unchecked, no section line, arrows or symbol will be shown in the Source view.</string>
</property>
<property name="text">
<string>Show Section Line in Source View</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowSectionLine</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -373,61 +468,76 @@
</spacer>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Balloon Leader End</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="pcbDetailMatting">
<widget class="Gui::PrefCheckBox" name="pcbDetailHighlight">
<property name="toolTip">
<string>This checkbox controls whether or not to display the outline around a detail view.</string>
<string>This checkbox controls whether or not to display a highlight around the detail area in the detail's source view.</string>
</property>
<property name="text">
<string>Detail View Show Matting</string>
<string>Detail Source Show Highlight</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowDetailMatting</cstring>
<cstring>ShowDetailHighlight</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/General</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<item row="9" column="0">
<widget class="QLabel" name="label_18">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Length of horizontal portion of Balloon leader</string>
</property>
<property name="text">
<string>Balloon Shape</string>
<string>Ballon Leader Kink Length</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<item row="11" column="0">
<widget class="Gui::PrefCheckBox" name="cbShowCenterMarks">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>false</italic>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Show arc center marks in views</string>
</property>
<property name="text">
<string>Detail View Outline Shape</string>
<string>Show Center Marks</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowCenterMarks</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="9" column="2">
<item row="11" column="2">
<widget class="Gui::PrefCheckBox" name="cbPrintCenterMarks">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -455,89 +565,27 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::PrefComboBox" name="cbCutSurface">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
<item row="2" column="0">
<widget class="Gui::PrefCheckBox" name="cb_IncludeCutLine">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Default appearance of cut surface in section view</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>CutSurfaceDisplay</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Decorations</cstring>
</property>
<item>
<property name="text">
<string>Hide</string>
</property>
</item>
<item>
<property name="text">
<string>Solid Color</string>
</property>
</item>
<item>
<property name="text">
<string>SVG Hatch</string>
</property>
</item>
<item>
<property name="text">
<string>PAT Hatch</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="Gui::PrefComboBox" name="pcbBalloonArrow">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Style for balloon leader line ends</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BalloonArrow</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="Gui::PrefCheckBox" name="pcbDetailHighlight">
<property name="toolTip">
<string>This checkbox controls whether or not to display a highlight around the detail area in the detail's source view.</string>
<string>If checked, the cut line will be drawn on the Source view. If unchecked, only the change marks, arrows and symbols will be displayed.</string>
</property>
<property name="text">
<string>Detail Source Show Highlight</string>
<string>Include Cut Line in Section Annotation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowDetailHighlight</cstring>
<cstring>IncludeCutLine</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/General</cstring>
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
</widget>
</item>

View File

@@ -90,6 +90,9 @@ void DlgPrefsTechDrawAnnotationImp::saveSettings()
ui->pcbMatting->onSave();
ui->pdsbBalloonKink->onSave();
ui->cbCutSurface->onSave();
ui->cb_ShowSectionLine->onSave();
ui->cb_IncludeCutLine->onSave();
// don't save invalid parameter values
// the comboboxes are properly loaded.
@@ -152,7 +155,8 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings()
ui->cbCutSurface->onRestore();
ui->pcbDetailMatting->onRestore();
ui->pcbDetailHighlight->onRestore();
ui->cb_ShowSectionLine->onRestore();
ui->cb_IncludeCutLine->onRestore();
ui->pcbBalloonArrow->onRestore();
DrawGuiUtil::loadArrowBox(ui->pcbBalloonArrow);

View File

@@ -100,9 +100,7 @@ void DlgPrefsTechDrawColorsImp::loadSettings()
void DlgPrefsTechDrawColorsImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -201,9 +201,7 @@ void DlgPrefsTechDrawDimensionsImp::dimensioningModeChanged(int index)
void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>499</width>
<height>768</height>
<height>897</height>
</rect>
</property>
<property name="sizePolicy">
@@ -462,7 +462,7 @@ for ProjectionGroups</string>
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<italic>true</italic>
<italic>false</italic>
</font>
</property>
<property name="text">
@@ -494,17 +494,73 @@ for ProjectionGroups</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,0,2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,0,0">
<item row="1" column="1" rowspan="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Default Template</string>
<string>PAT File</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_HatchFile">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Preferred SVG or bitmap file for hatching. This value will also control the initial directory for choosing hatch patterns. You can use this to get hatch files from a local directory.</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>FileHatch</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_LineGroup">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Alternate file for personal LineGroup definition</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>LineGroupFile</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
@@ -533,128 +589,6 @@ for ProjectionGroups</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Template Directory</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_DefDir">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Starting directory for menu 'Insert Page using Template'</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="prefEntry" stdset="0">
<cstring>TemplateDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_Hatch">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Hatch Pattern File</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_HatchFile">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Default SVG or bitmap file for hatching</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>FileHatch</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Line Group File</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_LineGroup">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Alternate file for personal LineGroup definition</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>LineGroupFile</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="minimumSize">
@@ -673,6 +607,25 @@ for ProjectionGroups</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_FilePattern">
<property name="minimumSize">
<size>
<width>191</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Default PAT pattern definition file for geometric hatching</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>FilePattern</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/PAT</cstring>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_Welding">
<property name="minimumSize">
@@ -695,26 +648,8 @@ for ProjectionGroups</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>PAT File</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_FilePattern">
<item row="1" column="2">
<widget class="Gui::PrefFileChooser" name="pfc_DefDir">
<property name="minimumSize">
<size>
<width>191</width>
@@ -722,18 +657,50 @@ for ProjectionGroups</string>
</size>
</property>
<property name="toolTip">
<string>Default PAT pattern definition file for geometric hatching</string>
<string>Starting directory for menu 'Insert Page using Template'</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="prefEntry" stdset="0">
<cstring>FilePattern</cstring>
<cstring>TemplateDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/PAT</cstring>
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Template Directory</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="Gui::PrefFileChooser" name="fcSymbolDir">
<property name="toolTip">
<string>Alternate directory to search for Svg symbol files.</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="prefEntry" stdset="0">
<cstring>DirSymbol</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Files</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_Hatch">
<property name="minimumSize">
<size>
<width>0</width>
@@ -746,7 +713,32 @@ for ProjectionGroups</string>
</font>
</property>
<property name="text">
<string>Pattern Name</string>
<string>Hatch Pattern File</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Default Template</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Symbol Directory</string>
</property>
</widget>
</item>
@@ -781,6 +773,42 @@ for ProjectionGroups</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Line Group File</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Pattern Name</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -70,6 +70,8 @@ void DlgPrefsTechDrawGeneralImp::saveSettings()
ui->pfc_Welding->onSave();
ui->pfc_FilePattern->onSave();
ui->le_NamePattern->onSave();
ui->fcSymbolDir->onSave();
ui->cb_ShowGrid->onSave();
ui->psb_GridSpacing->onSave();
@@ -102,6 +104,8 @@ void DlgPrefsTechDrawGeneralImp::loadSettings()
ui->pfc_Welding->onRestore();
ui->pfc_FilePattern->onRestore();
ui->le_NamePattern->onRestore();
ui->fcSymbolDir->onRestore();
bool gridDefault = PreferencesGui::showGrid();
ui->cb_ShowGrid->setChecked(gridDefault);
@@ -122,9 +126,7 @@ void DlgPrefsTechDrawGeneralImp::loadSettings()
void DlgPrefsTechDrawGeneralImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -78,9 +78,7 @@ void DlgPrefsTechDrawHLRImp::loadSettings()
void DlgPrefsTechDrawHLRImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -88,9 +88,7 @@ void DlgPrefsTechDrawScaleImp::loadSettings()
void DlgPrefsTechDrawScaleImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
saveSettings();
ui->retranslateUi(this);
loadSettings();
}
else {
QWidget::changeEvent(e);

View File

@@ -122,8 +122,10 @@ void QGISectionLine::makeExtensionLine()
void QGISectionLine::makeSectionLine()
{
QPainterPath pp;
pp.moveTo(m_start);
pp.lineTo(m_end);
if (m_showLine) {
pp.moveTo(m_start);
pp.lineTo(m_end);
}
m_line->setPath(pp);
}

View File

@@ -64,6 +64,7 @@ public:
void setFont(QFont f, double fsize);
void setSectionColor(QColor c);
void setPathMode(bool mode) { m_pathMode = mode; }
void setShowLine(bool state) { m_showLine = state; }
bool pathMode() { return m_pathMode; }
void setChangePoints(TechDraw::ChangePointVector changePoints);
void clearChangePoints();
@@ -123,6 +124,8 @@ private:
QPointF m_arrowPos2;
std::vector<QGraphicsPathItem*> m_changePointMarks;
TechDraw::ChangePointVector m_changePointData;
bool m_showLine{true};
};
}

View File

@@ -697,8 +697,10 @@ void QGIViewPart::drawAllSectionLines()
return;
auto vp = static_cast<ViewProviderViewPart*>(getViewProvider(getViewObject()));
if (!vp)
if (!vp) {
return;
}
if (vp->ShowSectionLine.getValue()) {
auto refs = viewPart->getSectionRefs();
for (auto& r : refs) {
@@ -776,11 +778,18 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
//set the general parameters
sectionLine->setPos(0.0, 0.0);
// sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot)
sectionLine->setLinePen(
m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(),
vp->HiddenWidth.getValue()));
sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue()));
if (vp->IncludeCutLine.getValue()) {
sectionLine->setShowLine(true);
// sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot)
sectionLine->setLinePen(
m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(),
vp->HiddenWidth.getValue()));
sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue()));
} else {
sectionLine->setShowLine(false);
}
double fontSize = Preferences::dimFontSizeMM();
sectionLine->setFont(getFont(), fontSize);
sectionLine->setZValue(ZVALUE::SECTIONLINE);
@@ -857,11 +866,18 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection,
//set the general parameters
sectionLine->setPos(0.0, 0.0);
// sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot)
sectionLine->setLinePen(
m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(),
vp->HiddenWidth.getValue()));
sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue()));
if (vp->IncludeCutLine.getValue()) {
sectionLine->setShowLine(true);
// sectionLines are typically ISO 8 (long dash, short dash) or ISO 4 (long dash, dot)
sectionLine->setLinePen(
m_dashedLineGenerator->getLinePen((size_t)vp->SectionLineStyle.getValue(),
vp->HiddenWidth.getValue()));
sectionLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue()));
} else {
sectionLine->setShowLine(false);
}
double fontSize = Preferences::dimFontSizeMM();
sectionLine->setFont(getFont(), fontSize);
sectionLine->setZValue(ZVALUE::SECTIONLINE);

View File

@@ -185,7 +185,6 @@ void TaskHatch::apply(bool forceUpdate)
if (m_dvp) {
//only need requestPaint to hatch the face
// m_dvp->requestPaint();
//need a recompute in order to claimChildren in tree
m_dvp->recomputeFeature();
}
@@ -199,16 +198,10 @@ void TaskHatch::createHatch()
// TODO: the structured label for Hatch (and GeomHatch) should be retired.
const std::string objectName("Hatch");
std::string FeatName = doc->getUniqueObjectName(objectName.c_str());
// std::string generatedSuffix {FeatName.substr(objectName.length())};
// std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
// std::stringstream featLabel;
// featLabel << translatedObjectName << generatedSuffix << "F" <<
// TechDraw::DrawUtil::getIndexFromName(m_subs.at(0)); //use 1st face# for label
Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create Hatch"));
Command::doCommand(Command::Doc, "App.activeDocument().addObject('TechDraw::DrawHatch', '%s')", FeatName.c_str());
// Command::doCommand(Command::Doc, "App.activeDocument().%s.Label = '%s'", FeatName.c_str(), featLabel.str().c_str());
Command::doCommand(Command::Doc, "App.activeDocument().%s.translateLabel('DrawHatch', 'Hatch', '%s')",
FeatName.c_str(), FeatName.c_str());

View File

@@ -109,13 +109,15 @@ ViewProviderViewPart::ViewProviderViewPart()
ADD_PROPERTY_TYPE(CenterScale, (defScale), dgroup, App::Prop_None, "Center mark size adjustment, if enabled");
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,sgroup, App::Prop_None, "Show/hide section line if applicable");
ADD_PROPERTY_TYPE(ShowSectionLine ,(Preferences::showSectionLine()), sgroup, App::Prop_None, "Show/hide section line if applicable");
ADD_PROPERTY_TYPE(IncludeCutLine ,(Preferences::includeCutLine()), sgroup, App::Prop_None, "Show/hide section cut line if applicable");
ADD_PROPERTY_TYPE(SectionLineStyle, (Preferences::SectionLineStyle()), sgroup, App::Prop_None,
"Set section line style if applicable");
ADD_PROPERTY_TYPE(SectionLineColor, (prefSectionColor()), sgroup, App::Prop_None,
"Set section line color if applicable");
bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false;
// Assumption: ASME does not use change marks and ISO does use change marks
bool marksDefault = Preferences::sectionLineConvention() == 1 ? true : false;
ADD_PROPERTY_TYPE(SectionLineMarks, (marksDefault), sgroup, App::Prop_None,
"Show marks at direction changes for ComplexSection");
@@ -176,6 +178,7 @@ void ViewProviderViewPart::onChanged(const App::Property* prop)
prop == &(SectionLineStyle) ||
prop == &(SectionLineColor) ||
prop == &(SectionLineMarks) ||
prop == &(IncludeCutLine) ||
prop == &(HighlightLineStyle) ||
prop == &(HighlightLineColor) ||
prop == &(HorizCenterLine) ||

View File

@@ -53,6 +53,7 @@ public:
App::PropertyBool HorizCenterLine;
App::PropertyBool VertCenterLine;
App::PropertyBool ShowSectionLine;
App::PropertyBool IncludeCutLine;
App::PropertyEnumeration SectionLineStyle;
App::PropertyColor SectionLineColor;
App::PropertyBool SectionLineMarks;