[gimp] app: replace the color balance tool by a generic filter action
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: replace the color balance tool by a generic filter action
- Date: Sun, 4 Jun 2017 23:21:06 +0000 (UTC)
commit 757ca64e584aebff9fb797842cfa32031d37c87a
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 5 01:16:50 2017 +0200
app: replace the color balance tool by a generic filter action
Move the color balance GUI to a custom gimppropgui function.
app/actions/filters-actions.c | 6 +
app/tools/Makefile.am | 2 -
app/tools/gimp-tools.c | 2 -
app/tools/gimpcolorbalancetool.c | 275 -------------------------------
app/tools/gimpcolorbalancetool.h | 54 ------
app/widgets/Makefile.am | 2 +
app/widgets/gimppropgui-color-balance.c | 144 ++++++++++++++++
app/widgets/gimppropgui-color-balance.h | 34 ++++
app/widgets/gimppropgui.c | 3 +
menus/image-menu.xml.in | 2 +-
po/POTFILES.in | 2 +-
11 files changed, 191 insertions(+), 335 deletions(-)
---
diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index b88c3d0..800202d 100644
--- a/app/actions/filters-actions.c
+++ b/app/actions/filters-actions.c
@@ -208,6 +208,11 @@ static const GimpStringActionEntry filters_interactive_actions[] =
"gegl:checkerboard",
GIMP_HELP_FILTER_CHECKERBOARD },
+ { "filters-color-balance", GIMP_ICON_TOOL_COLOR_BALANCE,
+ NC_("filters-action", "Color _Balance..."), NULL, NULL,
+ "gimp:color-balance",
+ GIMP_HELP_TOOL_COLOR_BALANCE },
+
{ "filters-color-exchange", GIMP_ICON_GEGL,
NC_("filters-action", "_Color Exchange..."), NULL, NULL,
"gegl:color-exchange",
@@ -788,6 +793,7 @@ filters_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("filters-cartoon", writable);
SET_SENSITIVE ("filters-channel-mixer", writable);
SET_SENSITIVE ("filters-checkerboard", writable);
+ SET_SENSITIVE ("filters-color-balance", writable && !gray);
SET_SENSITIVE ("filters-color-enhance", writable && !gray);
SET_SENSITIVE ("filters-color-exchange", writable);
SET_SENSITIVE ("filters-colorize", writable && !gray);
diff --git a/app/tools/Makefile.am b/app/tools/Makefile.am
index 46441fb..1fbe7b6 100644
--- a/app/tools/Makefile.am
+++ b/app/tools/Makefile.am
@@ -52,8 +52,6 @@ libapptools_a_sources = \
gimpcoloroptions.h \
gimpcolortool.c \
gimpcolortool.h \
- gimpcolorbalancetool.c \
- gimpcolorbalancetool.h \
gimpcolorpickeroptions.c \
gimpcolorpickeroptions.h \
gimpcolorpickertool.c \
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 69ee5ba..f7c31ea 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -46,7 +46,6 @@
#include "gimpbycolorselecttool.h"
#include "gimpcagetool.h"
#include "gimpclonetool.h"
-#include "gimpcolorbalancetool.h"
#include "gimpcolorpickertool.h"
#include "gimpconvolvetool.h"
#include "gimpcroptool.h"
@@ -176,7 +175,6 @@ gimp_tools_init (Gimp *gimp)
/* color tools */
- gimp_color_balance_tool_register,
gimp_hue_saturation_tool_register,
gimp_brightness_contrast_tool_register,
gimp_threshold_tool_register,
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index 625bdee..bea5220 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -301,6 +301,8 @@ libappwidgets_a_sources = \
gimpprogressdialog.h \
gimppropgui.c \
gimppropgui.h \
+ gimppropgui-color-balance.c \
+ gimppropgui-color-balance.h \
gimppropgui-constructors.c \
gimppropgui-constructors.h \
gimppropgui-eval.c \
diff --git a/app/widgets/gimppropgui-color-balance.c b/app/widgets/gimppropgui-color-balance.c
new file mode 100644
index 0000000..ea4fbf8
--- /dev/null
+++ b/app/widgets/gimppropgui-color-balance.c
@@ -0,0 +1,144 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-color-balance.c
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gegl-paramspecs.h>
+#include <gtk/gtk.h>
+
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpbase/gimpbase.h"
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "operations/gimpcolorbalanceconfig.h"
+
+#include "gimppropgui.h"
+#include "gimppropgui-color-balance.h"
+#include "gimppropwidgets.h"
+#include "gimpspinscale.h"
+
+#include "gimp-intl.h"
+
+
+static void
+create_levels_scale (GObject *config,
+ const gchar *property_name,
+ const gchar *left,
+ const gchar *right,
+ GtkWidget *table,
+ gint col)
+{
+ GtkWidget *label;
+ GtkWidget *scale;
+
+ label = gtk_label_new (left);
+ gtk_label_set_xalign (GTK_LABEL (label), 1.0);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, col, col + 1,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ scale = gimp_prop_spin_scale_new (config, property_name,
+ NULL, 0.01, 0.1, 0);
+ gimp_spin_scale_set_label (GIMP_SPIN_SCALE (scale), NULL);
+ gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1);
+ gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, col, col + 1);
+ gtk_widget_show (scale);
+
+ label = gtk_label_new (right);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_table_attach (GTK_TABLE (table), label, 2, 3, col, col + 1,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+}
+
+GtkWidget *
+_gimp_prop_gui_new_color_balance (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator)
+{
+ GtkWidget *main_vbox;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *table;
+ GtkWidget *button;
+ GtkWidget *frame;
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+
+ frame = gimp_prop_enum_radio_frame_new (config, "range",
+ _("Select Range to Adjust"),
+ 0, 0);
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ frame = gimp_frame_new (_("Adjust Color Levels"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ /* The table containing sliders */
+ table = gtk_table_new (3, 3, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 2);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
+ create_levels_scale (config, "cyan-red",
+ _("Cyan"), _("Red"),
+ table, 0);
+
+ create_levels_scale (config, "magenta-green",
+ _("Magenta"), _("Green"),
+ table, 1);
+
+ create_levels_scale (config, "yellow-blue",
+ _("Yellow"), _("Blue"),
+ table, 2);
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ button = gtk_button_new_with_mnemonic (_("R_eset Range"));
+ gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_color_balance_config_reset_range),
+ config);
+
+ button = gimp_prop_check_button_new (config,
+ "preserve-luminosity",
+ _("Preserve _luminosity"));
+ gtk_box_pack_end (GTK_BOX (main_vbox), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ return main_vbox;
+}
diff --git a/app/widgets/gimppropgui-color-balance.h b/app/widgets/gimppropgui-color-balance.h
new file mode 100644
index 0000000..ff3dbe8
--- /dev/null
+++ b/app/widgets/gimppropgui-color-balance.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-color-balance.h
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PROP_GUI_COLOR_BALANCE_H__
+#define __GIMP_PROP_GUI_COLOR_BALANCE_H__
+
+
+GtkWidget *
+_gimp_prop_gui_new_color_balance (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator);
+
+
+#endif /* __GIMP_PROP_GUI_COLOR_BALANCE_H__ */
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index 514b54a..48723cb 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -43,6 +43,7 @@
#include "gimpmessagebox.h"
#include "gimpspinscale.h"
#include "gimppropgui.h"
+#include "gimppropgui-color-balance.h"
#include "gimppropgui-constructors.h"
#include "gimppropgui-eval.h"
#include "gimppropwidgets.h"
@@ -431,6 +432,8 @@ static const struct
gui_new_funcs[] =
{
+ { "GimpColorBalanceConfig",
+ _gimp_prop_gui_new_color_balance },
{ "GimpGegl-gegl-color-rotate-config",
_gimp_prop_gui_new_color_rotate },
{ "GimpGegl-gegl-convolution-matrix-config",
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 66a8c62..8c86f30 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -556,7 +556,7 @@
</menu>
<menu action="colors-menu" name="Colors">
- <menuitem action="tools-color-balance" />
+ <menuitem action="filters-color-balance" />
<menuitem action="filters-color-temperature" />
<menuitem action="filters-hue-chroma" />
<menuitem action="tools-hue-saturation" />
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 49d9d59..da5e879 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -381,7 +381,6 @@ app/tools/gimpcageoptions.c
app/tools/gimpcagetool.c
app/tools/gimpcloneoptions-gui.c
app/tools/gimpclonetool.c
-app/tools/gimpcolorbalancetool.c
app/tools/gimpcoloroptions.c
app/tools/gimpcolorpickeroptions.c
app/tools/gimpcolorpickertool.c
@@ -537,6 +536,7 @@ app/widgets/gimppdbdialog.c
app/widgets/gimppickablepopup.c
app/widgets/gimppluginview.c
app/widgets/gimpprogressdialog.c
+app/widgets/gimppropgui-color-balance.c
app/widgets/gimppropgui-constructors.c
app/widgets/gimppropgui.c
app/widgets/gimppropwidgets.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]