I just discovered Inkscape -- really nice implementation!
One feature I find missing in almost all graphics editors, is a way to keep objects consistent. For example, most software (including Inkscape) has a way to align the edges of multiple objects, but only a few have a "make same size" (or color, or font, or....). This leaves me doing a lot of fiddling to make diagrams look really professional.
I poked at the SVG that Inkscape creates, and noticed that there seems to be a big, long "style" attribute on most everything. Perfectly valid SVG, no problem. But how about if (at least as an option), I could have all those style attributes written out in a <style> block at the top, instead of distributed throughout the file? This is, IMHO, what stylesheets are mainly about. You get these advantages:
* You can assign a name to each style (just like in any other stylesheets), which makes it easier to read the SVg, and easier to think about how you want things to look.
* Consistency is automatic -- if you assigned style X to this object, when you change style X the object changes.
* Making style changes is vastly easier: change it in one place.
* You save space, since almost always, a diagram will have many repetitions of similar shapes.
* You don't even need the "make same style" feature, since it happens for free if you assign a given named style to an object.
This is basically the same principle as keeping constants out of your code when writing software, or as using XML instead of formatting commands.
I'm convinced it will work fine, since I modified some Inkscape-created SVG by hand to gather the styles up front, and it worked just fine when I reopened the file.
The only hard part, I think is that we'd need an interaction when changing the style of an object, to ask whether the user means to change the whole class/style of objects, make a new class based on this object, or make this an exception. But, this interaction is only needed if the user has turned on this "style gallery" option, and if they do that, they probably almost always want to keep things consistent (so one could offer an "always apply style changes to entire lass" preference).
I looked around briefly on the website, and saw some other suggestions for things like a "style gallery", so it seems there is some interest. I think the key principle is simply to separate out the style information and name it so it can be reused.
I don't have time to learn my way around the whole codebase, but if someone can point me to the couple places that would be involved, I'll try to take a shot at implementing some form of this. I guess I'd need to know whatever place(s) modify object style, and an example of how to add a settings dialog (so I'd know how to implement a style-chooser).
Of course, a really nice touch with such a feature is the "find equivalently-styled objects and make them into classes" button. Pretty easy once the rest is done.
Thanks!
Steve DeRose
treatment of svg style
Re: treatment of svg style
sderose wrote:But how about if (at least as an option), I could have all those style attributes written out in a <style> block at the top, instead of distributed throughout the file?
CSS support has been a long planned feature.