From f30fa540381a3c24ffbb76255295038c64768d0c Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Wed, 17 Nov 2021 18:04:12 +0100 Subject: [PATCH] [Gui] Add corner cross size as a preference in Display/3D View/General --- src/Gui/DlgSettings3DView.ui | 97 ++++++++++++++++++++++++++------ src/Gui/DlgSettings3DViewImp.cpp | 2 + src/Gui/SplitView3DInventor.cpp | 5 ++ src/Gui/View3DInventor.cpp | 4 ++ 4 files changed, 91 insertions(+), 17 deletions(-) diff --git a/src/Gui/DlgSettings3DView.ui b/src/Gui/DlgSettings3DView.ui index c4191841d9..6dadb4bf13 100644 --- a/src/Gui/DlgSettings3DView.ui +++ b/src/Gui/DlgSettings3DView.ui @@ -24,24 +24,76 @@ - - - Main coordinate system will always be shown in + + + + + Main coordinate system will always be shown in lower right corner within opened files - - - Show coordinate system in the corner - - - true - - - CornerCoordSystem - - - View - - + + + Show coordinate system in the corner + + + true + + + CornerCoordSystem + + + View + + + + + + + Qt::Horizontal + + + + 40 + + + + + + + + Relative size : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Size of main coordinate system representation +in the corner -- in % of height/width of viewport + + + 2 + + + 100 + + + 10 + + + % + + + CornerCoordSystemSize + + + View + + + + @@ -626,6 +678,11 @@ bounding box size of the 3D object that is currently displayed. QDoubleSpinBox
Gui/PrefWidgets.h
+ + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
@@ -677,5 +734,11 @@ bounding box size of the 3D object that is currently displayed. + + CheckBox_CornerCoordSystem + toggled(bool) + SpinBox_CornerCoordSystemSize + setEnabled(bool) + diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index b1fe1d71aa..5459ff4c91 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -89,6 +89,7 @@ void DlgSettings3DViewImp::saveSettings() hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); ui->CheckBox_CornerCoordSystem->onSave(); + ui->SpinBox_CornerCoordSystemSize->onSave(); ui->CheckBox_ShowAxisCross->onSave(); ui->CheckBox_WbByTab->onSave(); ui->CheckBox_ShowFPS->onSave(); @@ -106,6 +107,7 @@ void DlgSettings3DViewImp::saveSettings() void DlgSettings3DViewImp::loadSettings() { ui->CheckBox_CornerCoordSystem->onRestore(); + ui->SpinBox_CornerCoordSystemSize->onRestore(); ui->CheckBox_ShowAxisCross->onRestore(); ui->CheckBox_WbByTab->onRestore(); ui->CheckBox_ShowFPS->onRestore(); diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index 78a7102da5..654542dc85 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -98,6 +98,7 @@ void AbstractSplitView::setupSettings() // apply the user settings OnChange(*hGrp,"EyeDistance"); OnChange(*hGrp,"CornerCoordSystem"); + OnChange(*hGrp,"CornerCoordSystemSize"); OnChange(*hGrp,"UseAutoRotation"); OnChange(*hGrp,"Gradient"); OnChange(*hGrp,"BackgroundColor"); @@ -248,6 +249,10 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) (*it)->setFeedbackVisibility(rGrp.GetBool("CornerCoordSystem",true)); } + else if (strcmp(Reason,"CornerCoordSystemSize") == 0) { + for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) + (*it)->setFeedbackSize(rGrp.GetInt("CornerCoordSystemSize",10)); + } else if (strcmp(Reason,"UseAutoRotation") == 0) { for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) (*it)->setAnimationEnabled(rGrp.GetBool("UseAutoRotation",false)); diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index c03281cfab..ab8e284b10 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -162,6 +162,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, // apply the user settings OnChange(*hGrp,"EyeDistance"); OnChange(*hGrp,"CornerCoordSystem"); + OnChange(*hGrp,"CornerCoordSystemSize"); OnChange(*hGrp,"ShowAxisCross"); OnChange(*hGrp,"UseAutoRotation"); OnChange(*hGrp,"Gradient"); @@ -378,6 +379,9 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M else if (strcmp(Reason,"CornerCoordSystem") == 0) { _viewer->setFeedbackVisibility(rGrp.GetBool("CornerCoordSystem",true)); } + else if (strcmp(Reason,"CornerCoordSystemSize") == 0) { + _viewer->setFeedbackSize(rGrp.GetInt("CornerCoordSystemSize",10)); + } else if (strcmp(Reason,"ShowAxisCross") == 0) { _viewer->setAxisCross(rGrp.GetBool("ShowAxisCross",false)); }