gimp r27988 - in trunk: . app/actions app/paint



Author: mitch
Date: Thu Feb  5 23:44:30 2009
New Revision: 27988
URL: http://svn.gnome.org/viewvc/gimp?rev=27988&view=rev

Log:
2009-02-06  Michael Natterer  <mitch gimp org>

	Bug 471681 â Keyboard shortcuts for brush size/params need
	feedback

	Applied patch from Sven Neumann which addresses above bug:

	* app/actions/actions.[ch]: add new function action_message()
	which pushes a temp message to a display's statusbar.

	(action_select_property): add GimpDisplay* parameter and call
	action_message() for int and double property changes.

	* app/actions/tools-commands.c: pass the display to
	action_select_property().

	* app/paint/gimpinkoptions.c: add some blurbs to make it work
	for the ink blob properties.



Modified:
   trunk/ChangeLog
   trunk/app/actions/actions.c
   trunk/app/actions/actions.h
   trunk/app/actions/tools-commands.c
   trunk/app/paint/gimpinkoptions.c

Modified: trunk/app/actions/actions.c
==============================================================================
--- trunk/app/actions/actions.c	(original)
+++ trunk/app/actions/actions.c	Thu Feb  5 23:44:30 2009
@@ -30,6 +30,8 @@
 #include "core/gimpcontainer.h"
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
+#include "core/gimptooloptions.h"
+#include "core/gimptoolinfo.h"
 
 #include "widgets/gimpactionfactory.h"
 #include "widgets/gimpactiongroup.h"
@@ -43,6 +45,7 @@
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
 #include "display/gimpnavigationeditor.h"
+#include "display/gimpstatusbar.h"
 
 #include "dialogs/dialogs.h"
 
@@ -379,6 +382,30 @@
   return dialogs_get_toolbox ();
 }
 
+static void
+action_message (GimpDisplay *display,
+                GObject     *object,
+                gchar       *format,
+                ...)
+{
+  GimpDisplayShell *shell    = GIMP_DISPLAY_SHELL (display->shell);
+  const gchar      *stock_id = NULL;
+  va_list           args;
+
+  if (GIMP_IS_TOOL_OPTIONS (object))
+    {
+      GimpToolInfo *tool_info = GIMP_TOOL_OPTIONS (object)->tool_info;
+
+      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
+    }
+
+  va_start (args, format);
+  gimp_statusbar_push_temp_valist (GIMP_STATUSBAR (shell->statusbar),
+                                   GIMP_MESSAGE_INFO, stock_id,
+                                   format, args);
+  va_end (args);
+}
+
 gdouble
 action_select_value (GimpActionSelectType  select_type,
                      gdouble               value,
@@ -465,6 +492,7 @@
 
 void
 action_select_property (GimpActionSelectType  select_type,
+                        GimpDisplay          *display,
                         GObject              *object,
                         const gchar          *property_name,
                         gdouble               small_inc,
@@ -474,6 +502,7 @@
 {
   GParamSpec *pspec;
 
+  g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
   g_return_if_fail (G_IS_OBJECT (object));
   g_return_if_fail (property_name != NULL);
 
@@ -494,6 +523,14 @@
                                    small_inc, inc, skip_inc, 0, wrap);
 
       g_object_set (object, property_name, value, NULL);
+
+      if (display)
+        {
+          const gchar *blurb = g_param_spec_get_blurb (pspec);
+
+          if (blurb)
+            action_message (display, object, "%s: %.2f", blurb, value);
+        }
     }
   else if (G_IS_PARAM_SPEC_INT (pspec))
     {
@@ -509,6 +546,14 @@
                                    small_inc, inc, skip_inc, 0, wrap);
 
       g_object_set (object, property_name, value, NULL);
+
+      if (display)
+        {
+          const gchar *blurb = g_param_spec_get_blurb (pspec);
+
+          if (blurb)
+            action_message (display, object, "%s: %d", blurb, value);
+        }
     }
   else
     {

Modified: trunk/app/actions/actions.h
==============================================================================
--- trunk/app/actions/actions.h	(original)
+++ trunk/app/actions/actions.h	Thu Feb  5 23:44:30 2009
@@ -42,6 +42,7 @@
                                        gdouble               delta_factor,
                                        gboolean              wrap);
 void          action_select_property  (GimpActionSelectType  select_type,
+                                       GimpDisplay          *display,
                                        GObject              *object,
                                        const gchar          *property_name,
                                        gdouble               small_inc,

Modified: trunk/app/actions/tools-commands.c
==============================================================================
--- trunk/app/actions/tools-commands.c	(original)
+++ trunk/app/actions/tools-commands.c	Thu Feb  5 23:44:30 2009
@@ -268,6 +268,7 @@
   if (tool_info && GIMP_IS_COLOR_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "average-radius",
                               1.0, 1.0, 10.0, FALSE);
@@ -288,6 +289,7 @@
   if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
     {
       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);
@@ -328,6 +330,7 @@
   if (tool_info && GIMP_IS_INK_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "size",
                               1.0, 1.0, 10.0, FALSE);
@@ -348,6 +351,7 @@
   if (tool_info && GIMP_IS_INK_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "blob-aspect",
                               1.0, 0.1, 1.0, FALSE);
@@ -368,6 +372,7 @@
   if (tool_info && GIMP_IS_INK_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "blob-angle",
                               1.0, 1.0, 15.0, TRUE);
@@ -388,6 +393,7 @@
   if (tool_info && GIMP_IS_FOREGROUND_SELECT_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "stroke-width",
                               1.0, 4.0, 16.0, FALSE);
@@ -408,6 +414,7 @@
   if (tool_info && GIMP_IS_TRANSFORM_OPTIONS (tool_info->tool_options))
     {
       action_select_property ((GimpActionSelectType) value,
+                              action_data_get_display (data),
                               G_OBJECT (tool_info->tool_options),
                               "preview-opacity",
                               0.01, 0.1, 0.5, FALSE);

Modified: trunk/app/paint/gimpinkoptions.c
==============================================================================
--- trunk/app/paint/gimpinkoptions.c	(original)
+++ trunk/app/paint/gimpinkoptions.c	Thu Feb  5 23:44:30 2009
@@ -69,7 +69,7 @@
   object_class->get_property = gimp_ink_options_get_property;
 
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SIZE,
-                                   "size", NULL,
+                                   "size", _("Ink Blob Size"),
                                    0.0, 200.0, 16.0,
                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_ANGLE,
@@ -96,11 +96,11 @@
                                  GIMP_INK_BLOB_TYPE_ELLIPSE,
                                  GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT,
-                                   "blob-aspect", NULL,
+                                   "blob-aspect", _("Ink Blob Aspect"),
                                    1.0, 10.0, 1.0,
                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ANGLE,
-                                   "blob-angle", NULL,
+                                   "blob-angle", _("Ink Blob Angle"),
                                    -90.0, 90.0, 0.0,
                                    GIMP_PARAM_STATIC_STRINGS);
 }



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