diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp b/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp index 2bdb7b48c7e6..7032f6b6252b 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.cpp @@ -60,24 +60,6 @@ void DlgSettingsObjectColor::saveSettings() DefaultShapeVertexColor->onSave(); DefaultShapeVertexWidth->onSave(); BoundingBoxColor->onSave(); - - // Sketcher - SketchEdgeColor->onSave(); - SketchVertexColor->onSave(); - EditedEdgeColor->onSave(); - EditedVertexColor->onSave(); - ConstructionColor->onSave(); - FullyConstrainedColor->onSave(); - - ConstrainedColor->onSave(); - DatumColor->onSave(); - - SketcherDatumWidth->onSave(); - DefaultSketcherVertexWidth->onSave(); - DefaultSketcherLineWidth->onSave(); - - CursorTextColor->onSave(); - } void DlgSettingsObjectColor::loadSettings() @@ -89,23 +71,6 @@ void DlgSettingsObjectColor::loadSettings() DefaultShapeVertexColor->onRestore(); DefaultShapeVertexWidth->onRestore(); BoundingBoxColor->onRestore(); - - // Sketcher - SketchEdgeColor->onRestore(); - SketchVertexColor->onRestore(); - EditedEdgeColor->onRestore(); - EditedVertexColor->onRestore(); - ConstructionColor->onRestore(); - FullyConstrainedColor->onRestore(); - - ConstrainedColor->onRestore(); - DatumColor->onRestore(); - - SketcherDatumWidth->onRestore(); - DefaultSketcherVertexWidth->onRestore(); - DefaultSketcherLineWidth->onRestore(); - - CursorTextColor->onRestore(); } /** diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui index 0b9daf676337..3272497a93ae 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.ui +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.ui @@ -7,7 +7,7 @@ 0 0 359 - 834 + 282 @@ -40,7 +40,7 @@ The default color for new shapes - + 204 204 @@ -73,7 +73,7 @@ The default line color for new shapes - + 25 25 @@ -141,7 +141,7 @@ The default line color for new shapes - + 25 25 @@ -209,7 +209,7 @@ The color of bounding boxes in the 3D view - + 255 255 @@ -242,431 +242,6 @@ - - - - Sketcher colors - - - - - - - - - 182 - 0 - - - - Default edge color - - - - - - - The color of edges being edited - - - - 255 - 255 - 255 - - - - SketchEdgeColor - - - View - - - - - - - - 182 - 0 - - - - Default vertex color - - - - - - - The color of vertices being edited - - - - 255 - 255 - 255 - - - - SketchVertexColor - - - View - - - - - - - - 182 - 0 - - - - Edit edge color - - - - - - - The color of edges being edited - - - - 255 - 255 - 255 - - - - EditedEdgeColor - - - View - - - - - - - - 182 - 0 - - - - Edit vertex color - - - - - - - The color of vertices being edited - - - - 255 - 38 - 0 - - - - EditedVertexColor - - - View - - - - - - - - 182 - 0 - - - - Construction geometry - - - - - - - The color of construction geometry in edit mode - - - - 0 - 0 - 220 - - - - ConstructionColor - - - View - - - - - - - - 182 - 0 - - - - Fully constrained geometry - - - - - - - The color of fully constrained geometry in edit mode - - - - 0 - 255 - 0 - - - - FullyConstrainedColor - - - View - - - - - - - - 182 - 0 - - - - Constrain color - - - - - - - The color of fully constrained geometry in edit mode - - - - 0 - 255 - 0 - - - - ConstrainedColor - - - View - - - - - - - - 182 - 0 - - - - Datum color - - - - - - - The color of fully constrained geometry in edit mode - - - - 0 - 255 - 0 - - - - DatumColor - - - View - - - - - - - - 182 - 0 - - - - Datum text size - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultSketcherVertexWidth - - - View - - - - - - - - 182 - 0 - - - - Default vertex size - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultSketcherVertexWidth - - - View - - - - - - - - 182 - 0 - - - - Default line width - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultShapeLineWidth - - - View - - - - - - - - 182 - 0 - - - - Cursor text color - - - - - - - - 0 - 0 - 255 - - - - CursorTextColor - - - View - - - - - - - - - Qt::Horizontal - - - - 74 - 20 - - - - - - - @@ -703,11 +278,6 @@ DefaultShapeColor DefaultShapeLineWidth DefaultShapeLineColor - CursorTextColor - EditedEdgeColor - EditedVertexColor - ConstructionColor - FullyConstrainedColor BoundingBoxColor diff --git a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp index 802b57481fa9..a739717c8a91 100644 --- a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp +++ b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp @@ -30,11 +30,13 @@ #include #include #include +#include #include "Workbench.h" #include "ViewProviderSketch.h" #include "ViewProviderPython.h" #include "SoDatumLabel.h" #include "SoZoomTranslation.h" +#include "SketcherSettings.h" // create the commands void CreateSketcherCommands(void); @@ -89,6 +91,8 @@ void SketcherGuiExport initSketcherGui() SketcherGui::SoDatumLabel ::initClass(); SketcherGui::SoZoomTranslation ::initClass(); + (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Display") ); + // add resources and reloads the translators loadSketcherResource(); } diff --git a/src/Mod/Sketcher/Gui/CMakeLists.txt b/src/Mod/Sketcher/Gui/CMakeLists.txt index dd436b67f101..83950692c3cb 100644 --- a/src/Mod/Sketcher/Gui/CMakeLists.txt +++ b/src/Mod/Sketcher/Gui/CMakeLists.txt @@ -34,6 +34,7 @@ set(SketcherGui_MOC_HDRS TaskSketcherValidation.h TaskDlgEditSketch.h SketchOrientationDialog.h + SketcherSettings.h ) fc_wrap_cpp(SketcherGui_MOC_SRCS ${SketcherGui_MOC_HDRS}) SOURCE_GROUP("Moc" FILES ${SketcherGui_MOC_SRCS}) @@ -47,6 +48,7 @@ set(SketcherGui_UIC_SRCS TaskSketcherValidation.ui InsertDatum.ui SketchOrientationDialog.ui + SketcherSettings.ui ) qt4_wrap_ui(SketcherGui_UIC_HDRS ${SketcherGui_UIC_SRCS}) @@ -90,6 +92,8 @@ SET(SketcherGui_SRCS EditDatumDialog.h SketchOrientationDialog.cpp SketchOrientationDialog.h + SketcherSettings.cpp + SketcherSettings.h TaskDlgEditSketch.cpp TaskDlgEditSketch.h ViewProviderPython.cpp diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp new file mode 100644 index 000000000000..5dab75e24f9a --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -0,0 +1,105 @@ +/*************************************************************************** + * Copyright (c) 2014 Werner Mayer * + * * + * 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" + +#ifndef _PreComp_ +#endif + +#include "SketcherSettings.h" +#include "ui_SketcherSettings.h" +#include + +using namespace SketcherGui; + +/* TRANSLATOR SketcherGui::SketcherSettings */ + +SketcherSettings::SketcherSettings(QWidget* parent) + : PreferencePage(parent), ui(new Ui_SketcherSettings) +{ + ui->setupUi(this); +} + +/** + * Destroys the object and frees any allocated resources + */ +SketcherSettings::~SketcherSettings() +{ + // no need to delete child widgets, Qt does it all for us +} + +void SketcherSettings::saveSettings() +{ + // Sketcher + ui->SketchEdgeColor->onSave(); + ui->SketchVertexColor->onSave(); + ui->EditedEdgeColor->onSave(); + ui->EditedVertexColor->onSave(); + ui->ConstructionColor->onSave(); + ui->FullyConstrainedColor->onSave(); + + ui->ConstrainedColor->onSave(); + ui->DatumColor->onSave(); + + ui->SketcherDatumWidth->onSave(); + ui->DefaultSketcherVertexWidth->onSave(); + ui->DefaultSketcherLineWidth->onSave(); + + ui->CursorTextColor->onSave(); +} + +void SketcherSettings::loadSettings() +{ + // Sketcher + ui->SketchEdgeColor->onRestore(); + ui->SketchVertexColor->onRestore(); + ui->EditedEdgeColor->onRestore(); + ui->EditedVertexColor->onRestore(); + ui->ConstructionColor->onRestore(); + ui->FullyConstrainedColor->onRestore(); + + ui->ConstrainedColor->onRestore(); + ui->DatumColor->onRestore(); + + ui->SketcherDatumWidth->onRestore(); + ui->DefaultSketcherVertexWidth->onRestore(); + ui->DefaultSketcherLineWidth->onRestore(); + + ui->CursorTextColor->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void SketcherSettings::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_SketcherSettings.cpp" + diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.h b/src/Mod/Sketcher/Gui/SketcherSettings.h new file mode 100644 index 000000000000..a9f428e6af41 --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherSettings.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (c) 2014 Werner Mayer * + * * + * 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 SKETCHERGUI_SKETCHERSETTINGS_H +#define SKETCHERGUI_SKETCHERSETTINGS_H + +#include + +namespace SketcherGui { +class Ui_SketcherSettings; +/** + * The SketcherSettings class implements a preference page to change sketcher settings. + * @author Werner Mayer + */ +class SketcherSettings : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + SketcherSettings(QWidget* parent = 0); + ~SketcherSettings(); + + void saveSettings(); + void loadSettings(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui_SketcherSettings* ui; +}; + +} // namespace SketcherGui + +#endif // SKETCHERGUI_SKETCHERSETTINGS_H diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui new file mode 100644 index 000000000000..1bb13076d2ba --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui @@ -0,0 +1,483 @@ + + + SketcherGui::SketcherSettings + + + + 0 + 0 + 359 + 834 + + + + Sketcher + + + + + + Sketcher colors + + + + + + + + + 182 + 0 + + + + Default edge color + + + + + + + The color of edges being edited + + + + 255 + 255 + 255 + + + + SketchEdgeColor + + + View + + + + + + + + 182 + 0 + + + + Default vertex color + + + + + + + The color of vertices being edited + + + + 255 + 255 + 255 + + + + SketchVertexColor + + + View + + + + + + + + 182 + 0 + + + + Edit edge color + + + + + + + The color of edges being edited + + + + 255 + 255 + 255 + + + + EditedEdgeColor + + + View + + + + + + + + 182 + 0 + + + + Edit vertex color + + + + + + + The color of vertices being edited + + + + 255 + 38 + 0 + + + + EditedVertexColor + + + View + + + + + + + + 182 + 0 + + + + Construction geometry + + + + + + + The color of construction geometry in edit mode + + + + 0 + 0 + 220 + + + + ConstructionColor + + + View + + + + + + + + 182 + 0 + + + + Fully constrained geometry + + + + + + + The color of fully constrained geometry in edit mode + + + + 0 + 255 + 0 + + + + FullyConstrainedColor + + + View + + + + + + + + 182 + 0 + + + + Constrain color + + + + + + + The color of fully constrained geometry in edit mode + + + + 0 + 255 + 0 + + + + ConstrainedColor + + + View + + + + + + + + 182 + 0 + + + + Datum color + + + + + + + The color of fully constrained geometry in edit mode + + + + 0 + 255 + 0 + + + + DatumColor + + + View + + + + + + + + 182 + 0 + + + + Datum text size + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultSketcherVertexWidth + + + View + + + + + + + + 182 + 0 + + + + Default vertex size + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultSketcherVertexWidth + + + View + + + + + + + + 182 + 0 + + + + Default line width + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultShapeLineWidth + + + View + + + + + + + + 182 + 0 + + + + Cursor text color + + + + + + + + 0 + 0 + 255 + + + + CursorTextColor + + + View + + + + + + + + + Qt::Horizontal + + + + 74 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 217 + + + + + + + + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+
+ + CursorTextColor + EditedEdgeColor + EditedVertexColor + ConstructionColor + FullyConstrainedColor + + + +