diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2011-08-31 16:58:40 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2011-08-31 16:58:40 +0000 |
| commit | 8ddc64a6158de6a9714bca05fe6207bbb472e22a (patch) | |
| tree | 29edecbca7de1b975bde32d07aec131d46a57345 /src/extension/implementation/script.cpp | |
| parent | add underscore _ (diff) | |
| download | inkscape-8ddc64a6158de6a9714bca05fe6207bbb472e22a.tar.gz inkscape-8ddc64a6158de6a9714bca05fe6207bbb472e22a.zip | |
Extensions. Fix for bug #789122 (changing current layer through an extension) thanks to cosmin.
(bzr r10608)
Diffstat (limited to 'src/extension/implementation/script.cpp')
| -rw-r--r-- | src/extension/implementation/script.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 2f3e2cd65..cac67844f 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -729,8 +729,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->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; |
