Access of extensions to the root node
Dear all:
A while ago, I started looking into a method for using Inkscape for presentations. The result of my efforts are now published as JessyInk on a Google Code page (http://code.google.com/p/jessyink/). The system works by incorporating a JavaScript into the SVG image. If viewed in a browser with SVG and JavaScript support, the script causes every layer to be displayed as a slide and connects them with transitions. Later I also added other features like an index sheet and slide numbers. At the moment, incorporating the script and defining transitions and slide numbers can be done form inside Inkscape, which I think is an important point, so that people don't have to switch programmes constantly. However, it involves editing the SVG file in the XML editor, which is very inconvenient for most users.
Before working on further features, I wanted to create an Inkscape extension to provide a convenient way for people to add the necessary JavaScript to the SVG image and have an "onload"-attribute added to the root node to load the initialisation function when the image is loaded into a browser. Writing a small C++ programme to add the script was straight forward. The only problem I am experiencing is that the required "onload"-attribute of the root node is not copied into the SVG file Inkscape uses after the extension exits. Having a quick look at the source code, it seems to me that only the "width" and "height" attributes are copied.
I am curious why it was decided not to copy the other attributes of the root node from the SVG files that are returned form extensions. I think it would be a neat thing to do, but there might be good reasons why this is not a good idea. Furthermore, I would like to ask, if there is another way to add attributes to the root node using an extension.
Thanks in advance!
Cheers, Hannes
On Sat, 2008-03-15 at 17:34 -0300, Hannes Hochreiner wrote:
Before working on further features, I wanted to create an Inkscape extension to provide a convenient way for people to add the necessary JavaScript to the SVG image and have an "onload"-attribute added to the root node to load the initialisation function when the image is loaded into a browser. Writing a small C++ programme to add the script was straight forward. The only problem I am experiencing is that the required "onload"-attribute of the root node is not copied into the SVG file Inkscape uses after the extension exits. Having a quick look at the source code, it seems to me that only the "width" and "height" attributes are copied.
I am curious why it was decided not to copy the other attributes of the root node from the SVG files that are returned form extensions. I think it would be a neat thing to do, but there might be good reasons why this is not a good idea. Furthermore, I would like to ask, if there is another way to add attributes to the root node using an extension.
To keep things sane would couldn't just delete the root node and reload it, that would have confused many other parts of Inkscape, so we were just doing attributes. The choice of attributes was arbitrary. I think that we could just copy anything that is in a non-svg namespace. But, then also things like onload and others.
Also, there is a bug in Launchpad that I don't believe that has been fixed where doing path operations causes extra data to be lost on paths and other objects. If you're using extensions to add data, you might run into that one. I know that the BMX biking level editor did.
--Ted
On Sat, Mar 15, 2008 at 11:34 PM, Hannes Hochreiner wrote:
Dear all:
A while ago, I started looking into a method for using Inkscape for presentations. The result of my efforts are now published as JessyInk on a Google Code page (http://code.google.com/p/jessyink/).
Hey, this is exactly what I was missing and it works great :) I'd love to know if we could make it part of Inkscape.
Alexandre
participants (3)
-
Alexandre Prokoudine
-
Hannes Hochreiner
-
Ted Gould