On Nov 4, 2005, at 10:01 AM, Ralf Stephan wrote:
Ben:
inkscape_application_init( ) is called in three places, in main.cpp, exactly once at application start-up; by SVGPreview::SVGPreview() when we want to provide a preview of an SVG file in a File->Open dialogue and by ImageIcon::init(), probably for similar reasons.
And what does the inkscape object do? It provides preferences info for all apps, and desktop/document info/GUI services for GUI apps.
It might also be doing a little too much.
I think some of what needs to be done is to put in a few models behind the scenes to act as mediators between sections.
One way is how The GIMP has a GimpContext between tools and documents instead of hooking up things directly. If, for example, we have the "current color widget" hooked up to a Context instance, it then could be completely ignorant of even the existence of documents. Then each document could have it's own Context that hooks to the application's Context as it comes forward. As far as the "current color widget" would be concerned, all that is going on behind the facade of the interface. It knows colors and only colors and is not concerned with other complex things such as documents, UI and such.
So... take a eye out for how things might be broken down more. Instead of keeping with a single "application" instance that's a catch-all glob for everything, try to see if there are lines to have things broken down logically. Ask yourself "does this *really* belong as part of the essence of the Application, or is it perhaps is it more the essence of the current Document, or something new abstract concept?"