diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 9c10869e5..dea9a0487 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -26,14 +26,18 @@ #ifndef _PreComp_ # include # include +# include #endif #include "SketcherSettings.h" #include "ui_SketcherSettings.h" #include "TaskSketcherGeneral.h" +#include +#include #include #include #include +#include using namespace SketcherGui; @@ -82,6 +86,8 @@ SketcherSettings::SketcherSettings(QWidget* parent) ui->comboBox->addItem(QIcon(px), QString(), QVariant(it->second)); } + + connect(ui->btnTVApply, SIGNAL(clicked(bool)), this, SLOT(onBtnTVApplyClicked(bool))); } /** @@ -119,6 +125,10 @@ void SketcherSettings::saveSettings() ui->dialogOnDistanceConstraint->onSave(); ui->continueMode->onSave(); ui->checkBoxAdvancedSolverTaskBox->onSave(); + ui->checkBoxTVHideDependent->onSave(); + ui->checkBoxTVShowLinks->onSave(); + ui->checkBoxTVShowSupport->onSave(); + ui->checkBoxTVRestoreCamera->onSave(); form->saveSettings(); ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); @@ -157,6 +167,10 @@ void SketcherSettings::loadSettings() ui->dialogOnDistanceConstraint->onRestore(); ui->continueMode->onRestore(); ui->checkBoxAdvancedSolverTaskBox->onRestore(); + ui->checkBoxTVHideDependent->onRestore(); + ui->checkBoxTVShowLinks->onRestore(); + ui->checkBoxTVShowSupport->onRestore(); + ui->checkBoxTVRestoreCamera->onRestore(); form->loadSettings(); std::list sizes = Gui::Inventor::MarkerBitmaps::getSupportedSizes("CIRCLE_FILLED"); @@ -189,5 +203,32 @@ void SketcherSettings::changeEvent(QEvent *e) } } +void SketcherSettings::onBtnTVApplyClicked(bool) +{ + QString errMsg; + try{ + Gui::Command::doCommand(Gui::Command::Gui, + "for name,doc in App.listDocuments().items():\n" + " for sketch in doc.findObjects('Sketcher::SketchObject'):\n" + " sketch.ViewObject.HideDependent = %s\n" + " sketch.ViewObject.ShowLinks = %s\n" + " sketch.ViewObject.ShowSupport = %s\n" + " sketch.ViewObject.RestoreCamera = %s\n", + this->ui->checkBoxTVHideDependent->isChecked() ? "True": "False", + this->ui->checkBoxTVShowLinks->isChecked() ? "True": "False", + this->ui->checkBoxTVShowSupport->isChecked() ? "True": "False", + this->ui->checkBoxTVRestoreCamera->isChecked() ? "True": "False"); + } catch (Base::PyException &e){ + Base::Console().Error("SketcherSettings::onBtnTVApplyClicked:\n"); + e.ReportException(); + errMsg = QString::fromLatin1(e.what()); + } catch (...) { + errMsg = tr("Unexpected C++ exception"); + } + if(errMsg.length()>0){ + QMessageBox::warning(this, tr("Sketcher"),errMsg); + } +} + #include "moc_SketcherSettings.cpp" diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.h b/src/Mod/Sketcher/Gui/SketcherSettings.h index 5f4d85bca..07c2d3b7c 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.h +++ b/src/Mod/Sketcher/Gui/SketcherSettings.h @@ -47,6 +47,9 @@ public: protected: void changeEvent(QEvent *e); +private Q_SLOTS: + void onBtnTVApplyClicked(bool); + private: Ui_SketcherSettings* ui; SketcherGeneralWidget* form; diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui index eb5c1285b..0b60d4197 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui @@ -6,14 +6,49 @@ 0 0 - 404 - 744 + 427 + 1253 Sketcher + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Sketch Solver + + + + + + Show Advanced Solver Control in the Task bar + + + ShowSolverAdvancedWidget + + + Mod/Sketcher + + + + + + @@ -40,7 +75,7 @@ The color of edges being edited - + 255 255 @@ -73,7 +108,7 @@ The color of vertices being edited - + 255 255 @@ -106,7 +141,7 @@ The color of edges being edited - + 255 255 @@ -139,7 +174,7 @@ The color of vertices being edited - + 255 38 @@ -172,7 +207,7 @@ The color of fully constrained geometry in edit mode - + 255 38 @@ -192,7 +227,7 @@ The color of construction geometry in edit mode - + 0 0 @@ -225,7 +260,7 @@ The color of external geometry in edit mode - + 204 51 @@ -271,7 +306,7 @@ The color of fully constrained geometry in edit mode - + 0 255 @@ -397,7 +432,7 @@ - + 0 0 @@ -446,7 +481,7 @@ The color of driving constraints in edit mode - + 255 38 @@ -466,7 +501,7 @@ The color of non-driving constrains or dimensions in edit mode - + 0 38 @@ -492,19 +527,6 @@ Sketch editing - - - - - 182 - 0 - - - - Font size - - - @@ -540,13 +562,16 @@ - - - - - + + + + + 182 + 0 + + - Grid line pattern + Font size @@ -573,6 +598,16 @@ + + + + + + + Grid line pattern + + + @@ -589,44 +624,156 @@ - - - - - - - Sketch Solver - - - - - - Show Advanced Solver Control in the Task bar + + + + true - - ShowSolverAdvancedWidget + + + 0 + 0 + - - Mod/Sketcher + + + 0 + 0 + + + + 16777215 + 16777215 + + + + + 0 + 0 + + + + Visibility automation + + + + + + When opening sketch, hide all features that depend on it. + + + Hide all objects that depend on the sketch + + + true + + + HideDependent + + + Mod/Sketcher/General + + + + + + + When opening sketch, show sources for external geometry links. + + + Show objects used for external geometry + + + true + + + ShowLinks + + + Mod/Sketcher/General + + + + + + + When opening sketch, show objects the sketch is attached to. + + + Show object(s) sketch is attached to + + + true + + + ShowSupport + + + Mod/Sketcher/General + + + + + + + When closing sketch, move camera back to where it was before sketch was opened. + + + Restore camera position after editing + + + true + + + RestoreCamera + + + Mod/Sketcher/General + + + + + + + + 0 + 0 + + + + Note: these settings are defaults applied to new sketches. The behavior is remembered for each sketch individually as properties on View tab. + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + true + + + + + + + + 0 + 0 + + + + Apply current smart visibility to all sketches in open documents (update properties to match). + + + Apply to existing sketches + + + + - - - - Qt::Vertical - - - - 20 - 217 - - - - @@ -652,11 +799,31 @@ - CursorTextColor + SketchEdgeColor + SketchVertexColor EditedEdgeColor EditedVertexColor ConstructionColor + ExternalColor FullyConstrainedColor + ConstrainedColor + NonDrivingConstraintColor + DatumColor + SketcherDatumWidth + DefaultSketcherVertexWidth + DefaultSketcherLineWidth + CursorTextColor + EditSketcherFontSize + EditSketcherMarkerSize + comboBox + dialogOnDistanceConstraint + continueMode + checkBoxTVHideDependent + checkBoxTVShowLinks + checkBoxTVShowSupport + checkBoxTVRestoreCamera + btnTVApply + checkBoxAdvancedSolverTaskBox