summaryrefslogtreecommitdiffstats
path: root/src/extension/param/description.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-04-09 14:46:33 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-04-09 14:46:33 +0000
commitbc1ecf9dd11d0b3bb6939114ce6aec229fc86548 (patch)
treeb28ae5ea0ca1186320745ea5653aeaba06e61e6c /src/extension/param/description.cpp
parentRemove unused field "scope" (diff)
downloadinkscape-bc1ecf9dd11d0b3bb6939114ce6aec229fc86548.tar.gz
inkscape-bc1ecf9dd11d0b3bb6939114ce6aec229fc86548.zip
Some code refactoring for consistency
(notably "gui_hidden" -> hidden", "guitext" -> "text", "desc" -> "description") (bzr r15633.1.3)
Diffstat (limited to 'src/extension/param/description.cpp')
-rw-r--r--src/extension/param/description.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp
index 48e95aa2a..1b3f64ec6 100644
--- a/src/extension/param/description.cpp
+++ b/src/extension/param/description.cpp
@@ -29,14 +29,14 @@ namespace Extension {
/** \brief Initialize the object, to do that, copy the data. */
ParamDescription::ParamDescription(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- bool gui_hidden,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode)
- : Parameter(name, guitext, desc, gui_hidden, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(NULL)
, _mode(mode)
, _preserve_whitespace(false)
@@ -69,44 +69,44 @@ ParamDescription::ParamDescription(const gchar * name,
Gtk::Widget *
ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
if (_value == NULL) {
return NULL;
}
- Glib::ustring newguitext = _value;
+ Glib::ustring newtext = _value;
// do replacements in the source string matching those performed by xgettext to allow for proper translation
if (_preserve_whitespace) {
// xgettext copies the source string verbatim in this case, so no changes needed
} else {
// remove all whitespace from start/end of string and replace intermediate whitespace with a single space
- newguitext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newguitext, 0, "", (Glib::RegexMatchFlags)0);
- newguitext = Glib::Regex::create("\\s+")->replace_literal(newguitext, 0, " ", (Glib::RegexMatchFlags)0);
+ newtext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newtext, 0, "", (Glib::RegexMatchFlags)0);
+ newtext = Glib::Regex::create("\\s+")->replace_literal(newtext, 0, " ", (Glib::RegexMatchFlags)0);
}
// translate
if (_context != NULL) {
- newguitext = g_dpgettext2(NULL, _context, newguitext.c_str());
+ newtext = g_dpgettext2(NULL, _context, newtext.c_str());
} else {
- newguitext = _(newguitext.c_str());
+ newtext = _(newtext.c_str());
}
// finally replace all remaining <br/> with a real newline character
- newguitext = Glib::Regex::create("<br/>")->replace_literal(newguitext, 0, "\n", (Glib::RegexMatchFlags)0);
+ newtext = Glib::Regex::create("<br/>")->replace_literal(newtext, 0, "\n", (Glib::RegexMatchFlags)0);
Gtk::Label * label = Gtk::manage(new Gtk::Label());
if (_mode == HEADER) {
- label->set_markup(Glib::ustring("<b>") + Glib::Markup::escape_text(newguitext) + Glib::ustring("</b>"));
+ label->set_markup(Glib::ustring("<b>") + Glib::Markup::escape_text(newtext) + Glib::ustring("</b>"));
label->set_margin_top(5);
label->set_margin_bottom(5);
} else if (_mode == URL) {
- Glib::ustring escaped_url = Glib::Markup::escape_text(newguitext);
+ Glib::ustring escaped_url = Glib::Markup::escape_text(newtext);
label->set_markup(Glib::ustring::compose("<a href='%1'>%1</a>", escaped_url));
} else {
- label->set_text(newguitext);
+ label->set_text(newtext);
}
label->set_line_wrap();
#if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16)
@@ -123,7 +123,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node
// - Here we set a lower limit of GUI_MAX_LINE_LENGTH characters per line that long texts will always use
// This means texts can not shrink anymore (they can still grow, though) and it's also necessary
// to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572
- int len = newguitext.length();
+ int len = newtext.length();
label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len);
label->show();