From 8bc547b01926fa6f998028afe7298d32e65d48da Mon Sep 17 00:00:00 2001 From: gouldtj Date: Wed, 29 Mar 2006 05:38:37 +0000 Subject: [PATCH] r10921@tres: ted | 2006-02-13 09:40:25 -0800 Adding in support for a 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 | 2 +- src/extension/extension.cpp | 5 ++++- src/extension/extension.h | 3 +++ src/extension/input.cpp | 2 +- src/extension/output.cpp | 2 +- src/extension/prefdialog.cpp | 8 +++++--- src/extension/prefdialog.h | 7 +++++-- 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 _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 * - * 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); }; -- 2.30.2