gimp r24779 - in trunk: . app/tools



Author: mitch
Date: Sun Feb  3 23:53:00 2008
New Revision: 24779
URL: http://svn.gnome.org/viewvc/gimp?rev=24779&view=rev

Log:
2008-02-04  Michael Natterer  <mitch gimp org>

	* app/tools/gimplevelstool.[ch]
	* app/tools/gimpcurvestool.[ch]: remove boolean "color" and "alpha"
	members from the tool structs and ask the drawable instead when
	needed.



Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpcurvestool.c
   trunk/app/tools/gimpcurvestool.h
   trunk/app/tools/gimplevelstool.c
   trunk/app/tools/gimplevelstool.h

Modified: trunk/app/tools/gimpcurvestool.c
==============================================================================
--- trunk/app/tools/gimpcurvestool.c	(original)
+++ trunk/app/tools/gimpcurvestool.c	Sun Feb  3 23:53:00 2008
@@ -224,9 +224,6 @@
   if (! c_tool->hist)
     c_tool->hist = gimp_histogram_new ();
 
-  c_tool->color = gimp_drawable_is_rgb (drawable);
-  c_tool->alpha = gimp_drawable_has_alpha (drawable);
-
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
   /*  always pick colors  */
@@ -234,7 +231,7 @@
                           GIMP_COLOR_TOOL_GET_OPTIONS (tool));
 
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
-                                      curves_menu_sensitivity, c_tool, NULL);
+                                      curves_menu_sensitivity, drawable, NULL);
 
   gimp_drawable_calculate_histogram (drawable, c_tool->hist);
   gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
@@ -401,15 +398,17 @@
 static void
 gimp_curves_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
+  GimpCurvesTool *tool     = GIMP_CURVES_TOOL (image_map_tool);
+  GimpDrawable   *drawable = image_map_tool->drawable;
   Curves          curves;
 
-  gimp_curves_config_to_cruft (tool->config, &curves, tool->color);
+  gimp_curves_config_to_cruft (tool->config, &curves,
+                               gimp_drawable_is_rgb (drawable));
 
   gimp_lut_setup (tool->lut,
                   (GimpLutFunc) curves_lut_func,
                   &curves,
-                  gimp_drawable_bytes (image_map_tool->drawable));
+                  gimp_drawable_bytes (drawable));
 }
 
 
@@ -716,8 +715,8 @@
 curves_menu_sensitivity (gint      value,
                          gpointer  data)
 {
-  GimpCurvesTool       *tool    = GIMP_CURVES_TOOL (data);
-  GimpHistogramChannel  channel = value;
+  GimpDrawable         *drawable = GIMP_DRAWABLE (data);
+  GimpHistogramChannel  channel  = value;
 
   switch (channel)
     {
@@ -727,10 +726,10 @@
     case GIMP_HISTOGRAM_RED:
     case GIMP_HISTOGRAM_GREEN:
     case GIMP_HISTOGRAM_BLUE:
-      return tool->color;
+      return gimp_drawable_is_rgb (drawable);
 
     case GIMP_HISTOGRAM_ALPHA:
-      return tool->alpha;
+      return gimp_drawable_has_alpha (drawable);
 
     case GIMP_HISTOGRAM_RGB:
       return FALSE;

Modified: trunk/app/tools/gimpcurvestool.h
==============================================================================
--- trunk/app/tools/gimpcurvestool.h	(original)
+++ trunk/app/tools/gimpcurvestool.h	Sun Feb  3 23:53:00 2008
@@ -41,13 +41,10 @@
   GimpLut              *lut;
 
   /* dialog */
-  gboolean              color;
-  gboolean              alpha;
+  GimpHistogram        *hist;
 
   gint                  col_value[5];
 
-  GimpHistogram        *hist;
-
   GtkWidget            *channel_menu;
   GtkWidget            *xrange;
   GtkWidget            *yrange;

Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c	(original)
+++ trunk/app/tools/gimplevelstool.c	Sun Feb  3 23:53:00 2008
@@ -223,9 +223,6 @@
   if (! l_tool->hist)
     l_tool->hist = gimp_histogram_new ();
 
-  l_tool->color = gimp_drawable_is_rgb (drawable);
-  l_tool->alpha = gimp_drawable_has_alpha (drawable);
-
   if (l_tool->active_picker)
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l_tool->active_picker),
                                   FALSE);
@@ -233,7 +230,7 @@
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
-                                      levels_menu_sensitivity, l_tool, NULL);
+                                      levels_menu_sensitivity, drawable, NULL);
 
   gimp_drawable_calculate_histogram (drawable, l_tool->hist);
   gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->hist_view),
@@ -271,15 +268,17 @@
 static void
 gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpLevelsTool *tool     = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpDrawable   *drawable = image_map_tool->drawable;
   Levels          levels;
 
-  gimp_levels_config_to_cruft (tool->config, &levels, tool->color);
+  gimp_levels_config_to_cruft (tool->config, &levels,
+                               gimp_drawable_is_rgb (drawable));
 
   gimp_lut_setup (tool->lut,
                   (GimpLutFunc) levels_lut_func,
                   &levels,
-                  gimp_drawable_bytes (image_map_tool->drawable));
+                  gimp_drawable_bytes (drawable));
 }
 
 
@@ -865,8 +864,8 @@
 levels_menu_sensitivity (gint      value,
                          gpointer  data)
 {
-  GimpLevelsTool       *tool    = GIMP_LEVELS_TOOL (data);
-  GimpHistogramChannel  channel = value;
+  GimpDrawable         *drawable = GIMP_DRAWABLE (data);
+  GimpHistogramChannel  channel  = value;
 
   switch (channel)
     {
@@ -876,10 +875,10 @@
     case GIMP_HISTOGRAM_RED:
     case GIMP_HISTOGRAM_GREEN:
     case GIMP_HISTOGRAM_BLUE:
-      return tool->color;
+      return gimp_drawable_is_rgb (drawable);
 
     case GIMP_HISTOGRAM_ALPHA:
-      return tool->alpha;
+      return gimp_drawable_has_alpha (drawable);
 
     case GIMP_HISTOGRAM_RGB:
       return FALSE;
@@ -892,7 +891,10 @@
 levels_stretch_callback (GtkWidget      *widget,
                          GimpLevelsTool *tool)
 {
-  gimp_levels_config_stretch (tool->config, tool->hist, tool->color);
+  GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
+
+  gimp_levels_config_stretch (tool->config, tool->hist,
+                              gimp_drawable_is_rgb (drawable));
 }
 
 static void

Modified: trunk/app/tools/gimplevelstool.h
==============================================================================
--- trunk/app/tools/gimplevelstool.h	(original)
+++ trunk/app/tools/gimplevelstool.h	Sun Feb  3 23:53:00 2008
@@ -42,9 +42,6 @@
   GimpLut              *lut;
 
   /* dialog */
-  gboolean              color;
-  gboolean              alpha;
-
   GimpHistogram        *hist;
 
   GtkWidget            *channel_menu;



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