[gimp] app: Add API to remove all background curves from the curve view



commit 45c835aaa251b3c1ce1b9944d555616022129b05
Author: Alexia Death <alexiadeath gmail com>
Date:   Sat Feb 27 19:03:40 2010 +0200

    app: Add API to remove all background curves from the curve view
    
    Also, use this change in cuves tool.

 app/tools/gimpcurvestool.c  |    7 +------
 app/widgets/gimpcurveview.c |   21 +++++++++++++++++++++
 app/widgets/gimpcurveview.h |    2 ++
 3 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index a455a9d..6a77e8d 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -785,12 +785,7 @@ gimp_curves_tool_config_notify (GObject        *object,
       gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
                                   config->channel);
 
-      gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph),
-                                         config->curve[GIMP_HISTOGRAM_RED]);
-      gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph),
-                                         config->curve[GIMP_HISTOGRAM_GREEN]);
-      gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph),
-                                         config->curve[GIMP_HISTOGRAM_BLUE]);
+      gimp_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph));
 
       gimp_rgb_set (&red,   1.0, 0.0, 0.0);
       gimp_rgb_set (&green, 0.0, 1.0, 0.0);
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 97706c3..2e31dc1 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -1189,6 +1189,27 @@ gimp_curve_view_remove_background (GimpCurveView *view,
 }
 
 void
+gimp_curve_view_remove_all_backgrounds (GimpCurveView *view)
+{
+  GList *list;
+
+  g_return_if_fail (GIMP_IS_CURVE_VIEW (view));
+
+  for (list = view->bg_curves; list; list = g_list_next (list))
+    {
+      BGCurve *bg = list->data;
+
+      g_object_unref (bg->curve);
+
+      view->bg_curves = g_list_remove (view->bg_curves, bg);
+
+      g_slice_free (BGCurve, bg);
+    }
+
+  gtk_widget_queue_draw (GTK_WIDGET (view));
+}
+
+void
 gimp_curve_view_set_selected (GimpCurveView *view,
                               gint           selected)
 {
diff --git a/app/widgets/gimpcurveview.h b/app/widgets/gimpcurveview.h
index 1fe6a4a..58a3de0 100644
--- a/app/widgets/gimpcurveview.h
+++ b/app/widgets/gimpcurveview.h
@@ -93,6 +93,8 @@ void        gimp_curve_view_add_background    (GimpCurveView *view,
 void        gimp_curve_view_remove_background (GimpCurveView *view,
                                                GimpCurve     *curve);
 
+void   gimp_curve_view_remove_all_backgrounds (GimpCurveView *view);
+
 void        gimp_curve_view_set_selected      (GimpCurveView *view,
                                                gint           selected);
 void        gimp_curve_view_set_range_x       (GimpCurveView *view,



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