X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fextension%2Fextension.h;h=936d2a907e44ae7777e53ba8bf624b49d0da843c;hb=8a2e76b7021b9b960d7c30801a1a14461d9b5939;hp=b4e7304521d80af2686f127591587ec9b7de899b;hpb=8bc547b01926fa6f998028afe7298d32e65d48da;p=inkscape.git diff --git a/src/extension/extension.h b/src/extension/extension.h index b4e730452..936d2a907 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include "xml/repr.h" #include "extension/extension-forward.h" @@ -40,6 +42,11 @@ /** Defines the key for Postscript printing */ #define SP_MODULE_KEY_PRINT_PS "org.inkscape.print.ps" +#define SP_MODULE_KEY_PRINT_CAIRO_PS "org.inkscape.print.ps.cairo" +#define SP_MODULE_KEY_PRINT_CAIRO_EPS "org.inkscape.print.eps.cairo" +/** Defines the key for PDF printing */ +#define SP_MODULE_KEY_PRINT_PDF "org.inkscape.print.pdf" +#define SP_MODULE_KEY_PRINT_CAIRO_PDF "org.inkscape.print.pdf.cairo" /** Defines the key for LaTeX printing */ #define SP_MODULE_KEY_PRINT_LATEX "org.inkscape.print.latex" /** Defines the key for printing with GNOME Print */ @@ -50,14 +57,9 @@ /** Defines the default printing to use */ #define SP_MODULE_KEY_PRINT_DEFAULT SP_MODULE_KEY_PRINT_WIN32 #else -#ifdef WITH_GNOME_PRINT -/** Defines the default printing to use */ -#define SP_MODULE_KEY_PRINT_DEFAULT SP_MODULE_KEY_PRINT_GNOME -#else /** Defines the default printing to use */ #define SP_MODULE_KEY_PRINT_DEFAULT SP_MODULE_KEY_PRINT_PS #endif -#endif /** Mime type for SVG */ #define MIME_SVG "image/svg+xml" @@ -65,6 +67,13 @@ /** Name of the extension error file */ #define EXTENSION_ERROR_LOG_FILENAME "extension-errors.log" + +#define INKSCAPE_EXTENSION_URI "http://www.inkscape.org/namespace/inkscape/extension" +#define INKSCAPE_EXTENSION_NS_NC "extension" +#define INKSCAPE_EXTENSION_NS "extension:" + +struct SPDocument; + namespace Inkscape { namespace Extension { @@ -90,9 +99,10 @@ private: 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 */ + bool _gui; protected: - Inkscape::XML::Node *repr; /**< The XML description of the Extension */ + Inkscape::XML::Node *repr; /**< The XML description of the Extension */ Implementation::Implementation * imp; /**< An object that holds all the functions for making this work */ ExpirationTimer * timer; /**< Timeout to unload after a given time */ @@ -113,7 +123,7 @@ public: void deactivate (void); bool deactivated (void); void printFailure (Glib::ustring reason); - + Implementation::Implementation * get_imp (void) { return imp; }; /* Parameter Stuff */ private: @@ -121,45 +131,105 @@ private: This only gets created if there are parameters in this extension */ +public: + /** \brief A function to get the the number of parameters that + the extension has. + \return The number of parameters. */ + unsigned int param_count ( ) { return parameters == NULL ? 0 : + g_slist_length(parameters); }; + /** \brief A function to get the the number of parameters that + are visible to the user that the extension has. + \return The number of visible parameters. + + \note Currently this just calls param_count as visible isn't implemented + but in the future it'll do something different. Please call + the appropriate function in code so that it'll work in the + future. + */ + unsigned int param_visible_count ( ); + public: /** An error class for when a parameter is called on a type it is not */ class param_wrong_type {}; - - /** An error class for when a parameter is looked for that just + class param_not_color_param {}; + class param_not_enum_param {}; + class param_not_optiongroup_param {}; + class param_not_string_param {}; + class param_not_float_param {}; + class param_not_int_param {}; + class param_not_bool_param {}; + + /** An error class for when a parameter is looked for that just * simply doesn't exist */ class param_not_exist {}; - - /** An error class for when a filename already exists, but the user + + /** An error class for when a filename already exists, but the user * doesn't want to overwrite it */ class no_overwrite {}; private: void make_param (Inkscape::XML::Node * paramrepr); -#if 0 - inline param_t * param_shared (const gchar * name, - GSList * list); -#endif + + Parameter * get_param (const gchar * name); + public: bool get_param_bool (const gchar * name, - const Inkscape::XML::Document * doc = NULL); + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + int get_param_int (const gchar * name, - const Inkscape::XML::Document * doc = NULL); + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + float get_param_float (const gchar * name, - const Inkscape::XML::Document * doc = NULL); + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + const gchar * get_param_string (const gchar * name, - const Inkscape::XML::Document * doc = NULL); + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + + guint32 get_param_color (const gchar * name, + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + + const gchar * get_param_enum (const gchar * name, + const SPDocument * doc = NULL, + const Inkscape::XML::Node * node = NULL); + + gchar const *get_param_optiongroup( gchar const * name, + SPDocument const * doc = 0, + Inkscape::XML::Node const * node = 0); + bool set_param_bool (const gchar * name, bool value, - Inkscape::XML::Document * doc = NULL); + SPDocument * doc = NULL, + Inkscape::XML::Node * node = NULL); + int set_param_int (const gchar * name, int value, - Inkscape::XML::Document * doc = NULL); + SPDocument * doc = NULL, + Inkscape::XML::Node * node = NULL); + float set_param_float (const gchar * name, float value, - Inkscape::XML::Document * doc = NULL); + SPDocument * doc = NULL, + Inkscape::XML::Node * node = NULL); + const gchar * set_param_string (const gchar * name, const gchar * value, - Inkscape::XML::Document * doc = NULL); + SPDocument * doc = NULL, + Inkscape::XML::Node * node = NULL); + + gchar const * set_param_optiongroup(gchar const * name, + gchar const * value, + SPDocument * doc = 0, + Inkscape::XML::Node * node = 0); + + guint32 set_param_color (const gchar * name, + guint32 color, + SPDocument * doc = NULL, + Inkscape::XML::Node * node = NULL); /* Error file handling */ public: @@ -167,8 +237,18 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (void); - Glib::ustring * paramString (void); + Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal = NULL); + void paramListString (std::list & retlist); + void set_gui(bool s) { _gui = s; } + + /* Extension editor dialog stuff */ +public: + Gtk::VBox * get_info_widget(void); + Gtk::VBox * get_help_widget(void); + Gtk::VBox * get_params_widget(void); +protected: + inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row); + };