summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00fe0ba)
raw | patch | inline | side by side (parent: 00fe0ba)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 3 Jul 2007 03:48:19 +0000 (03:48 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 3 Jul 2007 03:48:19 +0000 (03:48 +0000) |
Removing some dead code.
src/extension/implementation/plugin-link.h | [deleted file] | patch | blob | history |
src/extension/implementation/plugin.cpp | [deleted file] | patch | blob | history |
src/extension/implementation/plugin.h | [deleted file] | patch | blob | history |
diff --git a/src/extension/implementation/plugin-link.h b/src/extension/implementation/plugin-link.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/** \file
- * Plugin prototypes.
- *
- * This header describes which prototypes plugins should use when
- * creating their functions. This header is also used by the internal
- * plugins code to guarantee consistency.
- *
- * Author: Ted Gould <ted@gould.cx>
- * Copyright (c) 2004-2005
- *
- * This code is licensed under the GNU GPL. See COPYING for details.
- */
-
-#ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_LINK_H__
-#define __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_LINK_H__
-
-#include <gtk/gtkdialog.h>
-#include <gtkmm/widget.h>
-
-/** \todo This needs to go away eventually. */
-#include "document.h"
-
-/** \brief A simple typedef to make it so that inkscape_extension can
- be used before I figure out what makes sense here */
-typedef void inkscape_extension;
-/** \brief The C prototype of a load function. */
-typedef int (*inkscape_plugin_load)(inkscape_extension * in_ext);
-/** \brief The C prototype of an unload function. */
-typedef void (*inkscape_plugin_unload)(inkscape_extension * in_ext);
-/** \brief The C prototype of an open function. */
-typedef SPDocument *(*inkscape_plugin_open)(inkscape_extension * in_ext, const gchar * filename);
-/** \brief The C prototype of an input prefs function. */
-typedef Gtk::Widget * (*inkscape_plugin_prefs_input)(inkscape_extension * in_ext, gchar const * filename);
-/** \brief The C prototype of an effect function. */
-typedef void (*inkscape_plugin_effect)(inkscape_extension * in_ext, Inkscape::UI::View::View * view);
-/** \brief The C prototype of an effect prefs function. */
-typedef Gtk::Widget * (*inkscape_plugin_prefs_effect)(inkscape_extension * in_ext, Inkscape::UI::View::View * view);
-
-/** \brief The name of the symbol for the plugin. Should match
- \c INKSCAPE_PLUGIN_NAME_STR (minus the quotes). */
-#define INKSCAPE_PLUGIN_NAME inkscape_plugin_table
-/** \brief The name of the table to define the plugin as a string. This
- should be the same as \c INKSCAPE_PLUGIN_NAME but with quotes. */
-#define INKSCAPE_PLUGIN_NAME_STR "inkscape_plugin_table"
-/** \brief The version of the plugin interface that is being used. This
- should always be used in the version entry in the \c inkscape_plugin_function_table
- version entry. This way compiled plugins can be detected. */
-#define INKSCAPE_PLUGIN_VERSION 0
-
-/** \brief A structure containing all the functions that should be called
- to make the plugin work. */
-typedef struct {
- int version; /**< The interface version used. Should
- always be \c INKSCAPE_PLUGIN_VERSION. */
- inkscape_plugin_load load; /**< Load function, called on first use */
- inkscape_plugin_unload unload; /**< Unload function, called when Inkscape is
- finished with the plugin */
- inkscape_plugin_open open; /**< Open function, called to open a file
- for Inkscape */
- inkscape_plugin_prefs_input prefs_input; /**< Input preferences function, called to get
- further parameters for an input plugin. */
- inkscape_plugin_effect effect; /**< Effect function, called to cause an effect
- on a document. */
- inkscape_plugin_prefs_effect prefs_effect;/**< Effect preferences, on call could cause settings
- on a document. */
-} inkscape_plugin_function_table;
-
-#endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_LINK_H__ */
diff --git a/src/extension/implementation/plugin.cpp b/src/extension/implementation/plugin.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/** \file
- * The implementation of pluggable objects into Inkscape.
- *
- * Author: Ted Gould <ted@gould.cx>
- * Copyright (c) 2004-2005
- *
- * This code is licensed under the GNU GPL. See COPYING for details.
- *
- * This file implements loadable modules for Inkscape.
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdio.h>
-
-#include <glibmm/module.h>
-#include <glibmm/fileutils.h>
-#include <path-prefix.h>
-#include "extension/extension.h"
-#include "xml/repr.h"
-#include "plugin.h"
-#include "plugin-link.h"
-
-namespace Inkscape {
-namespace Extension {
-namespace Implementation {
-
-/** \brief Create an object by nulling everything out. */
-Plugin::Plugin(void)
-{
- _module = NULL;
- _symTable = NULL;
-
- return;
-}
-
-/**
- \brief Oh, so someone actually wants to use this plugin! We better
- go and grab it then!
- \param module Unused except to pass to the plugin's load function.
- \return Whether the load was successful. Hopefully always TRUE.
-
- Okay, first things first, are modules supported on this platform? That
- is a good first check. Also, is this plugin already loaded? If so
- don't reload it.
-
- If all those are true we need to figure out the filename that needs
- to be loaded. This involves going through the definition of the plugin
- for the \c name field. It is then run though the \c build_path function
- to add the .so or .dll on the end. The path that is used is the
- \c INKSCAPE_PLUGINDIR.
-
- The module is then loaded into RAM by Glib. I'm sure there is lots
- of magic involved here -- but we don't have to worry about it, we
- just check to make sure it worked.
-
- After it is loaded into memory the function lookup table is grabbed
- and then the load function for the plugin is called.
-*/
-bool
-Plugin::load(Inkscape::Extension::Extension *module)
-{
- if (!Glib::Module::get_supported()) {
- return FALSE;
- }
-
- if (module->loaded()) {
- return TRUE;
- }
-
- Inkscape::XML::Node * child_repr = sp_repr_children(module->get_repr());
- const gchar * name = NULL;
- while (child_repr != NULL) {
- if (!strcmp(child_repr->name(), "plugin")) {
- child_repr = sp_repr_children(child_repr);
- while (child_repr != NULL) {
- if (!strcmp(child_repr->name(), "name")) {
- name = sp_repr_children(child_repr)->content();
- }
- child_repr = sp_repr_next(child_repr);
- }
- }
- child_repr = sp_repr_next(child_repr);
- }
-
- if (name == NULL) {
- return FALSE;
- }
-
- std::string path = Glib::Module::build_path(INKSCAPE_PLUGINDIR, name);
- // std::cout << "Load path: " << path << std::endl;
- _module = new Glib::Module(path);
-
- if (!(bool)_module || _module == NULL) {
- printf("Loading failed\n");
- return FALSE;
- }
-
- /* Grab symbols */
- void * voidpntr;
- if (!_module->get_symbol(INKSCAPE_PLUGIN_NAME_STR, voidpntr)) {
- // printf("Error loading library\n");
- // std::cout << "Last error: " << _module->get_last_error() << std::endl;
- return FALSE;
- }
- _symTable = (inkscape_plugin_function_table *)voidpntr;
-
- if (_symTable->version != INKSCAPE_PLUGIN_VERSION) {
- /* Someday this could adapt older versions so that we could
- be compatible -- but not today */
- return FALSE;
- }
-
- if (_symTable->load != NULL) {
- return (bool)_symTable->load((inkscape_extension *)module);
- }
-
- return TRUE;
-}
-
-/**
- \brief No one is interested in this plugin for now. It is removed
- to save memory.
- \param module The module of this implementation, passed to unload.
- \return None.
-
- Call the unload function of the plugin, then delete the symbol table
- and the module itself. Put everything back to NULL.
-*/
-void
-Plugin::unload(Inkscape::Extension::Extension *module)
-{
- _symTable->unload((inkscape_extension *)module);
- _symTable = NULL;
- delete _module;
- _module = NULL;
- return;
-}
-
-/**
- \brief Just check to make sure everything exists. This makes sure
- that the loadable file exits.
- \param module Unused.
- \return The status of the check. TRUE means that it passed.
-
- This function builds the path name out of the XML definition of the
- plugin. It does this by looking for the \c name parameter. It then
- uses \c build_path to add the .so or .dll and adds in the \c INKSCAPE_PLUGINDIR
- to the front of it. Then the \c file_test function is used to make
- sure it exists.
-*/
-bool
-Plugin::check(Inkscape::Extension::Extension *module)
-{
- Inkscape::XML::Node * child_repr = sp_repr_children(module->get_repr());
- const gchar * name = NULL;
- while (child_repr != NULL) {
- if (!strcmp(child_repr->name(), "plugin")) {
- child_repr = sp_repr_children(child_repr);
- while (child_repr != NULL) {
- if (!strcmp(child_repr->name(), "name")) {
- name = sp_repr_children(child_repr)->content();
- }
- child_repr = sp_repr_next(child_repr);
- }
- }
- child_repr = sp_repr_next(child_repr);
- }
-
- if (name == NULL) {
- return FALSE;
- }
-
- std::string path = Glib::Module::build_path(INKSCAPE_PLUGINDIR, name);
- // std::cout << "Path: " << path << std::endl;
- if (!Glib::file_test(path, Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_EXECUTABLE)) {
- // std::cout << "Failed!" << std::endl;
- return FALSE;
- }
-
- // std::cout << "No Problem." << std::endl;
- return TRUE;
-}
-
-Gtk::Widget *
-Plugin::prefs_input(Inkscape::Extension::Input *module, gchar const *filename)
-{
- return Inkscape::Extension::Implementation::Implementation::prefs_input(module, filename);
-}
-
-/*
- \brief Function to call the open in the plugin.
- \param module Passed on
- \param filename Passed on
- \return The document that is opened or NULL for error.
-
- This function looks in the symbol table to see if there is an open
- function. If there is, it is called, otherwise the standard implementation
- function is used instead.
-*/
-SPDocument *
-Plugin::open(Inkscape::Extension::Input *module, gchar const *filename)
-{
- if (_symTable->open != NULL) {
- return _symTable->open((inkscape_extension *)module, filename);
- } else {
- return Inkscape::Extension::Implementation::Implementation::open(module, filename);
- }
-}
-
-Gtk::Widget *
-Plugin::prefs_output(Inkscape::Extension::Output *module)
-{
- return Inkscape::Extension::Implementation::Implementation::prefs_output(module);
-}
-
-void
-Plugin::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename)
-{
- return Inkscape::Extension::Implementation::Implementation::save(module, doc, filename);
-}
-
-Gtk::Widget *
-Plugin::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view)
-{
- if (_symTable->prefs_effect != NULL) {
- return _symTable->prefs_effect((inkscape_extension *)module, view);
- } else {
- return Inkscape::Extension::Implementation::Implementation::prefs_effect(module, view);
- }
-}
-
-void
-Plugin::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document)
-{
- if (_symTable->effect != NULL) {
- return _symTable->effect((inkscape_extension *)module, document);
- } else {
- return Inkscape::Extension::Implementation::Implementation::effect(module, document);
- }
-}
-
-unsigned
-Plugin::setup(Inkscape::Extension::Print *module)
-{
- return Inkscape::Extension::Implementation::Implementation::setup(module);
-}
-
-unsigned
-Plugin::set_preview(Inkscape::Extension::Print *module)
-{
- return Inkscape::Extension::Implementation::Implementation::set_preview(module);
-}
-
-unsigned
-Plugin::begin(Inkscape::Extension::Print *module, SPDocument *doc)
-{
- return Inkscape::Extension::Implementation::Implementation::begin(module, doc);
-}
-
-unsigned
-Plugin::finish(Inkscape::Extension::Print *module)
-{
- return Inkscape::Extension::Implementation::Implementation::finish(module);
-}
-
-bool
-Plugin::textToPath(Inkscape::Extension::Print *ext)
-{
- return Inkscape::Extension::Implementation::Implementation::finish(ext);
-}
-
-unsigned
-Plugin::bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity)
-{
- return Inkscape::Extension::Implementation::Implementation::bind(module, transform, opacity);
-}
-
-unsigned
-Plugin::release(Inkscape::Extension::Print *module)
-{
- return Inkscape::Extension::Implementation::Implementation::release(module);
-}
-
-unsigned
-Plugin::comment(Inkscape::Extension::Print *module, const char * comment)
-{
- return Inkscape::Extension::Implementation::Implementation::comment(module,comment);
-}
-
-unsigned
-Plugin::fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *ctm, SPStyle const *style, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
-{
- return Inkscape::Extension::Implementation::Implementation::fill(module, bpath, ctm, style, pbox, dbox, bbox);
-}
-
-unsigned
-Plugin::stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *transform, SPStyle const *style, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
-{
- return Inkscape::Extension::Implementation::Implementation::stroke(module, bpath, transform, style, pbox, dbox, bbox);
-}
-
-unsigned
-Plugin::image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, NRMatrix const *transform, SPStyle const *style)
-{
- return Inkscape::Extension::Implementation::Implementation::image(module, px, w, h, rs, transform, style);
-}
-
-unsigned
-Plugin::text(Inkscape::Extension::Print *module, char const *text, NR::Point p, SPStyle const *style)
-{
- return Inkscape::Extension::Implementation::Implementation::text(module, text, p, style);
-}
-
-} /* namespace Implementation */
-} /* namespace Extension */
-} /* namespace Inkscape */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/extension/implementation/plugin.h b/src/extension/implementation/plugin.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/** \file
- * Inkscape::Extension::Implementation::Plugin
- *
- * Author: Ted Gould <ted@gould.cx>
- * Copyright (c) 2004-2005
- *
- * This code is licensed under the GNU GPL. See COPYING for details.
- */
-#ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__
-#define __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__
-
-#include <extension/implementation/implementation.h>
-#include <glibmm/module.h>
-#include "plugin-link.h"
-
-namespace Inkscape {
-namespace Extension {
-namespace Implementation {
-
-/** \brief For the most part this is a direct steal from \c implementation.h
- in that all the functions have the same prototypes. The two
- added things are a pointer to the loaded module and a pointer
- to the symbol table in that. */
-class Plugin : public Implementation {
- /** \brief A pointer to the module created when loading the plugin. */
- Glib::Module * _module;
- /** \brief The symbol table that is in the plugin. It is pulled out
- here so that it doesn't have to be grabbed as often. */
- inkscape_plugin_function_table * _symTable;
-
-public:
- Plugin(void);
-
- /* ----- Basic functions for all Extension ----- */
- virtual bool load(Inkscape::Extension::Extension *module);
-
- virtual void unload(Inkscape::Extension::Extension *module);
-
- /** Verify any dependencies. */
- virtual bool check(Inkscape::Extension::Extension *module);
-
-
- /* ----- Input functions ----- */
- /** Find out information about the file. */
- virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
- gchar const *filename);
-
- virtual SPDocument *open(Inkscape::Extension::Input *module,
- gchar const *filename);
-
- /* ----- Output functions ----- */
- /** Find out information about the file. */
- virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
- virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
-
- /* ----- Effect functions ----- */
- /** Find out information about the file. */
- virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view);
- /* TODO: need to figure out what we need here */
-
- virtual void effect(Inkscape::Extension::Effect *module,
- Inkscape::UI::View::View *document);
-
- /* ----- Print functions ----- */
- virtual unsigned setup(Inkscape::Extension::Print *module);
- virtual unsigned set_preview(Inkscape::Extension::Print *module);
-
- virtual unsigned begin(Inkscape::Extension::Print *module,
- SPDocument *doc);
- virtual unsigned finish(Inkscape::Extension::Print *module);
- virtual bool textToPath(Inkscape::Extension::Print *ext);
-
- /* ----- Rendering methods ----- */
- virtual unsigned bind(Inkscape::Extension::Print *module,
- NRMatrix const *transform,
- float opacity);
- virtual unsigned release(Inkscape::Extension::Print *module);
- virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
- virtual unsigned fill(Inkscape::Extension::Print *module,
- NRBPath const *bpath,
- NRMatrix const *ctm,
- SPStyle const *style,
- NRRect const *pbox,
- NRRect const *dbox,
- NRRect const *bbox);
- virtual unsigned stroke(Inkscape::Extension::Print *module,
- NRBPath const *bpath,
- NRMatrix const *transform,
- SPStyle const *style,
- NRRect const *pbox,
- NRRect const *dbox,
- NRRect const *bbox);
- virtual unsigned image(Inkscape::Extension::Print *module,
- unsigned char *px,
- unsigned int w,
- unsigned int h,
- unsigned int rs,
- NRMatrix const *transform,
- SPStyle const *style);
- virtual unsigned text(Inkscape::Extension::Print *module,
- char const *text,
- NR::Point p,
- SPStyle const *style);
-};
-
-} /* namespace Implementation */
-} /* namespace Extension */
-} /* namespace Inkscape */
-
-#endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__ */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :