summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2016-04-16 17:59:33 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2016-04-16 17:59:33 +0000
commitccdbf0118747b5046937e85258e0f1d266634c90 (patch)
tree65207b810613f23d5ea11f330f7fe02e32e55b70 /src
parentCXX flags dedup on CMake builds (diff)
parentremoved unnecessary comments (diff)
downloadinkscape-ccdbf0118747b5046937e85258e0f1d266634c90.tar.gz
inkscape-ccdbf0118747b5046937e85258e0f1d266634c90.zip
merge Moritz's branch
(bzr r14855)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt31
-rw-r--r--src/extension/CMakeLists.txt4
-rw-r--r--src/extension/Makefile_insert2
-rw-r--r--src/extension/dependency.cpp12
-rw-r--r--src/extension/dependency.h1
-rw-r--r--src/extension/loader.cpp137
-rw-r--r--src/extension/loader.h73
-rw-r--r--src/extension/plugins/CMakeLists.txt1
-rw-r--r--src/extension/plugins/grid2/CMakeLists.txt8
-rw-r--r--src/extension/plugins/grid2/grid.cpp220
-rw-r--r--src/extension/plugins/grid2/grid.h58
-rw-r--r--src/extension/plugins/grid2/libgrid2.inx20
-rw-r--r--src/extension/system.cpp15
-rw-r--r--src/io/inkjar.h8
14 files changed, 563 insertions, 27 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e97ea8489..e44eb757d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -506,14 +506,14 @@ set(inkscape_SRC
#add_inkscape_lib(sp_LIB "${sp_SRC}")
#add_inkscape_lib(inkscape_LIB "${inkscape_SRC}")
-# Build everything except main and inkview.c in a CMake "object" library.
-# An object library is just a bunch of .o files. Linking them with main.c or inkview.c
-# we get the inkscape and inkview executables respectively.
-add_library(inkscape_base OBJECT ${inkscape_SRC} ${sp_SRC})
+# Build everything except main and inkview.c in a shared library.
+add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC})
# make executables for inkscape and inkview
-add_executable(inkscape ${main_SRC} $<TARGET_OBJECTS:inkscape_base>)
-add_executable(inkview inkview.cpp $<TARGET_OBJECTS:inkscape_base>)
+add_executable(inkscape ${main_SRC} )
+add_executable(inkview inkview.cpp )
+
+
if(UNIX)
# message after building.
@@ -530,10 +530,6 @@ if(WITH_DBUS)
add_dependencies(inkscape inkscape_dbus)
endif()
-if (NOT "${WITH_EXT_GDL}")
- list (APPEND INKSCAPE_LIBS "gdl_LIB")
-endif()
-
set(INKSCAPE_TARGET_LIBS
# order from automake
#sp_LIB
@@ -556,5 +552,16 @@ set(INKSCAPE_TARGET_LIBS
${INKSCAPE_LIBS}
)
-target_link_libraries(inkscape ${INKSCAPE_TARGET_LIBS})
-target_link_libraries(inkview ${INKSCAPE_TARGET_LIBS})
+if (NOT "${WITH_EXT_GDL}")
+ # Insert it at the beginning of the list as the windows build fails otherwise
+ list (INSERT INKSCAPE_TARGET_LIBS 0 "gdl_LIB")
+endif()
+
+
+# Link the inkscape_base library against all external dependencies
+target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
+
+# Link inkscape and inkview against inkscape_base
+target_link_libraries(inkscape inkscape_base )
+target_link_libraries(inkview inkscape_base)
+
diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt
index 86a192f47..a5352d0ba 100644
--- a/src/extension/CMakeLists.txt
+++ b/src/extension/CMakeLists.txt
@@ -14,6 +14,7 @@ set(extension_SRC
print.cpp
system.cpp
timer.cpp
+ loader.cpp
implementation/implementation.cpp
implementation/xslt.cpp
@@ -90,6 +91,7 @@ set(extension_SRC
print.h
system.h
timer.h
+ loader.h
implementation/implementation.h
implementation/script.h
@@ -249,3 +251,5 @@ endif()
# add_inkscape_lib(extension_LIB "${extension_SRC}")
add_inkscape_source("${extension_SRC}")
+
+add_subdirectory( plugins )
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert
index 4e75de13a..fb9713904 100644
--- a/src/extension/Makefile_insert
+++ b/src/extension/Makefile_insert
@@ -13,6 +13,8 @@ ink_common_sources += \
extension/execution-env.h \
extension/init.cpp \
extension/init.h \
+ extension/loader.h \
+ extension/loader.cpp \
extension/param/parameter.h \
extension/param/parameter.cpp \
extension/param/notebook.h \
diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp
index e46b6fbd2..624be12f9 100644
--- a/src/extension/dependency.cpp
+++ b/src/extension/dependency.cpp
@@ -235,6 +235,18 @@ bool Dependency::check (void) const
}
/**
+ \brief Accessor to the name attribute.
+ \return A string containing the name of the dependency.
+
+ Returns the name of the dependency as found in the configuration file.
+
+*/
+const gchar* Dependency::get_name()
+{
+ return _string;
+}
+
+/**
\brief Print out a dependency to a string.
*/
std::ostream &
diff --git a/src/extension/dependency.h b/src/extension/dependency.h
index 829912dc3..8f5dcc0c8 100644
--- a/src/extension/dependency.h
+++ b/src/extension/dependency.h
@@ -58,6 +58,7 @@ public:
Dependency (Inkscape::XML::Node * in_repr);
virtual ~Dependency (void);
bool check (void) const;
+ const gchar* get_name();
Glib::ustring &get_help (void) const;
Glib::ustring &get_link (void) const;
diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp
new file mode 100644
index 000000000..32ac4b3b4
--- /dev/null
+++ b/src/extension/loader.cpp
@@ -0,0 +1,137 @@
+/*
+ * Loader for external plug-ins.
+ *
+ * Authors:
+ * Moritz Eberl <moritz@semiodesk.com>
+ *
+ * Copyright (C) 2016 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "loader.h"
+#include "system.h"
+#include <exception>
+#include <string.h>
+#include "dependency.h"
+#include "inkscape-version.h"
+
+namespace Inkscape {
+namespace Extension {
+
+typedef Implementation::Implementation *(*_getImplementation)(void);
+typedef const gchar *(*_getInkscapeVersion)(void);
+
+bool Loader::load_dependency(Dependency *dep)
+{
+ GModule *module = NULL;
+ module = g_module_open(dep->get_name(), (GModuleFlags)0);
+ if (module == NULL) {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * @brief Load the actual implementation of a plugin supplied by the plugin.
+ * @param doc The xml representation of the INX extension configuration.
+ * @return The implementation of the extension loaded from the plugin.
+ */
+Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Document *doc)
+{
+ try {
+
+ Inkscape::XML::Node *repr = doc->root();
+ Inkscape::XML::Node *child_repr = repr->firstChild();
+
+ // Iterate over the xml content
+ while (child_repr != NULL) {
+ char const *chname = child_repr->name();
+ if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) {
+ chname += strlen(INKSCAPE_EXTENSION_NS);
+ }
+
+ // Deal with dependencies if we have them
+ if (!strcmp(chname, "dependency")) {
+ Dependency dep = Dependency(child_repr);
+ // try to load it
+ bool success = load_dependency(&dep);
+ if( !success ){
+ // Could not load dependency, we abort
+ const char *res = g_module_error();
+ g_warning("Unable to load dependency %s of plugin %s.\nDetails: %s\n", dep.get_name(), res);
+ return NULL;
+ }
+ }
+
+ // Found a plugin to load
+ if (!strcmp(chname, "plugin")) {
+
+ // The name of the plugin is actually the library file we want to load
+ if (const gchar *name = child_repr->attribute("name")) {
+ GModule *module = NULL;
+ _getImplementation GetImplementation = NULL;
+ _getInkscapeVersion GetInkscapeVersion = NULL;
+
+ // build the path where to look for the plugin
+ gchar *path = g_build_filename(_baseDirectory, name, (char *) NULL);
+ module = g_module_open(path, G_MODULE_BIND_LOCAL);
+ g_free(path);
+
+ if (module == NULL) {
+ // we were not able to load the plugin, write warning and abort
+ const char *res = g_module_error();
+ g_warning("Unable to load extension %s.\nDetails: %s\n", name, res);
+ return NULL;
+ }
+
+ // Get a handle to the version function of the module
+ if (g_module_symbol(module, "GetInkscapeVersion", (gpointer *) &GetInkscapeVersion) == FALSE) {
+ // This didn't work, write warning and abort
+ const char *res = g_module_error();
+ g_warning("Unable to load extension %s.\nDetails: %s\n", name, res);
+ return NULL;
+ }
+
+ // Get a handle to the function that delivers the implementation
+ if (g_module_symbol(module, "GetImplementation", (gpointer *) &GetImplementation) == FALSE) {
+ // This didn't work, write warning and abort
+ const char *res = g_module_error();
+ g_warning("Unable to load extension %s.\nDetails: %s\n", name, res);
+ return NULL;
+ }
+
+ // Get version and test against this version
+ const gchar* version = GetInkscapeVersion();
+ if( strcmp(version, version_string) != 0) {
+ // The versions are different, display warning.
+ g_warning("Plugin was built against Inkscape version %s, this is %s. The plugin might not be compatible.", version, version_string);
+ }
+
+
+ Implementation::Implementation *i = GetImplementation();
+ return i;
+ }
+ }
+
+ child_repr = child_repr->next();
+ }
+ } catch (std::exception &e) {
+ g_warning("Unable to load extension.");
+ }
+ return NULL;
+}
+
+} // 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:fileencoding=utf-8:textwidth=99: \ No newline at end of file
diff --git a/src/extension/loader.h b/src/extension/loader.h
new file mode 100644
index 000000000..5d48bf861
--- /dev/null
+++ b/src/extension/loader.h
@@ -0,0 +1,73 @@
+/** @file
+ * Loader for external plug-ins.
+ *//*
+ *
+ * Authors:
+ * Moritz Eberl <moritz@semiodesk.com>
+ *
+ * Copyright (C) 2016 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef INKSCAPE_EXTENSION_LOADER_H_
+#define INKSCAPE_EXTENSION_LOADER_H_
+
+#include "extension.h"
+#include "implementation/implementation.h"
+#include <gmodule.h>
+
+
+namespace Inkscape {
+namespace Extension {
+
+/** This class contains the mechanism to load c++ plugins dynamically.
+*/
+class Loader {
+
+public:
+ /**
+ * Sets a base directory where to look for the actual plugin to load.
+ *
+ * @param dir is the path where the plugin should be loaded from.
+ */
+ void set_base_directory(const gchar *dir) {
+ _baseDirectory = dir;
+ }
+
+ /**
+ * Loads plugin dependencies which are needed for the plugin to load.
+ *
+ * @param dep
+ */
+ bool load_dependency(Dependency *dep);
+
+ /**
+ * Load the actual implementation of a plugin supplied by the plugin.
+ *
+ * @param doc The xml representation of the INX extension configuration.
+ * @return The implementation of the extension loaded from the plugin.
+ */
+ Implementation::Implementation *load_implementation(Inkscape::XML::Document *doc);
+
+private:
+ const gchar *_baseDirectory; /**< The base directory to load a plugin from */
+
+
+};
+
+} // namespace Extension
+} // namespace Inkscape */
+
+#endif // _LOADER_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:fileencoding=utf-8:textwidth=99: \ No newline at end of file
diff --git a/src/extension/plugins/CMakeLists.txt b/src/extension/plugins/CMakeLists.txt
new file mode 100644
index 000000000..78f268c6b
--- /dev/null
+++ b/src/extension/plugins/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(grid2)
diff --git a/src/extension/plugins/grid2/CMakeLists.txt b/src/extension/plugins/grid2/CMakeLists.txt
new file mode 100644
index 000000000..f39e259de
--- /dev/null
+++ b/src/extension/plugins/grid2/CMakeLists.txt
@@ -0,0 +1,8 @@
+set(grid_PART_SRCS grid.cpp)
+
+include_directories( ${CMAKE_BINARY_DIR}/src )
+
+add_library(grid2 SHARED ${grid_PART_SRCS})
+
+target_link_libraries(grid2 inkscape_base)
+
diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp
new file mode 100644
index 000000000..3a2ed7867
--- /dev/null
+++ b/src/extension/plugins/grid2/grid.cpp
@@ -0,0 +1,220 @@
+/**
+ \file grid.cpp
+
+ A plug-in to add a grid creation effect into Inkscape.
+*/
+/*
+ * Copyright (C) 2004-2005 Ted Gould <ted@gould.cx>
+ * Copyright (C) 2007 MenTaLguY <mental@rydia.net>
+ * Abhishek Sharma
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtkmm/box.h>
+#include <gtkmm/adjustment.h>
+#include <gtkmm/spinbutton.h>
+
+#include "desktop.h"
+
+#include "document.h"
+#include "selection.h"
+#include "sp-object.h"
+#include "2geom/geom.h"
+
+#include "svg/path-string.h"
+
+#include "extension/effect.h"
+#include "extension/system.h"
+
+#include "util/units.h"
+
+#include "grid.h"
+
+namespace Inkscape {
+namespace Extension {
+namespace Internal {
+
+/**
+ \brief A function to allocated anything -- just an example here
+ \param module Unused
+ \return Whether the load was sucessful
+*/
+bool
+Grid::load (Inkscape::Extension::Extension */*module*/)
+{
+ // std::cout << "Hey, I'm Grid, I'm loading!" << std::endl;
+ return TRUE;
+}
+
+namespace {
+
+Glib::ustring build_lines(Geom::Rect bounding_area,
+ Geom::Point const &offset, Geom::Point const &spacing)
+{
+
+ std::cout << "Building lines" << std::endl;
+
+ Geom::Point point_offset(0.0, 0.0);
+
+ SVG::PathString path_data;
+
+ for ( int axis = Geom::X ; axis <= Geom::Y ; ++axis ) {
+ point_offset[axis] = offset[axis];
+
+ for (Geom::Point start_point = bounding_area.min();
+ start_point[axis] + offset[axis] <= (bounding_area.max())[axis];
+ start_point[axis] += spacing[axis]) {
+ Geom::Point end_point = start_point;
+ end_point[1-axis] = (bounding_area.max())[1-axis];
+
+ path_data.moveTo(start_point + point_offset)
+ .lineTo(end_point + point_offset);
+ }
+ }
+ std::cout << "Path data:" << path_data.c_str() << std::endl;
+ return path_data;
+}
+
+} // namespace
+
+/**
+ \brief This actually draws the grid.
+ \param module The effect that was called (unused)
+ \param document What should be edited.
+*/
+void
+Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
+{
+
+ std::cout << "Executing effect" << std::endl;
+
+ Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
+
+ Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100));
+ if (selection->isEmpty()) {
+ /* get page size */
+ SPDocument * doc = document->doc();
+ bounding_area = Geom::Rect( Geom::Point(0,0),
+ Geom::Point(doc->getWidth().value("px"), doc->getHeight().value("px")) );
+ } else {
+ Geom::OptRect bounds = selection->visualBounds();
+ if (bounds) {
+ bounding_area = *bounds;
+ }
+
+ gdouble doc_height = (document->doc())->getHeight().value("px");
+ Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
+ Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
+
+ bounding_area = temprec;
+ }
+
+ gdouble scale = Inkscape::Util::Quantity::convert(1, "px", &document->doc()->getSVGUnit());
+ bounding_area *= Geom::Scale(scale);
+ Geom::Point spacings( scale * module->get_param_float("xspacing"),
+ scale * module->get_param_float("yspacing") );
+ gdouble line_width = scale * module->get_param_float("lineWidth");
+ Geom::Point offsets( scale * module->get_param_float("xoffset"),
+ scale * module->get_param_float("yoffset") );
+
+ Glib::ustring path_data("");
+
+ path_data = build_lines(bounding_area, offsets, spacings);
+ Inkscape::XML::Document * xml_doc = document->doc()->getReprDoc();
+
+ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->getRepr();
+ Inkscape::XML::Node * path = xml_doc->createElement("svg:path");
+
+ path->setAttribute("d", path_data.c_str());
+
+ Glib::ustring style("fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000");
+ style += ";stroke-width:";
+ gchar floatstring[64];
+ std::ostringstream stringstream;
+ stringstream << line_width;
+ sprintf(floatstring, "%s", stringstream.str().c_str());
+ style += floatstring;
+ style += "pt";
+ path->setAttribute("style", style.c_str());
+
+ current_layer->appendChild(path);
+ Inkscape::GC::release(path);
+}
+
+/** \brief A class to make an adjustment that uses Extension params */
+class PrefAdjustment : public Gtk::Adjustment {
+ /** Extension that this relates to */
+ Inkscape::Extension::Extension * _ext;
+ /** The string which represents the parameter */
+ char * _pref;
+public:
+ /** \brief Make the adjustment using an extension and the string
+ describing the parameter. */
+ PrefAdjustment(Inkscape::Extension::Extension * ext, char * pref) :
+ Gtk::Adjustment(0.0, 0.0, 10.0, 0.1), _ext(ext), _pref(pref) {
+ this->set_value(_ext->get_param_float(_pref));
+ this->signal_value_changed().connect(sigc::mem_fun(this, &PrefAdjustment::val_changed));
+ return;
+ };
+
+ void val_changed (void);
+}; /* class PrefAdjustment */
+
+/** \brief A function to respond to the value_changed signal from the
+ adjustment.
+
+ This function just grabs the value from the adjustment and writes
+ it to the parameter. Very simple, but yet beautiful.
+*/
+void
+PrefAdjustment::val_changed (void)
+{
+ // std::cout << "Value Changed to: " << this->get_value() << std::endl;
+ _ext->set_param_float(_pref, this->get_value());
+ return;
+}
+
+/** \brief A function to get the prefences for the grid
+ \param moudule Module which holds the params
+ \param view Unused today - may get style information in the future.
+
+ Uses AutoGUI for creating the GUI.
+*/
+Gtk::Widget *
+Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
+{
+ SPDocument * current_document = view->doc();
+
+ std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList();
+ Inkscape::XML::Node * first_select = NULL;
+ if (!selected.empty()) {
+ first_select = selected[0]->getRepr();
+ }
+
+ return module->autogui(current_document, first_select, changeSignal);
+}
+
+
+
+
+}; /* namespace Internal */
+}; /* 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/plugins/grid2/grid.h b/src/extension/plugins/grid2/grid.h
new file mode 100644
index 000000000..b4997bb18
--- /dev/null
+++ b/src/extension/plugins/grid2/grid.h
@@ -0,0 +1,58 @@
+/*
+ * Authors:
+ * Ted Gould <ted@gould.cx>
+ *
+ * Copyright (C) 2004-2005 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef __GRID_H
+
+#include "extension/implementation/implementation.h"
+
+
+#include <glib.h>
+#include <gmodule.h>
+#include "inkscape-version.cpp"
+
+
+
+namespace Inkscape {
+namespace Extension {
+
+class Effect;
+class Extension;
+
+namespace Internal {
+
+/** \brief Implementation class of the GIMP gradient plugin. This mostly
+ just creates a namespace for the GIMP gradient plugin today.
+*/
+class Grid : public Inkscape::Extension::Implementation::Implementation {
+
+public:
+ bool load(Inkscape::Extension::Extension *module);
+ void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
+ Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
+
+};
+
+}; /* namespace Internal */
+}; /* namespace Extension */
+}; /* namespace Inkscape */
+
+extern "C" G_MODULE_EXPORT Inkscape::Extension::Implementation::Implementation* GetImplementation() { return new Inkscape::Extension::Internal::Grid(); }
+extern "C" G_MODULE_EXPORT const gchar* GetInkscapeVersion() { return Inkscape::version_string; }
+#endif
+
+/*
+ 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/plugins/grid2/libgrid2.inx b/src/extension/plugins/grid2/libgrid2.inx
new file mode 100644
index 000000000..0360d37e3
--- /dev/null
+++ b/src/extension/plugins/grid2/libgrid2.inx
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+<_name>Grid2</_name>
+<id>org.inkscape.effect.grid2</id>
+<param name="lineWidth" _gui-text="Line Width:" type="float">1.0</param>
+<param name="xspacing" _gui-text="Horizontal Spacing:" type="float" min="0.1" max="1000">10.0</param>
+<param name="yspacing" _gui-text="Vertical Spacing:" type="float" min="0.1" max="1000">10.0</param>
+<param name="xoffset" _gui-text="Horizontal Offset:" type="float" min="0.0" max="1000">0.0</param>
+<param name="yoffset" _gui-text="Vertical Offset:" type="float" min="0.0" max="1000">0.0</param>
+<effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Render" >
+ <submenu _name="Grids" />
+ </submenu>
+ </effects-menu>
+<_menu-tip>Draw a path which is a grid</_menu-tip>
+</effect>
+<plugin name="libgrid2" />
+</inkscape-extension>
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index 6a95717f2..6b8e80d3c 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -39,6 +39,7 @@
#include "io/sys.h"
#include "inkscape.h"
#include "document-undo.h"
+#include "loader.h"
namespace Inkscape {
@@ -426,7 +427,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation
enum {
MODULE_EXTENSION,
MODULE_XSLT,
- /* MODULE_PLUGIN, */
+ MODULE_PLUGIN,
MODULE_UNKNOWN_IMP
} module_implementation_type = MODULE_UNKNOWN_IMP;
enum {
@@ -465,10 +466,8 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation
module_implementation_type = MODULE_EXTENSION;
} else if (!strcmp(element_name, INKSCAPE_EXTENSION_NS "xslt")) {
module_implementation_type = MODULE_XSLT;
-#if 0
- } else if (!strcmp(element_name, "plugin")) {
+ } else if (!strcmp(element_name, INKSCAPE_EXTENSION_NS "plugin")) {
module_implementation_type = MODULE_PLUGIN;
-#endif
}
//Inkscape::XML::Node *old_repr = child_repr;
@@ -489,13 +488,12 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation
imp = static_cast<Implementation::Implementation *>(xslt);
break;
}
-#if 0
case MODULE_PLUGIN: {
- Implementation::Plugin *plugin = new Implementation::Plugin();
- imp = static_cast<Implementation::Implementation *>(plugin);
+ Inkscape::Extension::Loader loader = Inkscape::Extension::Loader();
+ loader.set_base_directory ( Inkscape::Application::profile_path("extensions"));
+ imp = loader.load_implementation(doc);
break;
}
-#endif
default: {
imp = NULL;
break;
@@ -528,6 +526,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation
break;
}
default: {
+ module = new Extension(repr, imp);
break;
}
}
diff --git a/src/io/inkjar.h b/src/io/inkjar.h
index 637c05d80..d7de9ff4a 100644
--- a/src/io/inkjar.h
+++ b/src/io/inkjar.h
@@ -18,13 +18,7 @@
# include <zlib.h>
#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# ifdef HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
+#include <stdint.h>
#include <glib.h>
#include <cstdio>