Skip to content

Commit

Permalink
+ fixes #1393: Allow the user to set desired font size in pixels (use…
Browse files Browse the repository at this point in the history
…d by sketcher constraints) in preferences
  • Loading branch information
wwmayer committed Mar 9, 2014
1 parent 2aaa63c commit b68bb65
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/Mod/Sketcher/Gui/SketcherSettings.cpp
Expand Up @@ -66,6 +66,9 @@ void SketcherSettings::saveSettings()
ui->DefaultSketcherLineWidth->onSave();

ui->CursorTextColor->onSave();

// Sketch editing
ui->EditSketcherFontSize->onSave();
}

void SketcherSettings::loadSettings()
Expand All @@ -86,6 +89,9 @@ void SketcherSettings::loadSettings()
ui->DefaultSketcherLineWidth->onRestore();

ui->CursorTextColor->onRestore();

// Sketch editing
ui->EditSketcherFontSize->onRestore();
}

/**
Expand Down
69 changes: 65 additions & 4 deletions src/Mod/Sketcher/Gui/SketcherSettings.ui
Expand Up @@ -7,14 +7,14 @@
<x>0</x>
<y>0</y>
<width>359</width>
<height>834</height>
<height>544</height>
</rect>
</property>
<property name="windowTitle">
<string>Sketcher</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBoxSketcherColor">
<property name="title">
<string>Sketcher colors</string>
Expand Down Expand Up @@ -439,7 +439,68 @@
</layout>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Sketch editing</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Font size</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="EditSketcherFontSize">
<property name="suffix">
<string>px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>17</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>EditSketcherFontSize</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -2738,6 +2738,9 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
edit->constrGroup->removeAllChildren();
edit->vConstrType.clear();

ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
int fontSize = hGrp->GetInt("EditSketcherFontSize", 17);

for (std::vector<Sketcher::Constraint *>::const_iterator it=constrlist.begin(); it != constrlist.end(); ++it) {
// root separator for one constraint
SoSeparator *sep = new SoSeparator();
Expand Down Expand Up @@ -2772,7 +2775,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
text->norm.setValue(norm);
text->string = "";
text->textColor = ConstrDimColor;
text->size.setValue(17);
text->size.setValue(fontSize);
text->useAntialiasing = false;
SoAnnotation *anno = new SoAnnotation();
anno->renderCaching = SoSeparator::OFF;
Expand Down

0 comments on commit b68bb65

Please sign in to comment.