Re: Patch to improve the brush size keyboard shortcuts

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

 





On Tue, May 25, 2010 at 8:05 PM, Dieki N <dieki.ubuntu@xxxxxxxxx> wrote:
I've created a patch to improve the behavior of brush size increase\decrease keyboard shortcuts, particularly at small sizes and large sizes. The old behavior increased\decreased the brush size by a fixed value (0.10), which worked fine at medium sizes, and reasonably well at large sizes (since you could hold down the keyboard shortcut to get a lot of change), but completely broke down at sizes underneath 0.20, since you tended to have two options; too big or too small. (Or, when under 0.10, none at all!)

This patch sets the increment according to the following rules:

If <brush size> is greater than 2, it increments by 0.20.
If <brush size> is less than 2 but greater than 0.50, it increments by 0.10.
If <brush size> is less than 0.50 but greater than 0.10, it increments by 0.05.
If <brush size> is less than 0.10, it increments by 0.01.

I've tested this in my own use over the last couple weeks, and it seems most helpful, particularly when masking fine details. This patch is against Master.

Dieki


Maybe it would help if I actually attached the patch. :) Here it is.

From e44c784d2f66a24c5bd9af6cefd868e60b9e07a7 Mon Sep 17 00:00:00 2001
From: Dieki <dieki.ubuntu@xxxxxxxxx>
Date: Sat, 8 May 2010 06:58:34 -0500
Subject: [PATCH] Make the brush size shortcuts kinda logarithmic.

When brush size is above 2, increment\decrement by .2; when between .5
and 2, increment and decrement by .1; when between .1 and .5, increment
and decrement by .05; and when under .1, increment and decrement by .01.

This makes it a lot easier to change brush sizes with keyboard at small
brush sizes.
---
 app/actions/tools-commands.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c
index c06e38e..07722bd 100644
--- a/app/actions/tools-commands.c
+++ b/app/actions/tools-commands.c
@@ -136,11 +136,26 @@ tools_paint_brush_scale_cmd_callback (GtkAction *action,
 
   if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
     {
+      gdouble old_value;
+      gdouble increment;
+      
+      g_object_get (G_OBJECT (tool_info->tool_options), "brush-scale", &old_value, NULL);
+      increment = .20;
+      if (value == GIMP_ACTION_SELECT_NEXT) {
+          if (old_value <= 2) increment = .1;
+          if (old_value <= .5) increment = .05;
+          if (old_value <= .1) increment = .01;
+      }
+      else if (value == GIMP_ACTION_SELECT_PREVIOUS) {
+          if (old_value <= 2.20) increment = .1;
+          if (old_value <= .6) increment = .05;
+          if (old_value <= .15) increment = .01;
+      }
       action_select_property ((GimpActionSelectType) value,
                               action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "brush-scale",
-                              0.01, 0.1, 1.0, FALSE);
+                              0.01, increment, 1.0, FALSE);
     }
 }
 
-- 
1.7.0.4

_______________________________________________
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