Code

r10921@tres: ted | 2006-02-13 09:40:25 -0800
authorgouldtj <gouldtj@users.sourceforge.net>
Wed, 29 Mar 2006 05:38:37 +0000 (05:38 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Wed, 29 Mar 2006 05:38:37 +0000 (05:38 +0000)
 Adding in support for a <help> tag in the base extension part of the INX
 file.  Currently that just gets passed to the prefdialog, but it will be
 used in a little while.

src/extension/effect.cpp
src/extension/extension.cpp
src/extension/extension.h
src/extension/input.cpp
src/extension/output.cpp
src/extension/prefdialog.cpp
src/extension/prefdialog.h

index 8c7fad2c9fd0c5ea5b66847033b74d27f7fb245c..55cf42b2f13ee6ff963d813587707fd966f4315d 100644 (file)
@@ -189,7 +189,7 @@ Effect::prefs (Inkscape::UI::View::View * doc)
         return true;
     }
 
-    PrefDialog * dialog = new PrefDialog(this->get_name(), controls);
+    PrefDialog * dialog = new PrefDialog(this->get_name(), this->get_help(), controls);
     int response = dialog->run();
     dialog->hide();
 
index 42b2205764ac527054698f319891c13110adce48..62f590be327d6119379ec3936002e9d763c21397 100644 (file)
@@ -53,7 +53,7 @@ Parameter * param_shared (const gchar * name, GSList * list);
     not related to the module directly.  If the Repr does not include
     a name and an ID the module will be left in an errored state.
 */
-Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
+Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : _help(NULL)
 {
     repr = in_repr;
     Inkscape::GC::anchor(in_repr);
@@ -84,6 +84,9 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat
             if (!strcmp(chname, "name")) {
                 name = g_strdup (sp_repr_children(child_repr)->content());
             } /* name */
+            if (!strcmp(chname, "help")) {
+                _help = g_strdup (sp_repr_children(child_repr)->content());
+            } /* name */
             if (!strcmp(chname, "param")) {
                                Parameter * param;
                                param = Parameter::make(child_repr, this);
index a0c991cf25cceeffb57ce0e21fe3f5d8443196f4..b4e7304521d80af2686f127591587ec9b7de899b 100644 (file)
@@ -86,6 +86,7 @@ public:
 private:
     gchar     *id;                        /**< The unique identifier for the Extension */
     gchar     *name;                      /**< A user friendly name for the Extension */
+    gchar     *_help;                     /**< A string that contains a help text for the user */
     state_t    _state;                    /**< Which state the Extension is currently in */
     std::vector<Dependency *>  _deps;     /**< Dependencies for this extension */
     static std::ofstream error_file;      /**< This is the place where errors get reported */
@@ -107,6 +108,8 @@ public:
     Inkscape::XML::Node *      get_repr     (void);
     gchar *       get_id       (void);
     gchar *       get_name     (void);
+    /** \brief  Gets the help string for this extension */
+    gchar const * get_help     (void) { return _help; }
     void          deactivate   (void);
     bool          deactivated  (void);
     void          printFailure (Glib::ustring reason);
index 081cc4fb29a1ae524e0f30d53844a12472667f64..68eb31e7bb0acfc0f6cd9d1cb851a9dd7c7d6492 100644 (file)
@@ -237,7 +237,7 @@ Input::prefs (const gchar *uri)
         return true;
     }
 
-    PrefDialog * dialog = new PrefDialog(this->get_name(), controls);
+    PrefDialog * dialog = new PrefDialog(this->get_name(), this->get_help(), controls);
     int response = dialog->run();
     dialog->hide();
 
index 5f740bbff0727e14a99e6c2937cc4cd37553620e..eb3f85ed8a60708adba492176e4b6765c8815079 100644 (file)
@@ -182,7 +182,7 @@ Output::prefs (void)
         return true;
     }
 
-    PrefDialog * dialog = new PrefDialog(this->get_name(), controls);
+    PrefDialog * dialog = new PrefDialog(this->get_name(), this->get_help(), controls);
     int response = dialog->run();
     dialog->hide();
 
index 40eb037b6712e8d87c2c616770f2d705e4a3fe89..86f1a50bed8518a9a4187a53589cecc3e448a813 100644 (file)
@@ -2,7 +2,7 @@
  * Authors:
  *   Ted Gould <ted@gould.cx>
  *
- * Copyright (C) 2005 Authors
+ * Copyright (C) 2005-2006 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 namespace Inkscape {
 namespace Extension {
 
-PrefDialog::PrefDialog (Glib::ustring name, Gtk::Widget * controls) :
-    Gtk::Dialog::Dialog(name + _(" Preferences"), true, true)
+PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls) :
+    Gtk::Dialog::Dialog(name + _(" Preferences"), true, true), _help(help), _name(name)
 {
     this->get_vbox()->pack_start(*controls, true, true, 5);
 
+    if (_help != NULL)
+        add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
     add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
 
     Gtk::Button * ok = add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
index 02b3b6a49bf4e86c9ca089f9087e1a1e38e7f399..4324bedfdaffd677f1ca71e74383dc583ff208b1 100644 (file)
@@ -21,10 +21,13 @@ namespace Inkscape {
 namespace Extension {
 
 class PrefDialog : public Gtk::Dialog {
-    Gtk::Socket * _socket;
+    /** \brief  Help string if it exists */
+    gchar const * _help;
+    /** \brief  Name of the extension */
+    Glib::ustring _name;
 
 public:
-    PrefDialog (Glib::ustring name, Gtk::Widget * controls);
+    PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls);
 };