Added preferences setting for default App::Annotation color

This commit is contained in:
Yorik van Havre 2015-08-13 23:12:00 -03:00
parent c733370cee
commit 62c0a19071
3 changed files with 62 additions and 3 deletions

View File

@ -49,7 +49,9 @@
#include "ViewProviderAnnotation.h"
#include <App/Annotation.h>
#include <App/PropertyGeo.h>
#include <App/Application.h>
#include <App/PropertyStandard.h>
#include <Base/Parameter.h>
#include <Gui/BitmapFactory.h>
#include "SoFCSelection.h"
#include "SoTextLabel.h"
@ -66,7 +68,11 @@ PROPERTY_SOURCE(Gui::ViewProviderAnnotation, Gui::ViewProviderDocumentObject)
ViewProviderAnnotation::ViewProviderAnnotation()
{
ADD_PROPERTY(TextColor,(1.0f,1.0f,1.0f));
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
unsigned long col = hGrp->GetUnsigned("AnnotationTextColor",4294967295UL); // light grey
float r,g,b;
r = ((col >> 24) & 0xff) / 255.0; g = ((col >> 16) & 0xff) / 255.0; b = ((col >> 8) & 0xff) / 255.0;
ADD_PROPERTY(TextColor,(r,g,b));
ADD_PROPERTY(Justification,((long)0));
Justification.setEnums(JustificationEnums);
ADD_PROPERTY(FontSize,(12));

View File

@ -60,6 +60,8 @@ void DlgSettingsObjectColor::saveSettings()
DefaultShapeVertexColor->onSave();
DefaultShapeVertexWidth->onSave();
BoundingBoxColor->onSave();
// Annotations
AnnotationTextColor->onSave();
}
void DlgSettingsObjectColor::loadSettings()
@ -71,6 +73,8 @@ void DlgSettingsObjectColor::loadSettings()
DefaultShapeVertexColor->onRestore();
DefaultShapeVertexWidth->onRestore();
BoundingBoxColor->onRestore();
// Annotations
AnnotationTextColor->onRestore();
}
/**

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>359</width>
<height>282</height>
<width>332</width>
<height>331</height>
</rect>
</property>
<property name="windowTitle">
@ -242,6 +242,55 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Annotations</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Default text color</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefColorButton" name="AnnotationTextColor">
<property name="prefEntry" stdset="0">
<cstring>AnnotationTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">