From Inkscape Wiki
Revision as of 05:27, 21 March 2004 by (talk)
Jump to navigation Jump to search


The extensions system in Inkscape is a way for additional functionality to Inkscape, without effecting the core of the program itself. The proposal put forth here involves seperating this into two objects: what the extension does, and how it does it. This seperation allows for Inkscape extensions to be easy to use internally (by using the what it does functionality) but also easy to add different methods of doing it easily.

An Extension

The first part of being extension is defining what the extension does. There are currently implemented several types, and there is bound to be more in the future.

Currently, there are Input, Output, Effect and Print extensions. The Input ones handle getting data into Inkscape. The Output ones act as Output filters for file formats. The Effect Extensions take the current document and apply some sort of effect to change the elements on the page. Print Extensions handle different types of print output, for different drivers or modes. Possible future extensions could be: Tool, File Dialog or Color Picker. This architecture does not limit the use of these.

There is a base class called 'Extension' and this is where all the functionality based classes derive from. In this class there are stored values include the name of the extension, the unique key that is used to describe it, and a few other global variables. Functionally, it implements the load and unload functionality for all extensions. This allows all extensions to be able to allocate and lower memory usage depending on if they are being used. Extensions that are implemented with loadable libraries can unload the libraries when they are not in use. Also, a timer will be implemented to unload the extension after a set amount of time of inactivity - allowing rarely used extensions to not continously take up valuable memory.

Another key feature of the Extension class is in the constructors and destructors for the class. When the extension constructor is called it creates the entity, and then registers it in the extension database. The extension database contains all of the extensions in the system and can be queried to get various lists of them. It is important for every extension to be in the database so that it will come up in those querys.


Checking dependencies...


An input module provides a way to get data into Inkscape. This extension creates a document given a filename. This is done by using the 'open' method within the class. Also, there is a 'prefs' function which will generate a GtkDialog. This dialog is then used to get any settings that the incomming file and extension my use. This function is executed, and the dialog returns, before the open method is called.

There are also several other settings stored in an Input extension. This includes information on the type of file the input module can take in including its filename extension and mime type. Also, there is a space to store a tooltip for additional information on the file type in the file dialog. Lastly, there is the key of which Output extension is recommended for saving this filetype. This is useful, as there is no other direct links between the Input and Ouput functions, and a user expects to be able to open and save without using the 'Save As...' dialog.







XML Extension Definition

To be continued ----