1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
3  *
4  * gimppropgui-channel-mixer.c
5  * Copyright (C) 2002-2014  Michael Natterer <mitch@gimp.org>
6  *                          Sven Neumann <sven@gimp.org>
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #include "config.h"
23 
24 #include <gegl.h>
25 #include <gtk/gtk.h>
26 
27 #include "libgimpwidgets/gimpwidgets.h"
28 
29 #include "propgui-types.h"
30 
31 #include "core/gimpcontext.h"
32 
33 #include "gimppropgui.h"
34 #include "gimppropgui-channel-mixer.h"
35 
36 #include "gimp-intl.h"
37 
38 
39 GtkWidget *
_gimp_prop_gui_new_channel_mixer(GObject * config,GParamSpec ** param_specs,guint n_param_specs,GeglRectangle * area,GimpContext * context,GimpCreatePickerFunc create_picker_func,GimpCreateControllerFunc create_controller_func,gpointer creator)40 _gimp_prop_gui_new_channel_mixer (GObject                  *config,
41                                   GParamSpec              **param_specs,
42                                   guint                     n_param_specs,
43                                   GeglRectangle            *area,
44                                   GimpContext              *context,
45                                   GimpCreatePickerFunc      create_picker_func,
46                                   GimpCreateControllerFunc  create_controller_func,
47                                   gpointer                  creator)
48 {
49   GtkWidget   *main_vbox;
50   GtkWidget   *frame;
51   GtkWidget   *vbox;
52   GtkWidget   *checkbox;
53   GtkWidget   *scale;
54   const gchar *label;
55 
56   g_return_val_if_fail (G_IS_OBJECT (config), NULL);
57   g_return_val_if_fail (param_specs != NULL, NULL);
58   g_return_val_if_fail (n_param_specs > 0, NULL);
59   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
60 
61   main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
62 
63   frame = gimp_frame_new (_("Red channel"));
64   gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
65   gtk_widget_show (frame);
66 
67   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
68   gtk_container_add (GTK_CONTAINER (frame), vbox);
69   gtk_widget_show (vbox);
70 
71   scale = gimp_prop_widget_new (config, "rr-gain",
72                                 area, context, NULL, NULL, NULL, &label);
73   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
74   gtk_widget_show (scale);
75 
76   scale = gimp_prop_widget_new (config, "rg-gain",
77                                 area, context, NULL, NULL, NULL, &label);
78   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
79   gtk_widget_show (scale);
80 
81   scale = gimp_prop_widget_new (config, "rb-gain",
82                                 area, context, NULL, NULL, NULL, &label);
83   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
84   gtk_widget_show (scale);
85 
86 
87   frame = gimp_frame_new (_("Green channel"));
88   gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
89   gtk_widget_show (frame);
90 
91   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
92   gtk_container_add (GTK_CONTAINER (frame), vbox);
93   gtk_widget_show (vbox);
94 
95   scale = gimp_prop_widget_new (config, "gr-gain",
96                                 area, context, NULL, NULL, NULL, &label);
97   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
98   gtk_widget_show (scale);
99 
100   scale = gimp_prop_widget_new (config, "gg-gain",
101                                 area, context, NULL, NULL, NULL, &label);
102   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
103   gtk_widget_show (scale);
104 
105   scale = gimp_prop_widget_new (config, "gb-gain",
106                                 area, context, NULL, NULL, NULL, &label);
107   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
108   gtk_widget_show (scale);
109 
110 
111   frame = gimp_frame_new (_("Blue channel"));
112   gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
113   gtk_widget_show (frame);
114 
115   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
116   gtk_container_add (GTK_CONTAINER (frame), vbox);
117   gtk_widget_show (vbox);
118 
119   scale = gimp_prop_widget_new (config, "br-gain",
120                                 area, context, NULL, NULL, NULL, &label);
121   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
122   gtk_widget_show (scale);
123 
124   scale = gimp_prop_widget_new (config, "bg-gain",
125                                 area, context, NULL, NULL, NULL, &label);
126   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
127   gtk_widget_show (scale);
128 
129   scale = gimp_prop_widget_new (config, "bb-gain",
130                                 area, context, NULL, NULL, NULL, &label);
131   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
132   gtk_widget_show (scale);
133 
134 
135   checkbox = gimp_prop_widget_new (config, "preserve-luminosity",
136                                    area, context, NULL, NULL, NULL, &label);
137   gtk_box_pack_start (GTK_BOX (main_vbox), checkbox, FALSE, FALSE, 0);
138   gtk_widget_show (checkbox);
139 
140   return main_vbox;
141 }
142