diff options
| author | Andrew Higginson <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
|---|---|---|
| committer | Andrew <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
| commit | 80960b623a99aae1402ab651b2974ef544ed3b03 (patch) | |
| tree | ba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/extension/implementation/script.cpp | |
| parent | try to fix bug (diff) | |
| parent | GDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff) | |
| download | inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip | |
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/extension/implementation/script.cpp')
| -rw-r--r-- | src/extension/implementation/script.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 2f3e2cd65..0a0282284 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -149,7 +149,8 @@ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpName of memory in the unloaded state. */ Script::Script() : - Implementation() + Implementation(), + _canceled(false) { } @@ -177,8 +178,7 @@ Script::~Script() string. This means that the caller of this function can always free what they are given (and should do it too!). */ -std::string -Script::solve_reldir(Inkscape::XML::Node *reprin) { +std::string Script::solve_reldir(Inkscape::XML::Node *reprin) { gchar const *s = reprin->attribute("reldir"); @@ -361,8 +361,7 @@ void Script::unload(Inkscape::Extension::Extension */*module*/) \param module The Extension in question */ -bool -Script::check(Inkscape::Extension::Extension *module) +bool Script::check(Inkscape::Extension::Extension *module) { int script_count = 0; Inkscape::XML::Node *child_repr = sp_repr_children(module->get_repr()); @@ -729,8 +728,26 @@ void Script::effect(Inkscape::Extension::Effect *module, doc->doc()->emitReconstructionStart(); copy_doc(doc->doc()->rroot, mydoc->rroot); doc->doc()->emitReconstructionFinish(); - mydoc->release(); + SPObject *layer = NULL; + SPObject *obj = mydoc->getObjectById("base"); + + // Getting the named view from the document generated by the extension + SPNamedView *nv = (SPNamedView *) obj; + + //Check if it has a default layer set up + if ( nv != NULL and nv->default_layer_id != 0 ) { + SPDocument *document = desktop->doc(); + //If so, get that layer + layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); + } + sp_namedview_update_layers_from_document(desktop); + //If that layer exists, + if (layer) { + //set the current layer + desktop->setCurrentLayer(layer); + } + mydoc->release(); } return; @@ -803,7 +820,7 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr } // Delete the attributes of the old root nodes. - for (std::vector<gchar const *>::const_iterator it = attribs.begin(); it != attribs.end(); it++) { + for (std::vector<gchar const *>::const_iterator it = attribs.begin(); it != attribs.end(); ++it) { oldroot->setAttribute(*it, NULL); } @@ -954,7 +971,7 @@ int Script::execute (const std::list<std::string> &in_command, NULL, // STDIN &stdout_pipe, // STDOUT &stderr_pipe); // STDERR - } catch (Glib::Error e) { + } catch (Glib::Error &e) { printf("Can't Spawn!!! spawn returns: %s\n", e.what().data()); return 0; } |
