diff --git a/src/Gui/PreferencePages/DlgSettingsViewColor.cpp b/src/Gui/PreferencePages/DlgSettingsViewColor.cpp index 2d42e4f48b..4f3c7d2209 100644 --- a/src/Gui/PreferencePages/DlgSettingsViewColor.cpp +++ b/src/Gui/PreferencePages/DlgSettingsViewColor.cpp @@ -75,6 +75,8 @@ void DlgSettingsViewColor::saveSettings() ui->checkMidColor->onSave(); ui->TreeEditColor->onSave(); ui->TreeActiveColor->onSave(); + ui->CbLabelColor->onSave(); + ui->CbLabelTextSize->onSave(); } void DlgSettingsViewColor::loadSettings() @@ -89,7 +91,9 @@ void DlgSettingsViewColor::loadSettings() ui->checkMidColor->onRestore(); ui->TreeEditColor->onRestore(); ui->TreeActiveColor->onRestore(); - + ui->CbLabelColor->onRestore(); + ui->CbLabelTextSize->onRestore(); + if (ui->radioButtonSimple->isChecked()) onRadioButtonSimpleToggled(true); else if(ui->radioButtonGradient->isChecked()) diff --git a/src/Gui/PreferencePages/DlgSettingsViewColor.ui b/src/Gui/PreferencePages/DlgSettingsViewColor.ui index b0dbf033f5..61abe9714f 100644 --- a/src/Gui/PreferencePages/DlgSettingsViewColor.ui +++ b/src/Gui/PreferencePages/DlgSettingsViewColor.ui @@ -407,7 +407,140 @@ - + + + Color Bar + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + + 240 + 0 + + + + + + + Label text color + + + + + + + true + + + + 0 + 0 + + + + Color Bar (used in Mesh and FEM Wbs) Label text color + + + + 255 + 255 + 255 + + + + CbLabelColor + + + View + + + + + + + Label text size + + + + + + + Color Bar (used in Mesh and FEM Wbs) Label Text Size + + + Qt::AlignLeft|Qt::AlignVCenter + + + 4 + + + 36 + + + 13 + + + CbLabelTextSize + + + View + + + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + + + + + Qt::Vertical @@ -442,6 +575,11 @@ QCheckBox
Gui/PrefWidgets.h
+ + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
SelectionColor_Background diff --git a/src/Gui/SoFCColorBar.cpp b/src/Gui/SoFCColorBar.cpp index 64a12ae90a..ff36dabf2d 100644 --- a/src/Gui/SoFCColorBar.cpp +++ b/src/Gui/SoFCColorBar.cpp @@ -123,15 +123,23 @@ float SoFCColorBarBase::getBounds(const SbVec2s& size, float& fMinX, float&fMinY // The cam height is set in SoFCColorBarBase::getBoundingWidth to 10. // Therefore the normalized coordinates are in the range [-5, +5] x [-5ratio, +5ratio] if ratio > 1 // and [-5ratio, +5ratio] x [-5, +5] if ratio < 1. - // We don't want the whole height covered by the color bar (to have e.g space to the axis cross) - // thus we take as base 4. - float baseYValue = 4.0f; + // We don't want the whole height covered by the color bar (to have e.g space to the axis cross + // and the Navigation Cube) thus we take as base 3 or if the height reduces significantly it is 2.5. + + float baseYValue; + if (fRatio > 3.0f) { + baseYValue = 2.5f; + } + else { + baseYValue = 3.0f; + } float barWidth = 0.5f; - // we want the color bar at the rightmost position, therefore we take 5 as base - fMinX = 5.0f * fRatio; // must be scaled with the ratio to assure it stays at the right + // we want the color bar at the rightmost position, therefore we take 4.95 as base + fMinX = 4.95f * fRatio; // must be scaled with the ratio to assure it stays at the right + fMaxX = fMinX + barWidth; - fMinY = -baseYValue; + fMinY = -baseYValue - 0.6f; // Extend shortened bar towards axis cross fMaxY = baseYValue; // bar has the height of almost whole window height if (fRatio < 1.0f) { diff --git a/src/Gui/SoFCColorGradient.cpp b/src/Gui/SoFCColorGradient.cpp index ae36f585b4..f6aef42012 100644 --- a/src/Gui/SoFCColorGradient.cpp +++ b/src/Gui/SoFCColorGradient.cpp @@ -28,6 +28,7 @@ # include # include # include +# include # include # include # include @@ -35,6 +36,7 @@ # include #endif +#include #include "SoFCColorGradient.h" #include "SoTextLabel.h" #include "DlgSettingsColorGradientImp.h" @@ -99,19 +101,27 @@ void SoFCColorGradient::setMarkerLabel(const SoMFString& label) SbVec2f minPt = _bbox.getMin(); float fStep = (maxPt[1] - minPt[1]) / ((float)num - 1); auto trans = new SoTransform; + + ParameterGrp::handle hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("View"); + auto LabelTextSize = hGrp->GetInt("CbLabelTextSize", 13); + auto LabelTextColor = + App::Color((uint32_t)hGrp->GetUnsigned("CbLabelColor", 0xffffffff)); + auto textFont = new SoFont; + auto color = new SoBaseColor; + textFont->name.setValue("Helvetica,Arial,Times New Roman"); + textFont->size.setValue(LabelTextSize); trans->translation.setValue(maxPt[0] + 0.1f, maxPt[1] - 0.05f + fStep, 0.0f); + color->rgb.setValue(LabelTextColor.r,LabelTextColor.g,LabelTextColor.b); labels->addChild(trans); + labels->addChild(color); + labels->addChild(textFont); for (int i = 0; i < num; i++) { auto trans = new SoTransform; - auto color = new SoBaseColor; auto text2 = new SoColorBarLabel; - trans->translation.setValue(0, -fStep, 0); - color->rgb.setValue(0, 0, 0); text2->string.setValue(label[i]); labels->addChild(trans); - labels->addChild(color); labels->addChild(text2); } }