From e9732b4b0af913e146a7d101eca784e054a96272 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Thu, 25 Jan 2018 16:33:31 +0100 Subject: [PATCH] Sketcher: Setting in Preferences to switch on/off notification of constraint substitution ========================================================================================= By default notification is on, so that Newbies do not complain why FC is deleting that other constraint they have added before. Power users generally will set it off, as they do not want to be bothered by pop ups and know what they are doing. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 15 ++++-- src/Mod/Sketcher/Gui/SketcherSettings.cpp | 2 + src/Mod/Sketcher/Gui/SketcherSettings.ui | 55 +++++++++++++++++++++ 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index f16ff8a05c..4d34476bd1 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -2339,8 +2339,12 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) commitCommand(); tryAutoRecomputeIfNotSolve(Obj); - QMessageBox::information(Gui::getMainWindow(), QObject::tr("Constraint Substitution"), - QObject::tr("Endpoint to endpoint tangency was applied instead.")); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/General"); + + if(hGrp->GetBool("NotifyConstraintSubstitutions", true)) { + QMessageBox::information(Gui::getMainWindow(), QObject::tr("Constraint Substitution"), + QObject::tr("Endpoint to endpoint tangency was applied instead.")); + } getSelection().clearSelection(); return; @@ -4561,9 +4565,12 @@ void CmdSketcherConstrainTangent::activated(int iMsg) commitCommand(); tryAutoRecomputeIfNotSolve(Obj); - QMessageBox::information(Gui::getMainWindow(), QObject::tr("Constraint Substitution"), + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/General"); + + if(hGrp->GetBool("NotifyConstraintSubstitutions", true)) { + QMessageBox::information(Gui::getMainWindow(), QObject::tr("Constraint Substitution"), QObject::tr("Endpoint to endpoint tangency was applied. The coincident constraint was deleted.")); - + } getSelection().clearSelection(); return; } diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index e215216c75..5f7aa495d8 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -106,6 +106,7 @@ void SketcherSettings::saveSettings() ui->checkBoxTVShowLinks->onSave(); ui->checkBoxTVShowSupport->onSave(); ui->checkBoxTVRestoreCamera->onSave(); + ui->checkBoxNotifyConstraintSubstitutions->onSave(); form->saveSettings(); ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); @@ -132,6 +133,7 @@ void SketcherSettings::loadSettings() ui->checkBoxTVShowLinks->onRestore(); ui->checkBoxTVShowSupport->onRestore(); ui->checkBoxTVRestoreCamera->onRestore(); + ui->checkBoxNotifyConstraintSubstitutions->onRestore(); form->loadSettings(); std::list sizes = Gui::Inventor::MarkerBitmaps::getSupportedSizes("CIRCLE_FILLED"); diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui index 704344cf6b..ce1cf3b6d8 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui @@ -280,6 +280,61 @@ + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 0 + 0 + + + + Notifications + + + + + + Notify automatic constraint substitutions. + + + Notify automatic constraint substitutions + + + true + + + NotifyConstraintSubstitutions + + + Mod/Sketcher/General + + + + + +