summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
commit945ce419c806c73d70203dec33ececafbe108a92 (patch)
treecfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/extension/implementation
parentMerge from trunk (again) (diff)
parentExtensions. SVG+media fix (see Bug #400356). (diff)
downloadinkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz
inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/extension/implementation')
-rw-r--r--src/extension/implementation/implementation.cpp25
-rw-r--r--src/extension/implementation/implementation.h8
-rw-r--r--src/extension/implementation/script.cpp26
-rw-r--r--src/extension/implementation/xslt.cpp11
4 files changed, 41 insertions, 29 deletions
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp
index a8533a427..63181d0c4 100644
--- a/src/extension/implementation/implementation.cpp
+++ b/src/extension/implementation/implementation.cpp
@@ -96,23 +96,26 @@ Implementation::save(Inkscape::Extension::Output */*module*/, SPDocument */*doc*
return;
} /* Implementation::save */
-Gtk::Widget *
-Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * docCache) {
- if (module->param_visible_count() == 0) return NULL;
+Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * /*docCache*/)
+{
+ if (module->param_visible_count() == 0) {
+ return NULL;
+ }
SPDocument * current_document = view->doc();
using Inkscape::Util::GSListConstIterator;
GSListConstIterator<SPItem *> selected =
sp_desktop_selection((SPDesktop *)view)->itemList();
- Inkscape::XML::Node * first_select = NULL;
+ Inkscape::XML::Node const* first_select = NULL;
if (selected != NULL) {
const SPItem * item = *selected;
- first_select = SP_OBJECT_REPR(item);
+ first_select = item->getRepr();
}
- return module->autogui(current_document, first_select, changeSignal);
-} /* Implementation::prefs_effect */
+ // TODO deal with this broken const correctness:
+ return module->autogui(current_document, const_cast<Inkscape::XML::Node *>(first_select), changeSignal);
+} // Implementation::prefs_effect
void
Implementation::effect(Inkscape::Extension::Effect */*module*/, Inkscape::UI::View::View */*document*/, ImplementationDocumentCache * /*docCache*/) {
@@ -148,7 +151,7 @@ Implementation::finish(Inkscape::Extension::Print */*module*/)
/* Rendering methods */
unsigned int
-Implementation::bind(Inkscape::Extension::Print */*module*/, Geom::Matrix const */*transform*/, float /*opacity*/)
+Implementation::bind(Inkscape::Extension::Print */*module*/, Geom::Affine const */*transform*/, float /*opacity*/)
{
return 0;
}
@@ -166,14 +169,14 @@ Implementation::comment(Inkscape::Extension::Print */*module*/, char const */*co
}
unsigned int
-Implementation::fill(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Matrix const */*ctm*/, SPStyle const */*style*/,
+Implementation::fill(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Affine const */*ctm*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
}
unsigned int
-Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Matrix const */*transform*/, SPStyle const */*style*/,
+Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Affine const */*transform*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
@@ -181,7 +184,7 @@ Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector
unsigned int
Implementation::image(Inkscape::Extension::Print */*module*/, unsigned char */*px*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*rs*/,
- Geom::Matrix const */*transform*/, SPStyle const */*style*/)
+ Geom::Affine const */*transform*/, SPStyle const */*style*/)
{
return 0;
}
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index 9de70dce7..bf584b401 100644
--- a/src/extension/implementation/implementation.h
+++ b/src/extension/implementation/implementation.h
@@ -100,20 +100,20 @@ public:
/* ----- Rendering methods ----- */
virtual unsigned bind(Inkscape::Extension::Print *module,
- Geom::Matrix const *transform,
+ Geom::Affine 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,
Geom::PathVector const &pathv,
- Geom::Matrix const *ctm,
+ Geom::Affine const *ctm,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
NRRect const *bbox);
virtual unsigned stroke(Inkscape::Extension::Print *module,
Geom::PathVector const &pathv,
- Geom::Matrix const *transform,
+ Geom::Affine const *transform,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
@@ -123,7 +123,7 @@ public:
unsigned int w,
unsigned int h,
unsigned int rs,
- Geom::Matrix const *transform,
+ Geom::Affine const *transform,
SPStyle const *style);
virtual unsigned text(Inkscape::Extension::Print *module,
char const *text,
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index bc143fd14..2f3e2cd65 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -45,7 +45,7 @@
#include "xml/attribute-record.h"
#include "util/glib-list-iterators.h"
-
+#include "path-prefix.h"
#ifdef WIN32
@@ -189,7 +189,6 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
}
Glib::ustring reldir = s;
-
for (unsigned int i=0;
i < Inkscape::Extension::Extension::search_path.size();
i++) {
@@ -200,7 +199,7 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
NULL);
Glib::ustring filename = fname;
g_free(fname);
-
+ //printf("Filename: %s\n", filename.c_str());
if ( Inkscape::IO::file_test(filename.c_str(), G_FILE_TEST_EXISTS) ) {
return Glib::filename_from_utf8(filename);
}
@@ -229,14 +228,13 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
*/
bool Script::check_existence(const std::string &command)
{
-
// Check the simple case first
if (command.empty()) {
return false;
}
//Don't search when it is an absolute path. */
- if (!Glib::path_is_absolute(command)) {
+ if (Glib::path_is_absolute(command)) {
if (Glib::file_test(command, Glib::FILE_TEST_EXISTS)) {
return true;
} else {
@@ -244,12 +242,11 @@ bool Script::check_existence(const std::string &command)
}
}
- std::string path = Glib::getenv("PATH");
- if (path.empty()) {
- /* There is no `PATH' in the environment.
- The default search path is the current directory */
- path = G_SEARCHPATH_SEPARATOR_S;
- }
+ // First search in the current directory
+ std::string path = G_SEARCHPATH_SEPARATOR_S;
+ path.append(";");
+ // And then in the PATH environment variable.
+ path.append(Glib::getenv("PATH"));
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -379,8 +376,11 @@ Script::check(Inkscape::Extension::Extension *module)
if (!command_text.empty()) {
/* I've got the command */
bool existance = check_existence(command_text);
- if (!existance)
+ if (!existance) {
return false;
+ }
+ } else {
+ return false;
}
}
@@ -603,7 +603,7 @@ void Script::save(Inkscape::Extension::Output *module,
file_listener fileout;
int data_read = execute(command, params, tempfilename_in, fileout);
-
+
bool success = false;
if (data_read > 0) {
diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp
index c929ba19a..8b6e6c701 100644
--- a/src/extension/implementation/xslt.cpp
+++ b/src/extension/implementation/xslt.cpp
@@ -29,6 +29,7 @@
#include <libxml/parser.h>
#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
Inkscape::XML::Document * sp_repr_do_read (xmlDocPtr doc, const gchar * default_ns);
@@ -217,11 +218,19 @@ XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const
params[0] = NULL;
xmlDocPtr newdoc = xsltApplyStylesheet(_stylesheet, svgdoc, params);
- xmlSaveFile(filename, newdoc);
+ //xmlSaveFile(filename, newdoc);
+ int success = xsltSaveResultToFilename(filename, newdoc, _stylesheet, 0);
xmlFreeDoc(newdoc);
xmlFreeDoc(svgdoc);
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+
+ if (success < 1) {
+ throw Inkscape::Extension::Output::save_failed();
+ }
+
return;
}