summaryrefslogtreecommitdiffstats
path: root/src/extension/param/enum.cpp
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commit509ca3687330fea576ea67ae6c7f31d16e66b800 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/extension/param/enum.cpp
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.tar.gz
inkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/extension/param/enum.cpp')
-rw-r--r--src/extension/param/enum.cpp60
1 files changed, 29 insertions, 31 deletions
diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp
index 4e7420807..7cd860465 100644
--- a/src/extension/param/enum.cpp
+++ b/src/extension/param/enum.cpp
@@ -33,25 +33,28 @@ namespace Inkscape {
namespace Extension {
/* For internal use only.
- Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
+ Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
class enumentry {
public:
enumentry (Glib::ustring &val, Glib::ustring &text) :
value(val),
- guitext(text)
+ text(text)
{}
Glib::ustring value;
- Glib::ustring guitext;
+ Glib::ustring text;
};
-ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gchar *desc,
- const Parameter::_scope_t scope, bool gui_hidden, const gchar *gui_tip,
- Inkscape::Extension::Extension *ext, Inkscape::XML::Node *xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
+ParamComboBox::ParamComboBox(const gchar * name,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(NULL)
- , _indent(0)
, choices(NULL)
{
const char *xmlval = NULL; // the value stored in XML
@@ -61,7 +64,7 @@ ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gcha
for (Inkscape::XML::Node *node = xml->firstChild(); node; node = node->next()) {
char const * chname = node->name();
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) {
- Glib::ustring newguitext, newvalue;
+ Glib::ustring newtext, newvalue;
const char * contents = NULL;
if (node->firstChild()) {
contents = node->firstChild()->content();
@@ -72,12 +75,12 @@ ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gcha
// still need to include if are to be localized
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) {
if (node->attribute("msgctxt") != NULL) {
- newguitext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents);
+ newtext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents);
} else {
- newguitext = _(contents);
+ newtext = _(contents);
}
} else {
- newguitext = contents;
+ newtext = contents;
}
} else
continue;
@@ -89,22 +92,17 @@ ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gcha
newvalue = contents;
}
- if ( (!newguitext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here
- choices = g_slist_append( choices, new enumentry(newvalue, newguitext) );
+ if ( (!newtext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here
+ choices = g_slist_append( choices, new enumentry(newvalue, newtext) );
}
}
}
-
+
// Initialize _value with the default value from xml
// for simplicity : default to the contents of the first xml-child
if (xml->firstChild() && xml->firstChild()->firstChild()) {
xmlval = xml->firstChild()->attribute("value");
}
-
- const char *indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
}
gchar * pref_name = this->pref_name();
@@ -155,7 +153,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape
Glib::ustring settext;
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- if ( !entr->guitext.compare(in) ) {
+ if ( !entr->text.compare(in) ) {
settext = entr->value;
break; // break out of for loop
}
@@ -175,20 +173,20 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape
}
/**
- * function to test if \c guitext is selectable
+ * function to test if \c text is selectable
*/
-bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const
+bool ParamComboBox::contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const
{
- if (guitext == NULL) {
+ if (text == NULL) {
return false; /* Can't have NULL string */
}
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- if ( !entr->guitext.compare(guitext) )
+ if ( !entr->text.compare(text) )
return true;
}
- // if we did not find the guitext in this ParamComboBox:
+ // if we did not find the text in this ParamComboBox:
return false;
}
@@ -246,25 +244,25 @@ ParamComboBoxEntry::changed (void)
*/
Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, false, false, _indent);
+ hbox->pack_start(*label, false, false);
ParamComboBoxEntry * combo = Gtk::manage(new ParamComboBoxEntry(this, doc, node, changeSignal));
// add choice strings:
Glib::ustring settext;
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- Glib::ustring text = entr->guitext;
+ Glib::ustring text = entr->text;
combo->append(text);
if ( _value && !entr->value.compare(_value) ) {
- settext = entr->guitext;
+ settext = entr->text;
}
}
if (!settext.empty()) {