From 3c34abc0fac4721e201d8d0c53d61fcc1bd185be Mon Sep 17 00:00:00 2001 From: Wanderer Fan Date: Wed, 2 Mar 2022 18:03:41 -0500 Subject: [PATCH] [TD]move format spec to dimension tab - also make %.2w default format --- src/Mod/TechDraw/App/DrawViewDimension.cpp | 6 +- src/Mod/TechDraw/App/Preferences.cpp | 14 + src/Mod/TechDraw/App/Preferences.h | 6 +- .../TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui | 509 ++++++++-------- .../Gui/DlgPrefsTechDrawAdvancedImp.cpp | 2 - .../Gui/DlgPrefsTechDrawDimensions.ui | 552 +++++++++--------- .../Gui/DlgPrefsTechDrawDimensionsImp.cpp | 5 + 7 files changed, 550 insertions(+), 544 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 4c866f5918..3371ade06e 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -1470,9 +1470,7 @@ std::string DrawViewDimension::getPrefix() const std::string DrawViewDimension::getDefaultFormatSpec(bool isToleranceFormat) const { - Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions"); - std::string prefFormat = hGrp->GetASCII("formatSpec",""); + std::string prefFormat = Preferences::formatSpec(); QString formatSpec; QString qPrefix; if (prefFormat.empty()) { @@ -1482,7 +1480,7 @@ std::string DrawViewDimension::getDefaultFormatSpec(bool isToleranceFormat) cons if (useDecimals()) { precision = Base::UnitsApi::getDecimals(); } else { - precision = hGrp->GetInt("AltDecimals", 2); + precision = Preferences::altDecimals(); } QString formatPrecision = QString::number(precision); diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index f3a3c02601..06d5ba908c 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -233,3 +233,17 @@ std::string Preferences::lineGroupFile() } return lgFileName; } + +std::string Preferences::formatSpec() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions"); + return hGrp->GetASCII("formatSpec","%.2w"); +} + +int Preferences::altDecimals() +{ + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions"); + return hGrp->GetInt("AltDecimals", 2); +} diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index a61ed000a0..cadb10d752 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -67,9 +67,11 @@ static QString defaultTemplate(); static QString defaultTemplateDir(); static std::string lineGroupFile(); - - static const double DefaultFontSizeInMM; + +static std::string formatSpec(); +static int altDecimals(); + }; } //end namespace TechDraw diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui index 8e8020b124..1d67422e4b 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui @@ -7,7 +7,7 @@ 0 0 440 - 351 + 353 @@ -39,96 +39,8 @@ - - - - - - 0 - 20 - - - - Include 2D Objects in projection - - - Show Loose 2D Geom - - - false - - - ShowLoose2d - - - Mod/TechDraw/General - - - - - - - - 0 - 0 - - - - Include edges with unexpected geometry (zero length etc.) in results - - - Allow Crazy Edges - - - allowCrazyEdge - - - Mod/TechDraw/debug - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Edge Fuzz - - - + - - - - 0 - 20 - - - - Override automatic dimension format - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - formatSpec - - - /Mod/TechDraw/Dimensions - - - - @@ -174,60 +86,31 @@ Only change unless you know what you are doing! - - + + 0 0 - - - 0 - 20 - - - - - true - - - Perform a fuse operation on input shape(s) before Section view processing + If checked, TechDraw will attempt to build faces using the +line segments returned by the hidden line removal algorithm. +Faces must be detected in order to use hatching, but there +can be a performance penalty in complex models. - Fuse Before Section + Detect Faces + + + true - SectionFuseFirst + HandleFaces - Mod/TechDraw/General - - - - - - - - true - - - - Dimension Format - - - - - - - - true - - - - Line End Cap Shape + /Mod/TechDraw/General @@ -244,116 +127,7 @@ Only change unless you know what you are doing! - - - - - 0 - 0 - - - - - 0 - 20 - - - - Dump intermediate results during Detail view processing - - - Debug Detail - - - debugDetail - - - Mod/TechDraw/debug - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - Highlights border of section cut in section views - - - Show Section Edges - - - true - - - ShowSectionEdges - - - /Mod/TechDraw/General - - - - - - - 0 - 20 - - - - Limit of 64x64 pixel SVG tiles used to hatch a single face. -For large scalings you might get an error about to many SVG tiles. -Then you need to increase the tile limit. - - - Qt::AlignRight - - - 1 - - - 1000000 - - - 100 - - - 10000 - - - MaxSVGTile - - - Mod/TechDraw/Decorations - - - - - - - Max SVG Hatch Tiles - - - - - - - Max PAT Hatch Segments - - - - @@ -388,56 +162,75 @@ when hatching a face with a PAT pattern - - + + 0 0 - - Dump intermediate results during Section view processing - - - Debug Section - - - debugSection - - - Mod/TechDraw/debug - - - - - - - - 0 - 0 - + + + 0 + 20 + - If checked, TechDraw will attempt to build faces using the -line segments returned by the hidden line removal algorithm. -Faces must be detected in order to use hatching, but there -can be a performance penalty in complex models. + Highlights border of section cut in section views - Detect Faces + Show Section Edges true - HandleFaces + ShowSectionEdges /Mod/TechDraw/General + + + + + 0 + 0 + + + + + 0 + 0 + + + + Edge Fuzz + + + + + + + + true + + + + Line End Cap Shape + + + + + + + Max SVG Hatch Tiles + + + @@ -451,6 +244,61 @@ can be a performance penalty in complex models. + + + + + 0 + 0 + + + + Include edges with unexpected geometry (zero length etc.) in results + + + Allow Crazy Edges + + + allowCrazyEdge + + + Mod/TechDraw/debug + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + true + + + + Perform a fuse operation on input shape(s) before Section view processing + + + Fuse Before Section + + + SectionFuseFirst + + + Mod/TechDraw/General + + + @@ -492,6 +340,99 @@ Each unit is approx. 0.1 mm wide + + + + + 0 + 0 + + + + + 0 + 20 + + + + Dump intermediate results during Detail view processing + + + Debug Detail + + + debugDetail + + + Mod/TechDraw/debug + + + + + + + Max PAT Hatch Segments + + + + + + + + 0 + 20 + + + + Limit of 64x64 pixel SVG tiles used to hatch a single face. +For large scalings you might get an error about to many SVG tiles. +Then you need to increase the tile limit. + + + Qt::AlignRight + + + 1 + + + 1000000 + + + 100 + + + 10000 + + + MaxSVGTile + + + Mod/TechDraw/Decorations + + + + + + + + 0 + 0 + + + + Dump intermediate results during Section view processing + + + Debug Section + + + debugSection + + + Mod/TechDraw/debug + + + @@ -533,6 +474,31 @@ Each unit is approx. 0.1 mm wide + + + + + 0 + 20 + + + + Include 2D Objects in projection + + + Show Loose 2D Geom + + + false + + + ShowLoose2d + + + Mod/TechDraw/General + + + @@ -588,11 +554,6 @@ Each unit is approx. 0.1 mm wide QComboBox
Gui/PrefWidgets.h
- - Gui::PrefLineEdit - QLineEdit -
Gui/PrefWidgets.h
-
Gui::PrefDoubleSpinBox QDoubleSpinBox diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp index 39b6aeb6f1..746678620d 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp @@ -54,7 +54,6 @@ void DlgPrefsTechDrawAdvancedImp::saveSettings() ui->cbShowLoose->onSave(); ui->pdsbEdgeFuzz->onSave(); ui->pdsbMarkFuzz->onSave(); - ui->leFormatSpec->onSave(); ui->cbEndCap->onSave(); ui->sbMaxTiles->onSave(); ui->sbMaxPat->onSave(); @@ -71,7 +70,6 @@ void DlgPrefsTechDrawAdvancedImp::loadSettings() ui->cbShowLoose->onRestore(); ui->pdsbEdgeFuzz->onRestore(); ui->pdsbMarkFuzz->onRestore(); - ui->leFormatSpec->onRestore(); ui->cbEndCap->onRestore(); ui->sbMaxTiles->onRestore(); ui->sbMaxPat->onRestore(); diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui index 53dc670739..3654dbe68f 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui @@ -7,7 +7,7 @@ 0 0 440 - 336 + 380 @@ -46,6 +46,225 @@ + + + + + true + + + + Arrow Size + + + + + + + Diameter Symbol + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + Dimension text font size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4.000000000000000 + + + FontSize + + + /Mod/TechDraw/Dimensions + + + + + + + + 0 + 0 + + + + + 174 + 0 + + + + + 0 + 0 + + + + Tolerance text scale +Multiplier of 'Font Size' + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 0.100000000000000 + + + 0.800000000000000 + + + TolSizeAdjust + + + Mod/TechDraw/Dimensions + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + Append unit to dimension values + + + Show Units + + + ShowUnits + + + /Mod/TechDraw/Dimensions + + + + + + + + true + + + + Font Size + + + + + + + + true + + + + Arrow Style + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + false + + + + Tolerance Text Scale + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 12 + + + + Character used to indicate diameter dimensions + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + DiameterSymbol + + + /Mod/TechDraw/Dimensions + + + @@ -91,15 +310,10 @@ - - - - - true - - + + - Arrow Style + Alternate Decimals @@ -121,117 +335,6 @@ - - - - - 0 - 0 - - - - - 0 - 22 - - - - Arrowhead style - - - -1 - - - ArrowStyle - - - Mod/TechDraw/Dimensions - - - - - - - - true - - - - Arrow Size - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - - 12 - - - - Character used to indicate diameter dimensions - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - DiameterSymbol - - - /Mod/TechDraw/Dimensions - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - Append unit to dimension values - - - Show Units - - - ShowUnits - - - /Mod/TechDraw/Dimensions - - - - - - - Diameter Symbol - - - @@ -262,6 +365,65 @@ + + + + + 0 + 0 + + + + + 0 + 22 + + + + Arrowhead size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 5.000000000000000 + + + ArrowSize + + + Mod/TechDraw/Dimensions + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + Arrowhead style + + + -1 + + + ArrowStyle + + + Mod/TechDraw/Dimensions + + + @@ -296,165 +458,31 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - Dimension text font size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 4.000000000000000 - - - FontSize - - - /Mod/TechDraw/Dimensions - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - Arrowhead size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 5.000000000000000 - - - ArrowSize - - - Mod/TechDraw/Dimensions - - - - - - - Alternate Decimals - - - - + true - Font Size + Dimension Format - - - - - 0 - 0 - - - - - 0 - 0 - - - - - false - - - - Tolerance Text Scale - - - - - - - - 0 - 0 - - - - - 174 - 0 - - - - - 0 - 0 - - + + - Tolerance text scale -Multiplier of 'Font Size' - - - + <html><head/><body><p>Leave blank for automatic dimension format. Use %f, %g or %w specifiers to override.</p></body></html> Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - 0.100000000000000 - - - 0.800000000000000 - - TolSizeAdjust + formatSpec - Mod/TechDraw/Dimensions + /Mod/TechDraw/Dimensions @@ -472,7 +500,7 @@ Multiplier of 'Font Size' - <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> true diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp index 8cc4a5702d..a520e3bcf0 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "DrawGuiUtil.h" #include "PreferencesGui.h" @@ -67,6 +68,7 @@ void DlgPrefsTechDrawDimensionsImp::saveSettings() ui->leDiameter->onSave(); ui->pcbArrow->onSave(); ui->plsb_ArrowSize->onSave(); + ui->leFormatSpec->onSave(); } void DlgPrefsTechDrawDimensionsImp::loadSettings() @@ -92,6 +94,9 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings() DrawGuiUtil::loadArrowBox(ui->pcbArrow); ui->pcbArrow->setCurrentIndex(prefArrowStyle()); + + ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec())); + ui->leFormatSpec->onRestore(); } /**