Skip to content

Commit

Permalink
+ sketcher settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 14, 2014
1 parent 2aa2cb3 commit bea4c44
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 23 deletions.
10 changes: 10 additions & 0 deletions src/Mod/Sketcher/Gui/SketcherSettings.cpp
Expand Up @@ -41,6 +41,14 @@ SketcherSettings::SketcherSettings(QWidget* parent)
ui->setupUi(this);
form = new SketcherGeneralWidget(ui->groupBox);
ui->gridLayout->addWidget(form, 1, 0, 1, 1);

// Don't need them at the moment
ui->label_16->hide();
ui->SketcherDatumWidth->hide();
ui->label_12->hide();
ui->DefaultSketcherVertexWidth->hide();
ui->label_13->hide();
ui->DefaultSketcherLineWidth->hide();
}

/**
Expand All @@ -60,6 +68,7 @@ void SketcherSettings::saveSettings()
ui->EditedEdgeColor->onSave();
ui->EditedVertexColor->onSave();
ui->ConstructionColor->onSave();
ui->ExternalColor->onSave();
ui->FullyConstrainedColor->onSave();

ui->ConstrainedColor->onSave();
Expand All @@ -84,6 +93,7 @@ void SketcherSettings::loadSettings()
ui->EditedEdgeColor->onRestore();
ui->EditedVertexColor->onRestore();
ui->ConstructionColor->onRestore();
ui->ExternalColor->onRestore();
ui->FullyConstrainedColor->onRestore();

ui->ConstrainedColor->onRestore();
Expand Down
71 changes: 52 additions & 19 deletions src/Mod/Sketcher/Gui/SketcherSettings.ui
Expand Up @@ -188,6 +188,39 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_20">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>External geometry</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::PrefColorButton" name="ExternalColor">
<property name="toolTip">
<string>The color of external geometry in edit mode</string>
</property>
<property name="color">
<color>
<red>204</red>
<green>51</green>
<blue>115</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>ExternalColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
Expand All @@ -200,7 +233,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="Gui::PrefColorButton" name="FullyConstrainedColor">
<property name="toolTip">
<string>The color of fully constrained geometry in edit mode</string>
Expand All @@ -220,7 +253,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_14">
<property name="minimumSize">
<size>
Expand All @@ -233,27 +266,27 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="Gui::PrefColorButton" name="ConstrainedColor">
<property name="toolTip">
<string>The color of fully constrained geometry in edit mode</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>255</green>
<red>255</red>
<green>38</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>ConstrainedColor</cstring>
<cstring>ConstrainedIcoColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_15">
<property name="minimumSize">
<size>
Expand All @@ -266,27 +299,27 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="Gui::PrefColorButton" name="DatumColor">
<property name="toolTip">
<string>The color of fully constrained geometry in edit mode</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>255</green>
<red>255</red>
<green>38</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>DatumColor</cstring>
<cstring>ConstrainedDimColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
Expand All @@ -299,7 +332,7 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="Gui::PrefSpinBox" name="SketcherDatumWidth">
<property name="toolTip">
<string>The default line thickness for new shapes</string>
Expand All @@ -321,7 +354,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
Expand All @@ -334,7 +367,7 @@
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="Gui::PrefSpinBox" name="DefaultSketcherVertexWidth">
<property name="toolTip">
<string>The default line thickness for new shapes</string>
Expand All @@ -356,7 +389,7 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label_13">
<property name="minimumSize">
<size>
Expand All @@ -369,7 +402,7 @@
</property>
</widget>
</item>
<item row="10" column="1">
<item row="11" column="1">
<widget class="Gui::PrefSpinBox" name="DefaultSketcherLineWidth">
<property name="toolTip">
<string>The default line thickness for new shapes</string>
Expand All @@ -391,7 +424,7 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
Expand All @@ -404,7 +437,7 @@
</property>
</widget>
</item>
<item row="11" column="1">
<item row="12" column="1">
<widget class="Gui::PrefColorButton" name="CursorTextColor">
<property name="color">
<color>
Expand Down
33 changes: 29 additions & 4 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -242,6 +242,23 @@ ViewProviderSketch::ViewProviderSketch()
xInit=0;
yInit=0;
relative=false;

unsigned long color;
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");

// edge color
App::Color edgeColor = LineColor.getValue();
color = (unsigned long)(edgeColor.getPackedValue());
color = hGrp->GetUnsigned("SketchEdgeColor", color);
edgeColor.setPackedValue((uint32_t)color);
LineColor.setValue(edgeColor);

// vertex color
App::Color vertexColor = PointColor.getValue();
color = (unsigned long)(vertexColor.getPackedValue());
color = hGrp->GetUnsigned("SketchVertexColor", color);
vertexColor.setPackedValue((uint32_t)color);
PointColor.setValue(vertexColor);
}

ViewProviderSketch::~ViewProviderSketch()
Expand Down Expand Up @@ -2972,10 +2989,18 @@ bool ViewProviderSketch::setEdit(int ModNum)
color = (unsigned long)(FullyConstrainedColor.getPackedValue());
color = hGrp->GetUnsigned("FullyConstrainedColor", color);
FullyConstrainedColor.setPackedValue((uint32_t)color, transparency);
// constraints dimensions, icons and external geometry colors are hard coded
// ConstrDimColor;
// ConstrIcoColor;
// CurveExternalColor;
// set the constraint dimension color
color = (unsigned long)(ConstrDimColor.getPackedValue());
color = hGrp->GetUnsigned("ConstrainedDimColor", color);
ConstrDimColor.setPackedValue((uint32_t)color, transparency);
// set the constraint color
color = (unsigned long)(ConstrIcoColor.getPackedValue());
color = hGrp->GetUnsigned("ConstrainedIcoColor", color);
ConstrIcoColor.setPackedValue((uint32_t)color, transparency);
// set the external geometry color
color = (unsigned long)(CurveExternalColor.getPackedValue());
color = hGrp->GetUnsigned("ExternalColor", color);
CurveExternalColor.setPackedValue((uint32_t)color, transparency);

// set the highlight color
unsigned long highlight = (unsigned long)(PreselectColor.getPackedValue());
Expand Down

0 comments on commit bea4c44

Please sign in to comment.