Re: Tagging of Gimp Resources project status

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

 



Hello,

On Tue, Jul 15, 2008 at 10:01 AM, David Gowers <00ai99@xxxxxxxxx> wrote:
> On Tue, Jul 15, 2008 at 1:06 AM, Bill Skaggs <weskaggs@xxxxxxxxx> wrote:
>> Here is to me the most important question.  Suppose the user wants
>> to switch back and forth among a few brushes that don't have any
>> natural relationship.  Suppose for example that the user wants to draw
>> with a pencil brush, and then erase parts of the drawing with a round
>> parametric brush, and repeat the cycle.  Is this sort of thing going to
>> be supported in a way that is easy for the user?
>>
>>  -- Bill
>
> Cycling between the brushes in the filtered view could do this (so,
> tag both with 'quickdraw' then use the action -- notice their ordering
> is not user-controllable in this scenario). I think 'next brush' and
> 'previous brush' actions that already exist should handle this.
>
> However, they appear not to cycle currently -- ie going back from the
> first brush leaves you at the first brush rather than the last, and
> vice versa.
>  This should really be fixed -- cycling makes more sense for
> GimpData's (brush, pattern, palette) than the current, clipping,
> behaviour.
> Looking at the code in app/actions/actions.c, it seems that all we
> need is to change action_select_object() to support wrapping, and then
> use that parameter (in context-commands.c and layers-commands.c).
>
> A diff is attached that implements the suggested changes.
.. I am puzzled by how this message got double posted.

I left a file out of the diff and some formatting was incorrect. Here
is the revised diff.
Index: app/actions/actions.c
===================================================================
--- app/actions/actions.c	(revision 26193)
+++ app/actions/actions.c	(working copy)
@@ -511,7 +511,8 @@
 GimpObject *
 action_select_object (GimpActionSelectType  select_type,
                       GimpContainer        *container,
-                      GimpObject           *current)
+                      GimpObject           *current,
+                      gboolean              wrap)
 {
   gint select_index;
   gint n_children;
@@ -561,7 +562,14 @@
       break;
     }
 
-  select_index = CLAMP (select_index, 0, n_children - 1);
+  if (wrap)
+    {
+      while (select_index < 0)
+        select_index = (n_children) - (0 - select_index);
+ 
+      while (select_index > (n_children - 1))
+        select_index = (n_children - select_index);
+    }
 
   return gimp_container_get_child_by_index (container, select_index);
 }
Index: app/actions/actions.h
===================================================================
--- app/actions/actions.h	(revision 26193)
+++ app/actions/actions.h	(working copy)
@@ -51,7 +51,8 @@
                                        gboolean              wrap);
 GimpObject  * action_select_object    (GimpActionSelectType  select_type,
                                        GimpContainer        *container,
-                                       GimpObject           *current);
+                                       GimpObject           *current,
+                                       gboolean              wrap);
 
 
 #define return_if_no_gimp(gimp,data) \
Index: app/actions/layers-commands.c
===================================================================
--- app/actions/layers-commands.c	(revision 26193)
+++ app/actions/layers-commands.c	(working copy)
@@ -348,7 +348,8 @@
 
   new_layer = (GimpLayer *) action_select_object ((GimpActionSelectType) value,
                                                   image->layers,
-                                                  (GimpObject *) layer);
+                                                  (GimpObject *) layer,
+                                                  FALSE);
 
   if (new_layer && new_layer != layer)
     {
Index: app/actions/context-commands.c
===================================================================
--- app/actions/context-commands.c	(revision 26193)
+++ app/actions/context-commands.c	(working copy)
@@ -680,7 +680,7 @@
 
   current = gimp_context_get_by_type (context, container->children_type);
 
-  current = action_select_object (select_type, container, current);
+  current = action_select_object (select_type, container, current, TRUE);
 
   if (current)
     gimp_context_set_by_type (context, container->children_type, current);
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux