diff options
| author | Michael Soegtrop <MSoegtrop@yahoo.de> | 2017-06-05 13:01:17 +0000 |
|---|---|---|
| committer | Michael Soegtrop <MSoegtrop@yahoo.de> | 2017-06-05 13:01:17 +0000 |
| commit | e7248b2fa042f42a5c4dd14cd86ab6a5b4524059 (patch) | |
| tree | 9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/extension/param/radiobutton.cpp | |
| parent | updated to latest trunk (diff) | |
| parent | [Bug #1695016] Xaml export misses some radialGradients. (diff) | |
| download | inkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.tar.gz inkscape-e7248b2fa042f42a5c4dd14cd86ab6a5b4524059.zip | |
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/extension/param/radiobutton.cpp')
| -rw-r--r-- | src/extension/param/radiobutton.cpp | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 1d1b860c6..a08ba6860 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -41,33 +41,34 @@ 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 optionentry { public: - optionentry (Glib::ustring * val, Glib::ustring * text) { + optionentry (Glib::ustring * val, Glib::ustring * txt) { value = val; - guitext = text; + text = txt; } ~optionentry() { delete value; - delete guitext; + delete text; } Glib::ustring * value; - Glib::ustring * guitext; + Glib::ustring * text; }; -ParamRadioButton::ParamRadioButton (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, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(0), _mode(mode), _indent(0), choices(0) +ParamRadioButton::ParamRadioButton(const gchar * name, + const gchar * text, + const gchar * description, + bool hidden, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) + : Parameter(name, text, description, hidden, indent, ext) + , _value(0) + , _mode(mode) + , choices(0) { // Read XML tree to add enumeration items: // printf("Extension Constructor: "); @@ -76,7 +77,7 @@ ParamRadioButton::ParamRadioButton (const gchar * name, while (child_repr != NULL) { char const * chname = child_repr->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - Glib::ustring * newguitext = NULL; + Glib::ustring * newtext = NULL; Glib::ustring * newvalue = NULL; const char * contents = child_repr->firstChild()->content(); @@ -84,12 +85,12 @@ ParamRadioButton::ParamRadioButton (const gchar * name, // don't translate when 'item' but do translate when '_option' if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { if (child_repr->attribute("msgctxt") != NULL) { - newguitext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); + newtext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); } else { - newguitext = new Glib::ustring(_(contents)); + newtext = new Glib::ustring(_(contents)); } } else { - newguitext = new Glib::ustring(contents); + newtext = new Glib::ustring(contents); } } else { continue; @@ -103,8 +104,8 @@ ParamRadioButton::ParamRadioButton (const gchar * name, newvalue = new Glib::ustring(contents); } - if ( (newguitext) && (newvalue) ) { // logical error if this is not true here - choices = g_slist_append( choices, new optionentry(newvalue, newguitext) ); + if ( (newtext) && (newvalue) ) { // logical error if this is not true here + choices = g_slist_append( choices, new optionentry(newvalue, newtext) ); } } child_repr = child_repr->next(); @@ -118,11 +119,6 @@ ParamRadioButton::ParamRadioButton (const gchar * name, defaultval = (static_cast<optionentry*> (choices->data))->value->c_str(); } - const char *indent = xml ? xml->attribute("indent") : NULL; - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name); @@ -284,7 +280,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { optionentry * entr = reinterpret_cast<optionentry *>(list->data); - if ( !entr->guitext->compare(label) ) { + if ( !entr->text->compare(label) ) { value = *(entr->value); break; } @@ -299,23 +295,18 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) */ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } -#if WITH_GTKMM_3_0 - Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); - Gtk::Box * vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); + auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); -#else - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0)); -#endif Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, false, false, _indent); + hbox->pack_start(*label, false, false); Gtk::ComboBoxText* cbt = 0; bool comboSet = false; @@ -330,7 +321,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node Gtk::RadioButtonGroup group; for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { optionentry * entr = reinterpret_cast<optionentry *>(list->data); - Glib::ustring * text = entr->guitext; + Glib::ustring * text = entr->text; switch ( _mode ) { case MINIMAL: { |
