summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-03-29 05:38:37 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-03-29 05:38:37 +0000
commit6823dea398d034bce1a5ad849b08a2fe77737a3a (patch)
tree50fc794019b7215bf2b9edce7e53317e55cb4548
parentr10920@tres: ted | 2006-02-13 09:38:31 -0800 (diff)
downloadinkscape-6823dea398d034bce1a5ad849b08a2fe77737a3a.tar.gz
inkscape-6823dea398d034bce1a5ad849b08a2fe77737a3a.zip
r10921@tres: ted | 2006-02-13 09:40:25 -0800
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. (bzr r334)
-rw-r--r--src/extension/effect.cpp2
-rw-r--r--src/extension/extension.cpp5
-rw-r--r--src/extension/extension.h3
-rw-r--r--src/extension/input.cpp2
-rw-r--r--src/extension/output.cpp2
-rw-r--r--src/extension/prefdialog.cpp8
-rw-r--r--src/extension/prefdialog.h7
7 files changed, 20 insertions, 9 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 8c7fad2c9..55cf42b2f 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -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();
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 42b220576..62f590be3 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -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);
diff --git a/src/extension/extension.h b/src/extension/extension.h
index a0c991cf2..b4e730452 100644
--- a/src/extension/extension.h
+++ b/src/extension/extension.h
@@ -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);
diff --git a/src/extension/input.cpp b/src/extension/input.cpp
index 081cc4fb2..68eb31e7b 100644
--- a/src/extension/input.cpp
+++ b/src/extension/input.cpp
@@ -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();
diff --git a/src/extension/output.cpp b/src/extension/output.cpp
index 5f740bbff..eb3f85ed8 100644
--- a/src/extension/output.cpp
+++ b/src/extension/output.cpp
@@ -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();
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 40eb037b6..86f1a50be 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -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
*/
@@ -17,11 +17,13 @@
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);
diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h
index 02b3b6a49..4324bedfd 100644
--- a/src/extension/prefdialog.h
+++ b/src/extension/prefdialog.h
@@ -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);
};