summaryrefslogtreecommitdiffstats
path: root/src/extension/param/float.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2011-08-06 18:48:21 +0000
committerJazzyNico <nicoduf@yahoo.fr>2011-08-06 18:48:21 +0000
commitec8d0b742153e4715efd13fb19607c3167cc2092 (patch)
treed26d7c4e09e293481d9cf5af322b4178f6deb605 /src/extension/param/float.cpp
parentPatch from Yu-Jie Lin for bug 820863 to add the option to disable libwpg (diff)
downloadinkscape-ec8d0b742153e4715efd13fb19607c3167cc2092.tar.gz
inkscape-ec8d0b742153e4715efd13fb19607c3167cc2092.zip
Extensions. New "indent" attribute to add an indent level to extension elements.
Filters. Adding the new "indent" attribute to parameters groups. (bzr r10529)
Diffstat (limited to 'src/extension/param/float.cpp')
-rw-r--r--src/extension/param/float.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp
index 4ef816d61..ea6a70855 100644
--- a/src/extension/param/float.cpp
+++ b/src/extension/param/float.cpp
@@ -34,27 +34,31 @@ ParamFloat::ParamFloat (const gchar * name,
Inkscape::XML::Node * xml,
AppearanceMode mode) :
Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext),
- _value(0.0), _mode(mode), _min(0.0), _max(10.0)
+ _value(0.0), _mode(mode), _indent(0), _min(0.0), _max(10.0)
{
const gchar * defaultval = NULL;
- if (sp_repr_children(xml) != NULL)
+ if (sp_repr_children(xml) != NULL) {
defaultval = sp_repr_children(xml)->content();
+ }
if (defaultval != NULL) {
_value = g_ascii_strtod (defaultval,NULL);
}
const char * maxval = xml->attribute("max");
- if (maxval != NULL)
+ if (maxval != NULL) {
_max = g_ascii_strtod (maxval,NULL);
+ }
const char * minval = xml->attribute("min");
- if (minval != NULL)
+ if (minval != NULL) {
_min = g_ascii_strtod (minval,NULL);
+ }
_precision = 1;
const char * precision = xml->attribute("precision");
- if (precision != NULL)
+ if (precision != NULL) {
_precision = atoi(precision);
+ }
/* We're handling this by just killing both values */
if (_max < _min) {
@@ -62,6 +66,11 @@ ParamFloat::ParamFloat (const gchar * name,
_min = 0.0;
}
+ const char * indent = xml->attribute("indent");
+ if (indent != NULL) {
+ _indent = atoi(indent) * 12;
+ }
+
gchar * pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_value = prefs->getDouble(extension_pref_root + pref_name, _value);
@@ -69,8 +78,12 @@ ParamFloat::ParamFloat (const gchar * name,
// std::cout << "New Float:: value: " << _value << " max: " << _max << " min: " << _min << std::endl;
- if (_value > _max) _value = _max;
- if (_value < _min) _value = _min;
+ if (_value > _max) {
+ _value = _max;
+ }
+ if (_value < _min) {
+ _value = _min;
+ }
return;
}
@@ -88,8 +101,12 @@ float
ParamFloat::set (float in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/)
{
_value = in;
- if (_value > _max) _value = _max;
- if (_value < _min) _value = _min;
+ if (_value > _max) {
+ _value = _max;
+ }
+ if (_value < _min) {
+ _value = _min;
+ }
gchar * prefname = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -154,13 +171,15 @@ ParamFloatAdjustment::val_changed (void)
Gtk::Widget *
ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) return NULL;
+ if (_gui_hidden) {
+ return NULL;
+ }
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
label->show();
- hbox->pack_start(*label, true, true);
+ hbox->pack_start(*label, true, true, _indent);
ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal));