From 23c6090f0f77b6cd8b47e80e69974519e22f4ecf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 29 Feb 2008 21:37:22 +0000 Subject: r18220@shi: ted | 2008-02-29 13:18:55 -0800 Okay, sadly I'm not keeping the version history because I'm not convenced that SVK will do it right. One mega-patch, but that's life. Reshuffle the exection-env and prefdialog code so that the state machines aren't intertwines, which fixes a whole host of bugs with them. I think the behavior is correct now. Make it so that the effects can count how many preferences they have to determine if the dialog should be shown (fix above). Once this code was written it was easy to make it show an ellipsis on the verb if there is a dialog or not. This involved removing ellipsis from those effects that had it hard coded. Make it so that the parameters know that their command line options are going into a list. They don't have to acknowledge it, but they can, and specifically notebook does and handles it differently. This should fix the notebooks on Win32, but doesn't apparently completely. Change the script extension on windows to use pythonw instead of python so that the command line doesn't appear all the time. (bzr r4908) --- src/extension/parameter.cpp | 48 +++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'src/extension/parameter.cpp') diff --git a/src/extension/parameter.cpp b/src/extension/parameter.cpp index 0db8d0199..9a7535a25 100644 --- a/src/extension/parameter.cpp +++ b/src/extension/parameter.cpp @@ -74,12 +74,12 @@ public: ParamEnum(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamEnum(void); /** \brief Returns \c _value, with a \i const to protect it. */ - const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _current_choice != NULL ? _current_choice->_value : NULL; } + const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _current_choice != NULL ? _current_choice->_value : NULL; } const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); Glib::ustring * string (void); }; /* class ParamEnum */ - + /** \return None \brief This function creates a parameter that can be used later. This @@ -169,7 +169,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * bool Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamBool * boolpntr = dynamic_cast(this); + ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) throw Extension::param_not_bool_param(); return boolpntr->get(doc, node); @@ -179,7 +179,7 @@ Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) int Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamInt * intpntr = dynamic_cast(this); + ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) throw Extension::param_not_int_param(); return intpntr->get(doc, node); @@ -189,7 +189,7 @@ Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) float Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamFloat * floatpntr = dynamic_cast(this); + ParamFloat * floatpntr = dynamic_cast(this); if (floatpntr == NULL) throw Extension::param_not_float_param(); return floatpntr->get(doc, node); @@ -238,7 +238,7 @@ Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) int Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) { - ParamInt * intpntr = dynamic_cast(this); + ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) throw Extension::param_not_int_param(); return intpntr->set(in, doc, node); @@ -259,7 +259,7 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) const gchar * Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { - ParamString * stringpntr = dynamic_cast(this); + ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) throw Extension::param_not_string_param(); return stringpntr->set(in, doc, node); @@ -357,24 +357,42 @@ Parameter::document_param_node (SPDocument * doc) /** \brief Basically, if there is no widget pass a NULL. */ Gtk::Widget * -Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +Parameter::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { return NULL; } /** \brief If I'm not sure which it is, just don't return a value. */ -Glib::ustring * -Parameter::string (void) +void +Parameter::string (std::string &string) { - Glib::ustring * mystring = new Glib::ustring(""); - return mystring; + return; +} + +void +Parameter::string (std::list &list) +{ + std::string value; + string(value); + if (value == "") { + return; + } + + std::string final; + final += "--"; + final += name(); + final += "="; + final += value; + + list.insert(list.end(), final); + return; } -ParamEnum::ParamEnum (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * /*xml*/) : +ParamEnum::ParamEnum (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, guitext, desc, scope, ext), _current_choice(NULL) { return; @@ -395,13 +413,13 @@ ParamEnum::string (void) } Gtk::Widget * -ParamEnum::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +ParamEnum::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { return NULL; } const gchar * -ParamEnum::set (const gchar * /*in*/, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamEnum::set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { return NULL; } -- cgit v1.2.3