On Sun, Oct 15, 2006 at 12:11:27AM -0600, Michael Moore wrote:
I think it'd be great if it were possible to select "Import clipart" in the Inkscape menu, and there was a nice clipart browser that would pop up to let you view the clipart by category, see thumbnails, and select a piece of clipart to import into your drawing. As I'm thinking about this, I'm thinking specificly of OCAL.
What do people think?
Hi Michael! Yes, I think this is an excellent idea.
I know you have a good background participating with OCAL, so I know you already know about the ccHost migration plans and the benefits that tying in with that would provide.
Someone has mentioned the summer of code project to create an OCAL browser last year; unfortunately, that didn't end up solving the need, but it might be worth reviewing for ideas.
One thing I would strongly recommend is to divide the effort into the creation of several distinct, independent components. This will allow you to tighten your focus. For example:
1. Asset Collector - interfaces with OCAL (or other sites) to download new clipart, fonts, color schemes, or whatever. Takes care of installation into a local library at /usr/share/create/clipart or whereever. Manages a searchable index, generates preview images, etc.
2. Library browser - a simple GUI Gtkmm component for browsing and searching an indexed collection of graphical assets.
3. Vector object inserter - a routine for inserting a piece of clipart or other vectorial component into the document. Includes functionality for rescaling, color/font substitution, and other insertion-time adaptation.
4. Asset publisher - enables sending selected object to a ccHost-based asset manager like OCAL.
Then perhaps you can focus on just "#2. Library browser". This allows you to not worry about the download/upload capabilities, just stub out the inserter, etc. Others who may be interested in this could then focus on owning development of those other pieces.
The approach of having a managed local cache of clipart has several further benefits. It permits offline use of the clipart that the user has used in the past. It enables the user to refresh and fill in the cache when they're not working, so that when they are busily in art mode, they don't have to slow down and wait for things to download. It enables enterprise users to have a clipart collection provided through their regular distribution channel. It allows parents or teachers to review and vet the clipart that their children can use. It enables the user to add their own local clipart.
Further, the "1. Asset Collector" tool could potentially be made part of the Create project, and could be used for managing libraries of graphical assets beyond just clipart in inkscape: Gradients, fonts, color themes, brushes, patterns, symbols, sound clips, templates... Scribus, GIMP, Dia, Blender, OpenOffice....
I'd like to implement this, but I wanted to get some input first. I'm not new to programming, but I haven't done much with GUIs, and nothing with GTK.
Here's what I was thinking...
The GUI would have a two panes, a Cancel and an OK button. The left pane would be an expandable tree view of the OCAL categories. You could expand a category to view the sub categories. The right pane would display thumbnails of the clipart in the selected category (and it's sub categories?). The user would select a thumbnail, then click "OK" to insert it.
Sounds like an excellent starting point. There are a few dialogs already in inkscape which have this style of layout that you could probably copy from.
Another approach to think about is to create a dockable pane that sits on the right side of the Inkscape interface (or could be pulled out into a separate dialog). This pane would include a scrollable list of clipart that could be pasted into Inkscape, perhaps with a category selector or search box. If this sounds of interest, talk with Jon Cruz and look at some of his work around the color palette.
Since rendering all of the SVG cliparts in each category would take too long, I would use the png thumbnails already in OCAL.
So as not to be reading through all the OCAL collection each time you want to import, the categories and thumbnails listings would be read from an XML file. I would write a script or plugin to generate the appropriate XML file, and if this works out nicely, maybe OCAL would be able to include the XML file in the download.
Yup. And in general, the '1. Asset collector' piece could fulfil this role. If anyone wishes something more generic, they can expand that piece to do more. I agree a simple script would probably suffice for the time being.
This next part should be read with the disclaimer that this is how it would work if I'm understanding the Inkscape source correctly...
I would create a new verb SP_VERB_FILE_IMPORT_CLIPART, and a new menu item "Import Clipart". When it was chosen, it would call sp_clipart_file_import instead of sp_file_import like the current Import does. The sp_clipart_file_import would open the dialog I described above, and call file_import like the current Import method does. Essentially it would do the exact same job that Import does now, but with a GUI that is friendly for browsing clipart.
Actually, I think if you assume the existance of a local cache of clipart, you could simply use sp_file_import as normal. You'd still need a separate mechanism for browsing through that cache to select the filename to use.
Anyway, I think this is a *great* idea. :-) Let us know if you have more questions. gtkmm is not too hard to learn, but we can definitely give plenty of tips and guidance if you get stuck. I definitely recommend starting with something simple first, and work your way up as your knowledge of gtkmm improves.
Bryce