summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 093ae61)
raw | patch | inline | side by side (parent: 093ae61)
author | mfloryan <mfloryan@users.sourceforge.net> | |
Tue, 15 Apr 2008 16:17:21 +0000 (16:17 +0000) | ||
committer | mfloryan <mfloryan@users.sourceforge.net> | |
Tue, 15 Apr 2008 16:17:21 +0000 (16:17 +0000) |
index c50b128119d343d3c7cb0b8041666b5c21542b66..3e6ebb91a11f09399b81aca512eb182ea4a15176 100644 (file)
<dependency type="executable" location="extensions">coloreffect.py</dependency>
<dependency type="executable" location="extensions">color_replace.py</dependency>
<dependency type="executable" location="extensions">simplestyle.py</dependency>
- <param name="from_color" type="string" _gui-text="Replace color (RRGGBB hex):">000000</param>
- <param name="to_color" type="string" _gui-text="By color (RRGGBB hex):">000000</param>
+ <param name="from_color" type="string" max_length="6" _gui-text="Replace color (RRGGBB hex):">000000</param>
+ <param name="to_color" type="string" max_length="6" _gui-text="By color (RRGGBB hex):">000000</param>
<effect>
<object-type>all</object-type>
<effects-menu>
index 118a67d58912f1dbbdf994014992e7e00e09c328..c52d7595785bb665086106616de30466ba9ea689 100644 (file)
def colmod(self,r,g,b):
this_color = '%02x%02x%02x' % (r, g, b)
- fr = self.options.from_color.strip('"').replace('#', '')
- to = self.options.to_color.strip('"').replace('#', '')
+ fr = self.options.from_color.strip('"').replace('#', '').lower()
+ to = self.options.to_color.strip('"').replace('#', '').lower()
#inkex.debug(this_color+"|"+fr+"|"+to)
if this_color == fr:
index 7e071e7e39040d70e040200118f843d0a07729c1..b356c297e9c3a75696fbb617024ca097b1e8daf6 100644 (file)
@@ -128,6 +128,11 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "string")) {
param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ const gchar * max_length = in_repr->attribute("max_length");
+ if (max_length != NULL) {
+ ParamString * ps = dynamic_cast<ParamString *>(param);
+ ps->setMaxLength(atoi(max_length));
+ }
} else if (!strcmp(type, "description")) {
param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "enum")) {
index 36c3ce115c2f3e5d5f2ad2952fcb20220aecbe11..3dd2a23282bfd66c04612a6f90272ffda0de7f02 100644 (file)
@@ -84,11 +84,13 @@ ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar
defaultval = paramval;
if (defaultval != NULL)
_value = g_strdup(defaultval);
+
+ _max_length = 0;
return;
}
-/** \brief A special category of Gtk::Entry to handle string parameteres */
+/** \brief A special type of Gtk::Entry to handle string parameteres */
class ParamStringEntry : public Gtk::Entry {
private:
ParamString * _pref;
Gtk::Entry(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) {
if (_pref->get(NULL, NULL) != NULL)
this->set_text(Glib::ustring(_pref->get(NULL, NULL)));
+ this->set_max_length(_pref->getMaxLength()); //Set the max lenght - default zero means no maximum
this->signal_changed().connect(sigc::mem_fun(this, &ParamStringEntry::changed_text));
};
void changed_text (void);
index 0a1a0f2a31a09f8b50384b41bf8e2291c0aeb1e6..10f45e5acd20a1cf5692163b6170f32fef5a3693 100644 (file)
/** \brief Internal value. This should point to a string that has
been allocated in memory. And should be free'd. */
gchar * _value;
+ /** \brief Internal value. This indicates the maximum leght of the string. Zero meaning unlimited.
+ */
+ gint _max_length;
public:
ParamString(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);
virtual ~ParamString(void);
const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void string (std::string &string);
+ void setMaxLength(int maxLenght) { _max_length = maxLenght; }
+ int getMaxLength(void) { return _max_length; }
};