diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp index 810708cfd5..555c5ac315 100644 --- a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp +++ b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp @@ -39,10 +39,11 @@ #include "Workbench.h" #include "MDIViewPage.h" -#include "DlgPrefsTechDraw1Imp.h" +#include "DlgPrefsTechDrawGeneralImp.h" #include "DlgPrefsTechDraw2Imp.h" #include "DlgPrefsTechDrawAnnotationImp.h" #include "DlgPrefsTechDrawDimensionsImp.h" +#include "DlgPrefsTechDrawColorsImp.h" #include "DlgPrefsTechDraw4Imp.h" #include "DlgPrefsTechDraw5Imp.h" #include "ViewProviderPage.h" @@ -150,10 +151,11 @@ PyMOD_INIT_FUNC(TechDrawGui) TechDrawGui::ViewProviderCosmeticExtension::init(); // register preferences pages - new Gui::PrefPageProducer ("TechDraw"); //General + new Gui::PrefPageProducer ("TechDraw"); //General new Gui::PrefPageProducer ("TechDraw"); //Scale - new Gui::PrefPageProducer ("TechDraw"); //Annotation new Gui::PrefPageProducer("TechDraw"); //Dimensions + new Gui::PrefPageProducer ("TechDraw"); //Annotation + new Gui::PrefPageProducer("TechDraw"); //Colors new Gui::PrefPageProducer ("TechDraw"); //HLR new Gui::PrefPageProducer ("TechDraw"); //Advanced diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index 35edc2ce17..edf2b77d49 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -44,10 +44,11 @@ set(TechDrawGui_MOC_HDRS QGIViewDimension.h QGIViewBalloon.h TaskProjGroup.h - DlgPrefsTechDraw1Imp.h + DlgPrefsTechDrawGeneralImp.h DlgPrefsTechDraw2Imp.h DlgPrefsTechDrawAnnotationImp.h DlgPrefsTechDrawDimensionsImp.h + DlgPrefsTechDrawColorsImp.h DlgPrefsTechDraw4Imp.h DlgPrefsTechDraw5Imp.h TaskLinkDim.h @@ -85,10 +86,11 @@ else() endif() set(TechDrawGui_UIC_SRCS - DlgPrefsTechDraw1.ui + DlgPrefsTechDrawGeneral.ui DlgPrefsTechDraw2.ui DlgPrefsTechDrawAnnotation.ui DlgPrefsTechDrawDimensions.ui + DlgPrefsTechDrawColors.ui DlgPrefsTechDraw4.ui DlgPrefsTechDraw5.ui TaskProjGroup.ui @@ -147,9 +149,9 @@ SET(TechDrawGui_SRCS TaskProjGroup.ui TaskProjGroup.cpp TaskProjGroup.h - DlgPrefsTechDraw1.ui - DlgPrefsTechDraw1Imp.cpp - DlgPrefsTechDraw1Imp.h + DlgPrefsTechDrawGeneral.ui + DlgPrefsTechDrawGeneralImp.cpp + DlgPrefsTechDrawGeneralImp.h DlgPrefsTechDraw2.ui DlgPrefsTechDraw2Imp.cpp DlgPrefsTechDraw2Imp.h @@ -159,6 +161,9 @@ SET(TechDrawGui_SRCS DlgPrefsTechDrawDimensions.ui DlgPrefsTechDrawDimensionsImp.cpp DlgPrefsTechDrawDimensionsImp.h + DlgPrefsTechDrawColors.ui + DlgPrefsTechDrawColorsImp.cpp + DlgPrefsTechDrawColorsImp.h DlgPrefsTechDraw4.ui DlgPrefsTechDraw4Imp.cpp DlgPrefsTechDraw4Imp.h diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColors.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColors.ui new file mode 100644 index 0000000000..80b91a87d6 --- /dev/null +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColors.ui @@ -0,0 +1,573 @@ + + + TechDrawGui::DlgPrefsTechDrawColorsImp + + + + 0 + 0 + 460 + 369 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Colors + + + + + + + + + + 0 + 0 + + + + + 0 + 225 + + + + + 0 + 200 + + + + Colors + + + + + + + + + true + + + + Normal + + + + + + + Normal line color + + + + 0 + 0 + 0 + + + + NormalColor + + + Mod/TechDraw/Colors + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + true + + + + Hidden Line + + + + + + + Hidden line color + + + HiddenColor + + + Mod/TechDraw/Colors + + + + + + + + true + + + + Preselected + + + + + + + Preselection color + + + + 255 + 255 + 20 + + + + PreSelectColor + + + Mod/TechDraw/Colors + + + + + + + + true + + + + Section Face + + + + + + + Section face color + + + + 225 + 225 + 225 + + + + CutSurfaceColor + + + Mod/TechDraw/Colors + + + + + + + + true + + + + Selected + + + + + + + Selected item color + + + + 28 + 173 + 28 + + + + SelectColor + + + Mod/TechDraw/Colors + + + + + + + Section Line + + + + + + + Section line color + + + SectionColor + + + /Mod/TechDraw/Decorations + + + + + + + + true + + + + Background + + + + + + + Background color around pages + + + + 80 + 80 + 80 + + + + Background + + + /Mod/TechDraw/Colors + + + + + + + + true + + + + Hatch + + + + + + + Hatch image color + + + + 0 + 0 + 0 + + + + Hatch + + + /Mod/TechDraw/Colors + + + + + + + Dimension + + + + + + + Color of dimension lines and text. + + + + 0 + 0 + 0 + + + + Color + + + Mod/TechDraw/Dimensions + + + + + + + + true + + + + Geometric Hatch + + + + + + + Geometric hatch pattern color + + + + 0 + 0 + 0 + + + + GeomHatch + + + /Mod/TechDraw/Colors + + + + + + + Centerline + + + + + + + Centerline color + + + CenterColor + + + Mod/TechDraw/Decorations + + + + + + + Vertex + + + + + + + Color of vertices in views + + + VertexColor + + + Mod/TechDraw/Decorations + + + + + + + + 0 + 20 + + + + + true + + + + Object faces will be transparent + + + Transparent Faces + + + ClearFace + + + /Mod/TechDraw/Colors + + + + + + + Face color (if not transparent) + + + + 255 + 255 + 255 + + + + FaceColor + + + /Mod/TechDraw/Colors + + + + + + + + true + + + + Detail Highlight + + + + + + + + true + + + + Leaderline + + + + + + + Default color for leader lines + + + + 0 + 0 + 0 + + + + Color + + + Mod/TechDraw/Markups + + + + + + + + 0 + 0 + 0 + + + + HighlightColor + + + /Mod/TechDraw/Decorations + + + + + + + + + + + + + 12 + true + + + + QFrame::Box + + + Items in italics are default values for new objects. They have no effect on existing objects. + + + true + + + + + + + Qt::Vertical + + + + 20 + 19 + + + + + + + + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+
+ + +
diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp new file mode 100644 index 0000000000..b3fdea7de1 --- /dev/null +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (c) 2020 FreeCAD Developers * + * Author: Uwe Stöhr * + * Based on src/Mod/FEM/Gui/DlgSettingsFEMImp.cpp * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#include "DlgPrefsTechDrawColorsImp.h" +#include + +using namespace TechDrawGui; + +DlgPrefsTechDrawColorsImp::DlgPrefsTechDrawColorsImp( QWidget* parent ) + : PreferencePage( parent ) +{ + this->setupUi(this); +} + +DlgPrefsTechDrawColorsImp::~DlgPrefsTechDrawColorsImp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgPrefsTechDrawColorsImp::saveSettings() +{ + pcbDimColor->onSave(); + pcb_Hatch->onSave(); + pcb_Background->onSave(); + pcb_PreSelect->onSave(); + pcb_Hidden->onSave(); + pcb_Select->onSave(); + pcb_Normal->onSave(); + pcb_Surface->onSave(); + pcb_GeomHatch->onSave(); + pcb_Face->onSave(); + pcb_PaintFaces->onSave(); + pcbSectionLine->onSave(); + pcbCenterColor->onSave(); + pcbVertexColor->onSave(); + pcbMarkup->onSave(); + pcbHighlight->onSave(); +} + +void DlgPrefsTechDrawColorsImp::loadSettings() +{ + pcbDimColor->onRestore(); + pcb_Hatch->onRestore(); + pcb_Background->onRestore(); + pcb_PreSelect->onRestore(); + pcb_Hidden->onRestore(); + pcb_Select->onRestore(); + pcb_Normal->onRestore(); + pcb_Surface->onRestore(); + pcb_GeomHatch->onRestore(); + pcb_Face->onRestore(); + pcb_PaintFaces->onRestore(); + pcbSectionLine->onRestore(); + pcbCenterColor->onRestore(); + pcbVertexColor->onRestore(); + pcbMarkup->onRestore(); + pcbHighlight->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgPrefsTechDrawColorsImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + saveSettings(); + retranslateUi(this); + loadSettings(); + } + else { + QWidget::changeEvent(e); + } +} + +#include diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h new file mode 100644 index 0000000000..df4422960f --- /dev/null +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h @@ -0,0 +1,49 @@ + /************************************************************************** + * Copyright (c) 2020 FreeCAD Developers * + * Author: Uwe Stöhr * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPCOLORS_H +#define DRAWINGGUI_DLGPREFSTECHDRAWIMPCOLORS_H + +#include +#include + +namespace TechDrawGui { + +class DlgPrefsTechDrawColorsImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawColorsImp +{ + Q_OBJECT + +public: + DlgPrefsTechDrawColorsImp( QWidget* parent = 0 ); + ~DlgPrefsTechDrawColorsImp(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); +}; + +} // namespace TechDrawGui + +#endif // DRAWINGGUI_DLGPREFSTECHDRAWIMPCOLORS_H diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui similarity index 58% rename from src/Mod/TechDraw/Gui/DlgPrefsTechDraw1.ui rename to src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui index fec43f04a1..d4504a266a 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneral.ui @@ -1,13 +1,13 @@ - TechDrawGui::DlgPrefsTechDraw1Imp - + TechDrawGui::DlgPrefsTechDrawGeneralImp + 0 0 460 - 760 + 510 @@ -185,494 +185,6 @@ for ProjectionGroups - - - - - 0 - 0 - - - - - 0 - 225 - - - - - 0 - 200 - - - - Colors - - - - - - - - - true - - - - Normal - - - - - - - Normal line color - - - - 0 - 0 - 0 - - - - NormalColor - - - Mod/TechDraw/Colors - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - true - - - - Hidden Line - - - - - - - Hidden line color - - - HiddenColor - - - Mod/TechDraw/Colors - - - - - - - - true - - - - Preselected - - - - - - - Preselection color - - - - 255 - 255 - 20 - - - - PreSelectColor - - - Mod/TechDraw/Colors - - - - - - - - true - - - - Section Face - - - - - - - Section face color - - - - 225 - 225 - 225 - - - - CutSurfaceColor - - - Mod/TechDraw/Colors - - - - - - - - true - - - - Selected - - - - - - - Selected item color - - - - 28 - 173 - 28 - - - - SelectColor - - - Mod/TechDraw/Colors - - - - - - - Section Line - - - - - - - Section line color - - - SectionColor - - - /Mod/TechDraw/Decorations - - - - - - - - true - - - - Background - - - - - - - Background color around pages - - - - 80 - 80 - 80 - - - - Background - - - /Mod/TechDraw/Colors - - - - - - - - true - - - - Hatch - - - - - - - Hatch image color - - - - 0 - 0 - 0 - - - - Hatch - - - /Mod/TechDraw/Colors - - - - - - - Dimension - - - - - - - Color of dimension lines and text. - - - - 0 - 0 - 0 - - - - Color - - - Mod/TechDraw/Dimensions - - - - - - - - true - - - - Geometric Hatch - - - - - - - Geometric hatch pattern color - - - - 0 - 0 - 0 - - - - GeomHatch - - - /Mod/TechDraw/Colors - - - - - - - Centerline - - - - - - - Centerline color - - - CenterColor - - - Mod/TechDraw/Decorations - - - - - - - Vertex - - - - - - - Color of vertices in views - - - VertexColor - - - Mod/TechDraw/Decorations - - - - - - - - 0 - 20 - - - - - true - - - - Object faces will be transparent - - - Transparent Faces - - - ClearFace - - - /Mod/TechDraw/Colors - - - - - - - Face color (if not transparent) - - - - 255 - 255 - 255 - - - - FaceColor - - - /Mod/TechDraw/Colors - - - - - - - - true - - - - Detail Highlight - - - - - - - - true - - - - Leaderline - - - - - - - Default color for leader lines - - - - 0 - 0 - 0 - - - - Color - - - Mod/TechDraw/Markups - - - - - - - - 0 - 0 - 0 - - - - HighlightColor - - - /Mod/TechDraw/Decorations - - - - - - - - @@ -1162,21 +674,11 @@ for ProjectionGroups QWidget
Gui/QuantitySpinBox.h
- - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
Gui::PrefFileChooser Gui::FileChooser
Gui/PrefWidgets.h
- - Gui::PrefColorButton - Gui::ColorButton -
Gui/PrefWidgets.h
-
Gui::PrefCheckBox QCheckBox diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp similarity index 71% rename from src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.cpp rename to src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp index 4c3c299027..52d4bc053b 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp @@ -25,12 +25,12 @@ #include "PreCompiled.h" -#include "DlgPrefsTechDraw1Imp.h" +#include "DlgPrefsTechDrawGeneralImp.h" #include using namespace TechDrawGui; -DlgPrefsTechDraw1Imp::DlgPrefsTechDraw1Imp( QWidget* parent ) +DlgPrefsTechDrawGeneralImp::DlgPrefsTechDrawGeneralImp( QWidget* parent ) : PreferencePage( parent ) { this->setupUi(this); @@ -38,12 +38,12 @@ DlgPrefsTechDraw1Imp::DlgPrefsTechDraw1Imp( QWidget* parent ) plsb_LabelSize->setMinimum(0); } -DlgPrefsTechDraw1Imp::~DlgPrefsTechDraw1Imp() +DlgPrefsTechDrawGeneralImp::~DlgPrefsTechDrawGeneralImp() { // no need to delete child widgets, Qt does it all for us } -void DlgPrefsTechDraw1Imp::saveSettings() +void DlgPrefsTechDrawGeneralImp::saveSettings() { pfc_DefTemp->onSave(); pfc_DefDir->onSave(); @@ -60,27 +60,9 @@ void DlgPrefsTechDraw1Imp::saveSettings() cb_Override->onSave(); cb_PageUpdate->onSave(); cb_AutoDist->onSave(); - - pcbDimColor->onSave(); - pcb_Hatch->onSave(); - pcb_Background->onSave(); - pcb_PreSelect->onSave(); - pcb_Hidden->onSave(); - pcb_Select->onSave(); - pcb_Normal->onSave(); - pcb_Surface->onSave(); - pcb_GeomHatch->onSave(); - pcb_Face->onSave(); - pcb_PaintFaces->onSave(); - pcbSectionLine->onSave(); - pcbCenterColor->onSave(); - pcbVertexColor->onSave(); - - pcbMarkup->onSave(); - pcbHighlight->onSave(); } -void DlgPrefsTechDraw1Imp::loadSettings() +void DlgPrefsTechDrawGeneralImp::loadSettings() { double labelDefault = 8.0; plsb_LabelSize->setValue(labelDefault); @@ -100,30 +82,12 @@ void DlgPrefsTechDraw1Imp::loadSettings() cb_Override->onRestore(); cb_PageUpdate->onRestore(); cb_AutoDist->onRestore(); - - pcbDimColor->onRestore(); - pcb_Hatch->onRestore(); - pcb_Background->onRestore(); - pcb_PreSelect->onRestore(); - pcb_Hidden->onRestore(); - pcb_Select->onRestore(); - pcb_Normal->onRestore(); - pcb_Surface->onRestore(); - pcb_GeomHatch->onRestore(); - pcb_Face->onRestore(); - pcb_PaintFaces->onRestore(); - pcbSectionLine->onRestore(); - pcbCenterColor->onRestore(); - pcbVertexColor->onRestore(); - - pcbMarkup->onRestore(); - pcbHighlight->onRestore(); } /** * Sets the strings of the subwidgets using the current language. */ -void DlgPrefsTechDraw1Imp::changeEvent(QEvent *e) +void DlgPrefsTechDrawGeneralImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); @@ -135,4 +99,4 @@ void DlgPrefsTechDraw1Imp::changeEvent(QEvent *e) } } -#include +#include diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h similarity index 81% rename from src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.h rename to src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h index e97fa37b3d..cde3671f92 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDraw1Imp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h @@ -1,7 +1,6 @@ /************************************************************************** * Copyright (c) 2015 FreeCAD Developers * * Author: WandererFan * - * Based on src/Mod/FEM/Gui/DlgPrefsTechDraw1Imp.cpp * * * * This file is part of the FreeCAD CAx development system. * * * @@ -23,21 +22,21 @@ ***************************************************************************/ -#ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMP1_H -#define DRAWINGGUI_DLGPREFSTECHDRAWIMP1_H +#ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPGENERAL_H +#define DRAWINGGUI_DLGPREFSTECHDRAWIMPGENERAL_H -#include +#include #include namespace TechDrawGui { -class DlgPrefsTechDraw1Imp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDraw1Imp +class DlgPrefsTechDrawGeneralImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawGeneralImp { Q_OBJECT public: - DlgPrefsTechDraw1Imp( QWidget* parent = 0 ); - ~DlgPrefsTechDraw1Imp(); + DlgPrefsTechDrawGeneralImp( QWidget* parent = 0 ); + ~DlgPrefsTechDrawGeneralImp(); protected: void saveSettings(); @@ -47,4 +46,4 @@ protected: } // namespace TechDrawGui -#endif // DRAWINGGUI_DLGPREFSTECHDRAWIMP1_H +#endif // DRAWINGGUI_DLGPREFSTECHDRAWIMPGENERAL_H