Hi,
So, I felt familiar when Will wrote:
> In principle it shouldn't be
> so hard if you understand how to use tree view widgets (which I do,
> although I don't like them particularly). ÂAnd in principle the GIMP
> hierarchical organization should be very helpful, because it means
> that most of the work can be done in a few places. ÂBut in reality
> it means that only Mitch has any hope of doing it, because it
> involves making changes in (if I remember correctly)
> GimpDataFactory, GimpContainerTreeView, and/or GimpContainerEditor,
> all of whose roles and interactions are undefined, and all of which
> are inherited by many different things, with no explicit rules for
> the ways they are used. ÂThe result is that any change is a shot in
> the dark, which will probably break things all over the place.
Because those classes were the ones I became entangled in over the
last weekend, when I tried to do something as simple as put an up and
down arrow on the Tools dialog. (Bug #158666)
I can get to put the buttons, and to pass the ContainerEditor to the
click callback. As I've written on the bug report, I could not find
out, given the editor, what is selected, and it's index. Sven showed
me a function call - gimp_container_get_child_index - to get to the
index once I get what is selected, them a call to
gimp_container_reorder could do the job of going up or down one
place. (I will also need to get the container list's lenght to know
when the selected item is at the bottom).
As far as I was able to see, one have to go through the embeded
GtkTree descendant embeded in the GimpContainerEditor in order to
retireve what is selected.
Will does understand that widget. I do not. When I googled for it, I
got a 100 page pdf just explaining the GtkTreeView.
I tried to get to the selected object by doing:
static void
_gimp_tool_view_editor_move (GtkWidget *widget,
GimpContainerEditor *editor,
gint direction)
{
GimpContainerTreeView *tree_view = editor->view;
GimpContainer *container =
gimp_container_view_get_container (tree_view);
GtkTreeSelection *selection = gtk_tree_view_get_selection
(tree_view);
GList *rows =
gtk_tree_selection_get_selected_rows (
selection,
NULL
);
GimpObject *selected = g_list_nth_data (rows, 0);
----
I can be on the right track, orway off it - but I need to know if this
is teh way to go.
And...if this is the way to go, might I suggest a method for
retrieving the selection straight from a GimpContainerEditor, without
having to mess with the GimpContainerTreeView?
Thank you everybody.
JS
-><-
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer