[gimp] make action_message() visible externally and use it.



commit 2ff4bbd1111543bbc7567eb9a9864b0ce64cdef9
Author: Stephen Griffiths <scgmk4 hotmail com>
Date:   Tue May 5 21:38:23 2009 +1000

    make action_message() visible externally and use it.
    
    * app/actions/actions.h: added prototype for action_message()
    * app/actions/actions.c: removed static keyword from action_message()
    removed private prototype for action_message()
    made action_message() use icons for objects derived from GimpViewable
    
    * app/actions/context-commands.c:
    context_brush_radius_cmd_callback()
    context_brush_angle_cmd_callback()
    context_paint_mode_cmd_callback()
    context_brush_shape_cmd_callback()
    call acton_message(), these callbacks had use cases where they could not
    use generic code
    
    * app/tools/gimpcoloroptions.c: added "average-radius" blurb
    and mark for translarion
---
 app/actions/actions.c          |   15 ++++-------
 app/actions/actions.h          |    4 +++
 app/actions/context-commands.c |   53 ++++++++++++++++++++++++++++++++++++++++
 app/tools/gimpcoloroptions.c   |    3 +-
 4 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/app/actions/actions.c b/app/actions/actions.c
index 675f4a7..f5b86b9 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -93,12 +93,6 @@
 #include "gimp-intl.h"
 
 
-static void  action_message (GimpDisplay *display,
-                             GObject     *object,
-                             const gchar *format,
-                             ...) G_GNUC_PRINTF(3,4);
-
-
 /*  global variables  */
 
 GimpActionFactory *global_action_factory = NULL;
@@ -607,10 +601,7 @@ action_select_object (GimpActionSelectType  select_type,
   return gimp_container_get_child_by_index (container, select_index);
 }
 
-
-/*  private functions  */
-
-static void
+void
 action_message (GimpDisplay *display,
                 GObject     *object,
                 const gchar *format,
@@ -626,6 +617,10 @@ action_message (GimpDisplay *display,
 
       stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
     }
+  else if (GIMP_IS_VIEWABLE (object))
+    {
+      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (object));
+    }
 
   va_start (args, format);
   gimp_statusbar_push_temp_valist (GIMP_STATUSBAR (shell->statusbar),
diff --git a/app/actions/actions.h b/app/actions/actions.h
index fabdc89..c068a3a 100644
--- a/app/actions/actions.h
+++ b/app/actions/actions.h
@@ -52,6 +52,10 @@ void          action_select_property  (GimpActionSelectType  select_type,
 GimpObject  * action_select_object    (GimpActionSelectType  select_type,
                                        GimpContainer        *container,
                                        GimpObject           *current);
+void          action_message          (GimpDisplay          *display,
+                                       GObject              *object,
+                                       const gchar          *format,
+                                       ...) G_GNUC_PRINTF(3,4);
 
 
 #define return_if_no_gimp(gimp,data) \
diff --git a/app/actions/context-commands.c b/app/actions/context-commands.c
index 1ec0d86..5ea918a 100644
--- a/app/actions/context-commands.c
+++ b/app/actions/context-commands.c
@@ -21,6 +21,7 @@
 
 #include <gtk/gtk.h>
 
+#include "libgimpbase/gimpbase.h"
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
@@ -43,6 +44,8 @@
 #include "actions.h"
 #include "context-commands.h"
 
+#include "gimp-intl.h"
+
 
 static const GimpLayerModeEffects paint_modes[] =
 {
@@ -392,6 +395,7 @@ context_paint_mode_cmd_callback (GtkAction *action,
                                  gpointer   data)
 {
   GimpContext          *context;
+  GimpToolInfo         *tool_info;
   GimpLayerModeEffects  paint_mode;
   gint                  index;
   return_if_no_context (context, data);
@@ -403,6 +407,25 @@ context_paint_mode_cmd_callback (GtkAction *action,
                                0, G_N_ELEMENTS (paint_modes) - 1, 0,
                                0.0, 1.0, 1.0, 0.0, FALSE);
   gimp_context_set_paint_mode (context, paint_modes[index]);
+
+  tool_info = gimp_context_get_tool (context);
+
+  if (tool_info && GIMP_IS_TOOL_OPTIONS (tool_info->tool_options))
+    {
+      GimpDisplay *display;
+      char        *value_desc;
+
+      gimp_enum_get_value (GIMP_TYPE_LAYER_MODE_EFFECTS, index,
+                           NULL, NULL, &value_desc, NULL);
+
+      display = action_data_get_display (data);
+
+      if (value_desc && display)
+        {
+          action_message (display, G_OBJECT (tool_info->tool_options),
+                          _("Paint Mode: %s"), value_desc);
+        }
+    }
 }
 
 void
@@ -512,9 +535,21 @@ context_brush_shape_cmd_callback (GtkAction *action,
   if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
     {
       GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
+      GimpDisplay        *display;
+      char               *value_desc;
 
       gimp_brush_generated_set_shape (generated,
                                       (GimpBrushGeneratedShape) value);
+
+      gimp_enum_get_value (GIMP_TYPE_BRUSH_GENERATED_SHAPE, value,
+                           NULL, NULL, &value_desc, NULL);
+      display = action_data_get_display (data);
+
+      if (value_desc && display)
+        {
+          action_message (display, G_OBJECT (brush),
+                          _("Brush Shape: %s"), value_desc);
+        }
     }
 }
 
@@ -532,6 +567,7 @@ context_brush_radius_cmd_callback (GtkAction *action,
   if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
     {
       GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
+      GimpDisplay        *display;
       gdouble             radius;
       gdouble             min_radius;
 
@@ -565,6 +601,14 @@ context_brush_radius_cmd_callback (GtkAction *action,
                                     min_radius, 4000.0, min_radius,
                                     0.1, 1.0, 10.0, 0.05, FALSE);
       gimp_brush_generated_set_radius (generated, radius);
+
+      display = action_data_get_display (data);
+
+      if (display)
+        {
+          action_message (action_data_get_display (data), G_OBJECT (brush),
+                          _("Brush Radius: %2.2f"), radius);
+        }
     }
 }
 
@@ -645,6 +689,7 @@ context_brush_angle_cmd_callback (GtkAction *action,
   if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
     {
       GimpBrushGenerated *generated = GIMP_BRUSH_GENERATED (brush);
+      GimpDisplay        *display;
       gdouble             angle;
 
       angle = gimp_brush_generated_get_angle (generated);
@@ -660,6 +705,14 @@ context_brush_angle_cmd_callback (GtkAction *action,
                                      0.1, 1.0, 15.0, 0.0, TRUE);
 
       gimp_brush_generated_set_angle (generated, angle);
+
+      display = action_data_get_display (data);
+
+      if (display)
+        {
+          action_message (action_data_get_display (data), G_OBJECT (brush),
+                          _("Brush Angle: %2.2f"), angle);
+        }
     }
 }
 
diff --git a/app/tools/gimpcoloroptions.c b/app/tools/gimpcoloroptions.c
index 64d56ea..fe50582 100644
--- a/app/tools/gimpcoloroptions.c
+++ b/app/tools/gimpcoloroptions.c
@@ -71,7 +71,8 @@ gimp_color_options_class_init (GimpColorOptionsClass *klass)
                                     TRUE,
                                     GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_AVERAGE_RADIUS,
-                                   "average-radius", NULL,
+                                   "average-radius",
+                                   _("Color Picker Average Radius"),
                                    1.0, 300.0, 3.0,
                                    GIMP_PARAM_STATIC_STRINGS);
 }



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