[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gimp-developer
Subject:    Re: [Gimp-developer]  Help needed with implementation of up and
From:       Michael Natterer <mitch () gimp ! org>
Date:       2004-11-24 13:47:47
Message-ID: yg1wtwb73zw.fsf () convergence ! de
[Download RAW message or body]

This can be done way easier that what you describe below.

Just create actions "tools-raise", "tools-raise-to-top", "tools-lower",
"tools-lower-to-button" in app/actions/tools-actions.[ch] and
app/actions/tools-commands.[ch].

Then simply add some buttons to the dialog using

gimp_editor_add_action_button()

at the place where the "Reset" button gets added.

Fiddling with the tree view is unneccessary and even wrong.

ciao,
--mitch



"Joao S. O. Bueno Calligaris" <gwidion@mpc.com.br> writes:

> 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
> Gimp-developer@lists.xcf.berkeley.edu
> http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic