designing an XML editor TreeView



I need to create an XML editor TreeView for SVG files.  Right off I'll
ask if anyone knows of a nice example of an XML editor written in GTK+
that I can take a look at.

I'd want to be able to drag and drop sections of the markup and
edit/add elements, attributes and values.

I see the tree view having 6 columns

an 'id' (string) for easy lookup of important elements.  They usually
have an id for a reason.
a 'type' (pixmap) iconic 
a 'image' (pixmap) a dynamic graphic representation of the object
a 'tree_control' (pixmap > ^ ... )
a 'name' (string) an element or attribute name
an optional 'value' (string) for attribute data.

The attribute value can be a string, an enum, a number (possibly
integer) coordinate data, color data, etc.  So the interface for
editing attribute values can benefit from some extra interface work to
help the user work faster and to provide some built in data validation
and hinting.  I have code to validate SVG.

i.e.  
    If the value is an enumerated type, it would be nice to have a
drop down selection control attached to the value that allows the user
to select another valid enum.
    If the value is a paint, there are several options, fill styles,
gradients (reference id's or url's) colors (named colors,
red/green/salmon, web colors, #FF00FF) etc.

One idea that occurs to me is to create right click menus for each
property type, but it would be cleaner if I could integrate controls
into the value field, like a dropdown box icon for enumerated items.

The paint value is a good example of a complicated field that would
benefit from several types of UI possibilities:
   
    1) select an id of a valid fill type from a dropdown 
         (i.e a previously defined gradient)
     2) select a named colour value from a dropdown
     3) enter a web colour directly into the field (#FFF0B6)
     4) pull up a colour dialog
     5) select from a list of colours used elsewhere in the document.
for continuity.

A right click menu would be the easiest to implement and would not
complicate the tree view, but would lead to the creation of modal
dialogs.  I'd like to avoid that in favour of creating UI Widgets
right in the tree view if possible.

If anyone can suggest a clean approach to this can of worms I'd very
much like to hear it.

Also, this brings up UI design issues that may be unique to GTK.  If
there are cleaner and faster ways to do this, or just dead wrong
approaches to this kind of thing I'd appreciate heads up opinions on
those too. :)

-- 
Cheers!
Rick



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]