0001032: Preference setting for bounding box colour

This commit is contained in:
Yorik van Havre 2013-06-27 20:42:30 -03:00
parent ea08d136f8
commit b2c635e40c
3 changed files with 36 additions and 2 deletions

View File

@ -71,6 +71,7 @@ void DlgSettingsViewColor::saveSettings()
EditedVertexColor->onSave();
ConstructionColor->onSave();
FullyConstrainedColor->onSave();
BoundingBoxColor->onSave();
DefaultShapeColor->onSave();
DefaultShapeLineColor->onSave();
DefaultShapeLineWidth->onSave();
@ -94,6 +95,7 @@ void DlgSettingsViewColor::loadSettings()
EditedVertexColor->onRestore();
ConstructionColor->onRestore();
FullyConstrainedColor->onRestore();
BoundingBoxColor->onRestore();
DefaultShapeColor->onRestore();
DefaultShapeLineColor->onRestore();
DefaultShapeLineWidth->onRestore();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>601</width>
<height>565</height>
<height>598</height>
</rect>
</property>
<property name="windowTitle">
@ -520,6 +520,33 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Bounding box color</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::PrefColorButton" name="BoundingBoxColor">
<property name="toolTip">
<string>The color of bounding boxes in the 3D view</string>
</property>
<property name="color">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BoundingBoxColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
@ -660,6 +687,7 @@
<tabstop>EditedVertexColor</tabstop>
<tabstop>ConstructionColor</tabstop>
<tabstop>FullyConstrainedColor</tabstop>
<tabstop>BoundingBoxColor</tabstop>
<tabstop>radioButtonSimple</tabstop>
<tabstop>SelectionColor_Background</tabstop>
<tabstop>radioButtonGradient</tabstop>

View File

@ -482,13 +482,17 @@ SoPickedPoint* ViewProviderGeometryObject::getPickedPoint(const SbVec2s& pos, co
void ViewProviderGeometryObject::showBoundingBox(bool show)
{
if (!pcBoundSwitch && show) {
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
unsigned long bbcol = hGrp->GetUnsigned("BoundingBoxColor",4294967295UL); // white (255,255,255)
float r,g,b;
r = ((bbcol >> 24) & 0xff) / 255.0; g = ((bbcol >> 16) & 0xff) / 255.0; b = ((bbcol >> 8) & 0xff) / 255.0;
pcBoundSwitch = new SoSwitch();
SoSeparator* pBoundingSep = new SoSeparator();
SoDrawStyle* lineStyle = new SoDrawStyle;
lineStyle->lineWidth = 2.0f;
pBoundingSep->addChild(lineStyle);
SoBaseColor* color = new SoBaseColor();
color->rgb.setValue(1.0f, 1.0f, 1.0f);
color->rgb.setValue(r, g, b);
pBoundingSep->addChild(color);
pBoundingSep->addChild(new SoTransform());