[gimp] app: move all custom gimppropgui constructors to their own files
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move all custom gimppropgui constructors to their own files
- Date: Mon, 5 Jun 2017 11:10:23 +0000 (UTC)
commit 9e1aee48c501dc9d3010340aed31479980e15ad0
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 5 02:26:30 2017 +0200
app: move all custom gimppropgui constructors to their own files
app/widgets/Makefile.am | 8 +
app/widgets/gimppropgui-channel-mixer.c | 140 ++++++
app/widgets/gimppropgui-channel-mixer.h | 34 ++
app/widgets/gimppropgui-color-balance.c | 11 +-
app/widgets/gimppropgui-color-rotate.c | 256 ++++++++++
app/widgets/gimppropgui-color-rotate.h | 34 ++
app/widgets/gimppropgui-constructors.c | 646 -------------------------
app/widgets/gimppropgui-constructors.h | 35 --
app/widgets/gimppropgui-convolution-matrix.c | 304 ++++++++++++
app/widgets/gimppropgui-convolution-matrix.h | 34 ++
app/widgets/gimppropgui-diffration-patterns.c | 96 ++++
app/widgets/gimppropgui-diffration-patterns.h | 34 ++
app/widgets/gimppropgui.c | 4 +
po/POTFILES.in | 4 +
14 files changed, 955 insertions(+), 685 deletions(-)
---
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index bea5220..241762a 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -301,10 +301,18 @@ libappwidgets_a_sources = \
gimpprogressdialog.h \
gimppropgui.c \
gimppropgui.h \
+ gimppropgui-channel-mixer.c \
+ gimppropgui-channel-mixer.h \
gimppropgui-color-balance.c \
gimppropgui-color-balance.h \
+ gimppropgui-color-rotate.c \
+ gimppropgui-color-rotate.h \
gimppropgui-constructors.c \
gimppropgui-constructors.h \
+ gimppropgui-convolution-matrix.c \
+ gimppropgui-convolution-matrix.h \
+ gimppropgui-diffration-patterns.c \
+ gimppropgui-diffration-patterns.h \
gimppropgui-eval.c \
gimppropgui-eval.h \
gimppropwidgets.c \
diff --git a/app/widgets/gimppropgui-channel-mixer.c b/app/widgets/gimppropgui-channel-mixer.c
new file mode 100644
index 0000000..2535325
--- /dev/null
+++ b/app/widgets/gimppropgui-channel-mixer.c
@@ -0,0 +1,140 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-channel-mixer.c
+ * Copyright (C) 2002-2014 Michael Natterer <mitch gimp org>
+ * Sven Neumann <sven gimp org>
+ *
+ * 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 <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "core/gimpcontext.h"
+
+#include "gimppropgui.h"
+#include "gimppropgui-channel-mixer.h"
+
+#include "gimp-intl.h"
+
+
+GtkWidget *
+_gimp_prop_gui_new_channel_mixer (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator)
+{
+ GtkWidget *main_vbox;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *checkbox;
+ GtkWidget *scale;
+ const gchar *label;
+
+ g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+ g_return_val_if_fail (param_specs != NULL, NULL);
+ g_return_val_if_fail (n_param_specs > 0, NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+
+ frame = gimp_frame_new (_("Red channel"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ scale = gimp_prop_widget_new (config, "rr-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "rg-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "rb-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+
+ frame = gimp_frame_new (_("Green channel"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ scale = gimp_prop_widget_new (config, "gr-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "gg-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "gb-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+
+ frame = gimp_frame_new (_("Blue channel"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ scale = gimp_prop_widget_new (config, "br-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "bg-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "bb-gain",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+
+ checkbox = gimp_prop_widget_new (config, "preserve-luminosity",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (main_vbox), checkbox, FALSE, FALSE, 0);
+ gtk_widget_show (checkbox);
+
+ return main_vbox;
+}
diff --git a/app/widgets/gimppropgui-channel-mixer.h b/app/widgets/gimppropgui-channel-mixer.h
new file mode 100644
index 0000000..9c603cb
--- /dev/null
+++ b/app/widgets/gimppropgui-channel-mixer.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-channel-mixer.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_CHANNEL_MIXER_H__
+#define __GIMP_PROP_GUI_CHANNEL_MIXER_H__
+
+
+GtkWidget *
+_gimp_prop_gui_new_channel_mixer (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator);
+
+
+#endif /* __GIMP_PROP_GUI_CHANNEL_MIXER_H__ */
diff --git a/app/widgets/gimppropgui-color-balance.c b/app/widgets/gimppropgui-color-balance.c
index ea4fbf8..7cb47d4 100644
--- a/app/widgets/gimppropgui-color-balance.c
+++ b/app/widgets/gimppropgui-color-balance.c
@@ -20,18 +20,16 @@
#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 "core/gimpcontext.h"
+
#include "gimppropgui.h"
#include "gimppropgui-color-balance.h"
#include "gimppropwidgets.h"
@@ -87,6 +85,11 @@ _gimp_prop_gui_new_color_balance (GObject *config,
GtkWidget *button;
GtkWidget *frame;
+ g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+ g_return_val_if_fail (param_specs != NULL, NULL);
+ g_return_val_if_fail (n_param_specs > 0, NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
frame = gimp_prop_enum_radio_frame_new (config, "range",
diff --git a/app/widgets/gimppropgui-color-rotate.c b/app/widgets/gimppropgui-color-rotate.c
new file mode 100644
index 0000000..0a5870d
--- /dev/null
+++ b/app/widgets/gimppropgui-color-rotate.c
@@ -0,0 +1,256 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-color-rotate.c
+ * Copyright (C) 2002-2014 Michael Natterer <mitch gimp org>
+ * Sven Neumann <sven gimp org>
+ *
+ * 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 <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "core/gimpcontext.h"
+
+#include "gimppropgui.h"
+#include "gimppropgui-color-rotate.h"
+#include "gimppropgui-constructors.h"
+#include "gimppropwidgets.h"
+
+#include "gimp-intl.h"
+
+
+static void
+invert_segment_clicked (GtkWidget *button,
+ GtkWidget *dial)
+{
+ gdouble alpha, beta;
+ gboolean clockwise;
+
+ g_object_get (dial,
+ "alpha", &alpha,
+ "beta", &beta,
+ "clockwise", &clockwise,
+ NULL);
+
+ g_object_set (dial,
+ "alpha", beta,
+ "beta", alpha,
+ "clockwise", ! clockwise,
+ NULL);
+}
+
+static void
+select_all_clicked (GtkWidget *button,
+ GtkWidget *dial)
+{
+ gdouble alpha, beta;
+ gboolean clockwise;
+
+ g_object_get (dial,
+ "alpha", &alpha,
+ "clockwise", &clockwise,
+ NULL);
+
+ beta = alpha - (clockwise ? -1 : 1) * 0.00001;
+
+ if (beta < 0)
+ beta += 2 * G_PI;
+
+ if (beta > 2 * G_PI)
+ beta -= 2 * G_PI;
+
+ g_object_set (dial,
+ "beta", beta,
+ NULL);
+}
+
+static GtkWidget *
+gimp_prop_angle_range_box_new (GObject *config,
+ const gchar *alpha_property_name,
+ const gchar *beta_property_name,
+ const gchar *clockwise_property_name)
+{
+ GtkWidget *main_hbox;
+ GtkWidget *vbox;
+ GtkWidget *scale;
+ GtkWidget *hbox;
+ GtkWidget *button;
+ GtkWidget *invert_button;
+ GtkWidget *all_button;
+ GtkWidget *dial;
+
+ main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+ gtk_box_pack_start (GTK_BOX (main_hbox), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
+
+ scale = gimp_prop_spin_scale_new (config, alpha_property_name, NULL,
+ 1.0, 15.0, 2);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_spin_scale_new (config, beta_property_name, NULL,
+ 1.0, 15.0, 2);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ button = gimp_prop_check_button_new (config, clockwise_property_name,
+ _("Clockwise"));
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_show (button);
+
+ invert_button = gtk_button_new_with_label (_("Invert Range"));
+ gtk_box_pack_start (GTK_BOX (hbox), invert_button, TRUE, TRUE, 0);
+ gtk_widget_show (invert_button);
+
+ all_button = gtk_button_new_with_label (_("Select All"));
+ gtk_box_pack_start (GTK_BOX (hbox), all_button, TRUE, TRUE, 0);
+ gtk_widget_show (all_button);
+
+ dial = gimp_prop_angle_range_dial_new (config,
+ alpha_property_name,
+ beta_property_name,
+ clockwise_property_name);
+ gtk_box_pack_start (GTK_BOX (main_hbox), dial, FALSE, FALSE, 0);
+ gtk_widget_show (dial);
+
+ g_signal_connect (invert_button, "clicked",
+ G_CALLBACK (invert_segment_clicked),
+ dial);
+
+ g_signal_connect (all_button, "clicked",
+ G_CALLBACK (select_all_clicked),
+ dial);
+
+ return main_hbox;
+}
+
+static GtkWidget *
+gimp_prop_polar_box_new (GObject *config,
+ const gchar *angle_property_name,
+ const gchar *radius_property_name)
+{
+ GtkWidget *main_hbox;
+ GtkWidget *vbox;
+ GtkWidget *scale;
+ GtkWidget *polar;
+
+ main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+ gtk_box_pack_start (GTK_BOX (main_hbox), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
+
+ scale = gimp_prop_spin_scale_new (config, angle_property_name, NULL,
+ 1.0, 15.0, 2);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_spin_scale_new (config, radius_property_name, NULL,
+ 1.0, 15.0, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
+
+ polar = gimp_prop_polar_new (config,
+ angle_property_name,
+ radius_property_name);
+ gtk_box_pack_start (GTK_BOX (main_hbox), polar, FALSE, FALSE, 0);
+ gtk_widget_show (polar);
+
+ return main_hbox;
+}
+
+GtkWidget *
+_gimp_prop_gui_new_color_rotate (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator)
+{
+ GtkWidget *main_vbox;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *box;
+
+ g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+ g_return_val_if_fail (param_specs != NULL, NULL);
+ g_return_val_if_fail (n_param_specs > 0, NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
+
+ frame = gimp_frame_new (_("Source Range"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ box = gimp_prop_angle_range_box_new (config,
+ param_specs[1]->name,
+ param_specs[2]->name,
+ param_specs[0]->name);
+ gtk_container_add (GTK_CONTAINER (frame), box);
+ gtk_widget_show (box);
+
+ frame = gimp_frame_new (_("Destination Range"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ box = gimp_prop_angle_range_box_new (config,
+ param_specs[4]->name,
+ param_specs[5]->name,
+ param_specs[3]->name);
+ gtk_container_add (GTK_CONTAINER (frame), box);
+ gtk_widget_show (box);
+
+ frame = gimp_frame_new (_("Gray Handling"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ box = _gimp_prop_gui_new_generic (config,
+ param_specs + 6, 2,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
+ gtk_widget_show (box);
+
+ box = gimp_prop_polar_box_new (config,
+ param_specs[8]->name,
+ param_specs[9]->name);
+ gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
+ gtk_widget_show (box);
+
+ return main_vbox;
+}
diff --git a/app/widgets/gimppropgui-color-rotate.h b/app/widgets/gimppropgui-color-rotate.h
new file mode 100644
index 0000000..ba54b9c
--- /dev/null
+++ b/app/widgets/gimppropgui-color-rotate.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-color-rotate.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_ROTATE_H__
+#define __GIMP_PROP_GUI_COLOR_ROTATE_H__
+
+
+GtkWidget *
+_gimp_prop_gui_new_color_rotate (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_ROTATE_H__ */
diff --git a/app/widgets/gimppropgui-constructors.c b/app/widgets/gimppropgui-constructors.c
index 10f4fa3..c5614ad 100644
--- a/app/widgets/gimppropgui-constructors.c
+++ b/app/widgets/gimppropgui-constructors.c
@@ -252,652 +252,6 @@ _gimp_prop_gui_new_generic (GObject *config,
return main_vbox;
}
-static void
-invert_segment_clicked (GtkWidget *button,
- GtkWidget *dial)
-{
- gdouble alpha, beta;
- gboolean clockwise;
-
- g_object_get (dial,
- "alpha", &alpha,
- "beta", &beta,
- "clockwise", &clockwise,
- NULL);
-
- g_object_set (dial,
- "alpha", beta,
- "beta", alpha,
- "clockwise", ! clockwise,
- NULL);
-}
-
-static void
-select_all_clicked (GtkWidget *button,
- GtkWidget *dial)
-{
- gdouble alpha, beta;
- gboolean clockwise;
-
- g_object_get (dial,
- "alpha", &alpha,
- "clockwise", &clockwise,
- NULL);
-
- beta = alpha - (clockwise ? -1 : 1) * 0.00001;
-
- if (beta < 0)
- beta += 2 * G_PI;
-
- if (beta > 2 * G_PI)
- beta -= 2 * G_PI;
-
- g_object_set (dial,
- "beta", beta,
- NULL);
-}
-
-static GtkWidget *
-gimp_prop_angle_range_box_new (GObject *config,
- const gchar *alpha_property_name,
- const gchar *beta_property_name,
- const gchar *clockwise_property_name)
-{
- GtkWidget *main_hbox;
- GtkWidget *vbox;
- GtkWidget *scale;
- GtkWidget *hbox;
- GtkWidget *button;
- GtkWidget *invert_button;
- GtkWidget *all_button;
- GtkWidget *dial;
-
- main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_pack_start (GTK_BOX (main_hbox), vbox, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- scale = gimp_prop_spin_scale_new (config, alpha_property_name, NULL,
- 1.0, 15.0, 2);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_spin_scale_new (config, beta_property_name, NULL,
- 1.0, 15.0, 2);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- button = gimp_prop_check_button_new (config, clockwise_property_name,
- _("Clockwise"));
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- invert_button = gtk_button_new_with_label (_("Invert Range"));
- gtk_box_pack_start (GTK_BOX (hbox), invert_button, TRUE, TRUE, 0);
- gtk_widget_show (invert_button);
-
- all_button = gtk_button_new_with_label (_("Select All"));
- gtk_box_pack_start (GTK_BOX (hbox), all_button, TRUE, TRUE, 0);
- gtk_widget_show (all_button);
-
- dial = gimp_prop_angle_range_dial_new (config,
- alpha_property_name,
- beta_property_name,
- clockwise_property_name);
- gtk_box_pack_start (GTK_BOX (main_hbox), dial, FALSE, FALSE, 0);
- gtk_widget_show (dial);
-
- g_signal_connect (invert_button, "clicked",
- G_CALLBACK (invert_segment_clicked),
- dial);
-
- g_signal_connect (all_button, "clicked",
- G_CALLBACK (select_all_clicked),
- dial);
-
- return main_hbox;
-}
-
-static GtkWidget *
-gimp_prop_polar_box_new (GObject *config,
- const gchar *angle_property_name,
- const gchar *radius_property_name)
-{
- GtkWidget *main_hbox;
- GtkWidget *vbox;
- GtkWidget *scale;
- GtkWidget *polar;
-
- main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_pack_start (GTK_BOX (main_hbox), vbox, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- scale = gimp_prop_spin_scale_new (config, angle_property_name, NULL,
- 1.0, 15.0, 2);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (scale), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_spin_scale_new (config, radius_property_name, NULL,
- 1.0, 15.0, 2);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- polar = gimp_prop_polar_new (config,
- angle_property_name,
- radius_property_name);
- gtk_box_pack_start (GTK_BOX (main_hbox), polar, FALSE, FALSE, 0);
- gtk_widget_show (polar);
-
- return main_hbox;
-}
-
-GtkWidget *
-_gimp_prop_gui_new_color_rotate (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator)
-{
- GtkWidget *main_vbox;
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *box;
-
- g_return_val_if_fail (G_IS_OBJECT (config), NULL);
- g_return_val_if_fail (param_specs != NULL, NULL);
- g_return_val_if_fail (n_param_specs > 0, NULL);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
-
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
-
- frame = gimp_frame_new (_("Source Range"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- box = gimp_prop_angle_range_box_new (config,
- param_specs[1]->name,
- param_specs[2]->name,
- param_specs[0]->name);
- gtk_container_add (GTK_CONTAINER (frame), box);
- gtk_widget_show (box);
-
- frame = gimp_frame_new (_("Destination Range"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- box = gimp_prop_angle_range_box_new (config,
- param_specs[4]->name,
- param_specs[5]->name,
- param_specs[3]->name);
- gtk_container_add (GTK_CONTAINER (frame), box);
- gtk_widget_show (box);
-
- frame = gimp_frame_new (_("Gray Handling"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- box = _gimp_prop_gui_new_generic (config,
- param_specs + 6, 2,
- area, context,
- create_picker_func, picker_creator);
- gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
- gtk_widget_show (box);
-
- box = gimp_prop_polar_box_new (config,
- param_specs[8]->name,
- param_specs[9]->name);
- gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
- gtk_widget_show (box);
-
- return main_vbox;
-}
-
-static const gchar *
-convolution_matrix_prop_name (gint x,
- gint y)
-{
- static const gchar * const prop_names[5][5] = {
- {"a1", "a2", "a3", "a4", "a5"},
- {"b1", "b2", "b3", "b4", "b5"},
- {"c1", "c2", "c3", "c4", "c5"},
- {"d1", "d2", "d3", "d4", "d5"},
- {"e1", "e2", "e3", "e4", "e5"}};
-
- return prop_names[x][y];
-}
-
-static void
-convolution_matrix_rotate_flip (GtkWidget *button,
- GObject *config)
-{
- gint rotate = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
- "convolution-matrix-rotate"));
- gint flip = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
- "convolution-matrix-flip"));
- gint x, y;
-
- while (rotate--)
- {
- for (y = 0; y < 2; y++)
- {
- for (x = y; x < 4 - y; x++)
- {
- gint i;
- gdouble temp;
-
- g_object_get (config,
- convolution_matrix_prop_name (x, y), &temp,
- NULL);
-
- for (i = 0; i < 4; i++)
- {
- gint next_x, next_y;
- gdouble val;
-
- next_x = 4 - y;
- next_y = x;
-
- if (i < 3)
- {
- g_object_get (config,
- convolution_matrix_prop_name (next_x, next_y), &val,
- NULL);
- }
- else
- {
- val = temp;
- }
-
- g_object_set (config,
- convolution_matrix_prop_name (x, y), val,
- NULL);
-
- x = next_x;
- y = next_y;
- }
- }
- }
- }
-
- while (flip--)
- {
- for (y = 0; y < 5; y++)
- {
- for (x = 0; x < 2; x++)
- {
- gdouble val1, val2;
-
- g_object_get (config,
- convolution_matrix_prop_name (x, y), &val1,
- NULL);
- g_object_get (config,
- convolution_matrix_prop_name (4 - x, y), &val2,
- NULL);
-
- g_object_set (config,
- convolution_matrix_prop_name (x, y), val2,
- NULL);
- g_object_set (config,
- convolution_matrix_prop_name (4 - x, y), val1,
- NULL);
- }
- }
- }
-}
-
-GtkWidget *
-_gimp_prop_gui_new_convolution_matrix (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 *table;
- GtkWidget *hbox;
- GtkWidget *scale;
- GtkWidget *vbox2;
- const gchar *label;
- gint x, y;
-
- g_return_val_if_fail (G_IS_OBJECT (config), NULL);
- g_return_val_if_fail (param_specs != NULL, NULL);
- g_return_val_if_fail (n_param_specs > 0, NULL);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
-
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
- gtk_widget_show (vbox);
-
- /* matrix */
-
- table = gtk_table_new (5, 5, TRUE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
-
- for (y = 0; y < 5; y++)
- {
- for (x = 0; x < 5; x++)
- {
- GtkWidget *spin;
-
- spin = gimp_prop_spin_button_new (config,
- convolution_matrix_prop_name (x, y),
- 1.0, 10.0, 2);
- gtk_entry_set_width_chars (GTK_ENTRY (spin), 8);
- gtk_table_attach (GTK_TABLE (table), spin,
- x, x + 1, y, y + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
- gtk_widget_show (spin);
- }
- }
-
- /* rotate / flip buttons */
- {
- typedef struct
- {
- const gchar *tooltip;
- const gchar *icon_name;
- gint rotate;
- gint flip;
- } ButtonInfo;
-
- gint i;
- const ButtonInfo buttons[] = {
- {
- .tooltip = _("Rotate matrix 90° counter-clockwise"),
- .icon_name = GIMP_ICON_OBJECT_ROTATE_270,
- .rotate = 1,
- .flip = 0
- },
- {
- .tooltip = _("Rotate matrix 90° clockwise"),
- .icon_name = GIMP_ICON_OBJECT_ROTATE_90,
- .rotate = 3,
- .flip = 0
- },
- {
- .tooltip = _("Flip matrix horizontally"),
- .icon_name = GIMP_ICON_OBJECT_FLIP_HORIZONTAL,
- .rotate = 0,
- .flip = 1
- },
- {
- .tooltip = _("Flip matrix vertically"),
- .icon_name = GIMP_ICON_OBJECT_FLIP_VERTICAL,
- .rotate = 2,
- .flip = 1
- }};
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- for (i = 0; i < G_N_ELEMENTS (buttons); i++)
- {
- const ButtonInfo *info = &buttons[i];
- GtkWidget *button;
- GtkWidget *image;
-
- button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_set_tooltip_text (button, info->tooltip);
- gtk_widget_set_can_focus (button, FALSE);
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- gtk_widget_show (button);
-
- image = gtk_image_new_from_icon_name (info->icon_name,
- GTK_ICON_SIZE_BUTTON);
- gtk_container_add (GTK_CONTAINER (button), image);
- gtk_widget_show (image);
-
- g_object_set_data (G_OBJECT (button),
- "convolution-matrix-rotate",
- GINT_TO_POINTER (info->rotate));
- g_object_set_data (G_OBJECT (button),
- "convolution-matrix-flip",
- GINT_TO_POINTER (info->flip));
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (convolution_matrix_rotate_flip),
- config);
- }
- }
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
- gtk_widget_show (vbox);
-
- /* divisor / offset spin scales */
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- scale = gimp_prop_widget_new (config, "divisor",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "offset",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
- gtk_widget_show (scale);
-
- /* rest of the properties */
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- vbox2 = _gimp_prop_gui_new_generic (config,
- param_specs + 27, 4,
- area, context,
- create_picker_func, picker_creator);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- gtk_widget_show (vbox2);
-
- vbox2 = _gimp_prop_gui_new_generic (config,
- param_specs + 31,
- n_param_specs - 31,
- area, context,
- create_picker_func, picker_creator);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
- gtk_widget_show (vbox2);
-
- return main_vbox;
-}
-
-GtkWidget *
-_gimp_prop_gui_new_channel_mixer (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator)
-{
- GtkWidget *main_vbox;
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *checkbox;
- GtkWidget *scale;
- const gchar *label;
-
- g_return_val_if_fail (G_IS_OBJECT (config), NULL);
- g_return_val_if_fail (param_specs != NULL, NULL);
- g_return_val_if_fail (n_param_specs > 0, NULL);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
-
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
-
-
- frame = gimp_frame_new (_("Red channel"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- scale = gimp_prop_widget_new (config, "rr-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "rg-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "rb-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
-
- frame = gimp_frame_new (_("Green channel"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- scale = gimp_prop_widget_new (config, "gr-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "gg-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "gb-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
-
- frame = gimp_frame_new (_("Blue channel"));
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
-
- scale = gimp_prop_widget_new (config, "br-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "bg-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
- scale = gimp_prop_widget_new (config, "bb-gain",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_widget_show (scale);
-
-
- checkbox = gimp_prop_widget_new (config, "preserve-luminosity",
- area, context, NULL, NULL, &label);
- gtk_box_pack_start (GTK_BOX (main_vbox), checkbox, FALSE, FALSE, 0);
- gtk_widget_show (checkbox);
-
- return main_vbox;
-}
-
-
-GtkWidget *
-_gimp_prop_gui_new_diffraction_patterns (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator)
-{
- GtkWidget *notebook;
- GtkWidget *vbox;
-
- g_return_val_if_fail (G_IS_OBJECT (config), NULL);
- g_return_val_if_fail (param_specs != NULL, NULL);
- g_return_val_if_fail (n_param_specs > 0, NULL);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
-
- notebook = gtk_notebook_new ();
-
- vbox = _gimp_prop_gui_new_generic (config,
- param_specs + 0, 3,
- area, context,
- create_picker_func, picker_creator);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
- gtk_label_new (_("Frequencies")));
- gtk_widget_show (vbox);
-
- vbox = _gimp_prop_gui_new_generic (config,
- param_specs + 3, 3,
- area, context,
- create_picker_func, picker_creator);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
- gtk_label_new (_("Contours")));
- gtk_widget_show (vbox);
-
- vbox = _gimp_prop_gui_new_generic (config,
- param_specs + 6, 3,
- area, context,
- create_picker_func, picker_creator);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
- gtk_label_new (_("Sharp Edges")));
- gtk_widget_show (vbox);
-
- vbox = _gimp_prop_gui_new_generic (config,
- param_specs + 9, 3,
- area, context,
- create_picker_func, picker_creator);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
- gtk_label_new (_("Other Options")));
- gtk_widget_show (vbox);
-
- return notebook;
-}
-
/* private functions */
diff --git a/app/widgets/gimppropgui-constructors.h b/app/widgets/gimppropgui-constructors.h
index d96ac36..3e1d008 100644
--- a/app/widgets/gimppropgui-constructors.h
+++ b/app/widgets/gimppropgui-constructors.h
@@ -31,40 +31,5 @@ GtkWidget * _gimp_prop_gui_new_generic (GObject *config,
GimpCreatePickerFunc create_picker_func,
gpointer picker_creator);
-GtkWidget * _gimp_prop_gui_new_color_rotate
- (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator);
-
-GtkWidget * _gimp_prop_gui_new_convolution_matrix
- (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator);
-
-GtkWidget * _gimp_prop_gui_new_channel_mixer
- (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator);
-
-GtkWidget * _gimp_prop_gui_new_diffraction_patterns
- (GObject *config,
- GParamSpec **param_specs,
- guint n_param_specs,
- GeglRectangle *area,
- GimpContext *context,
- GimpCreatePickerFunc create_picker_func,
- gpointer picker_creator);
#endif /* __GIMP_PROP_GUI_CONSTRUCTORS_H__ */
diff --git a/app/widgets/gimppropgui-convolution-matrix.c b/app/widgets/gimppropgui-convolution-matrix.c
new file mode 100644
index 0000000..f633e1c
--- /dev/null
+++ b/app/widgets/gimppropgui-convolution-matrix.c
@@ -0,0 +1,304 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-convolution-matrix.c
+ * Copyright (C) 2002-2014 Michael Natterer <mitch gimp org>
+ * Sven Neumann <sven gimp org>
+ *
+ * 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 <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "core/gimpcontext.h"
+
+#include "gimppropgui.h"
+#include "gimppropgui-constructors.h"
+#include "gimppropgui-convolution-matrix.h"
+
+#include "gimp-intl.h"
+
+
+static const gchar *
+convolution_matrix_prop_name (gint x,
+ gint y)
+{
+ static const gchar * const prop_names[5][5] = {
+ {"a1", "a2", "a3", "a4", "a5"},
+ {"b1", "b2", "b3", "b4", "b5"},
+ {"c1", "c2", "c3", "c4", "c5"},
+ {"d1", "d2", "d3", "d4", "d5"},
+ {"e1", "e2", "e3", "e4", "e5"}};
+
+ return prop_names[x][y];
+}
+
+static void
+convolution_matrix_rotate_flip (GtkWidget *button,
+ GObject *config)
+{
+ gint rotate = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
+ "convolution-matrix-rotate"));
+ gint flip = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
+ "convolution-matrix-flip"));
+ gint x, y;
+
+ while (rotate--)
+ {
+ for (y = 0; y < 2; y++)
+ {
+ for (x = y; x < 4 - y; x++)
+ {
+ gint i;
+ gdouble temp;
+
+ g_object_get (config,
+ convolution_matrix_prop_name (x, y), &temp,
+ NULL);
+
+ for (i = 0; i < 4; i++)
+ {
+ gint next_x, next_y;
+ gdouble val;
+
+ next_x = 4 - y;
+ next_y = x;
+
+ if (i < 3)
+ {
+ g_object_get (config,
+ convolution_matrix_prop_name (next_x, next_y), &val,
+ NULL);
+ }
+ else
+ {
+ val = temp;
+ }
+
+ g_object_set (config,
+ convolution_matrix_prop_name (x, y), val,
+ NULL);
+
+ x = next_x;
+ y = next_y;
+ }
+ }
+ }
+ }
+
+ while (flip--)
+ {
+ for (y = 0; y < 5; y++)
+ {
+ for (x = 0; x < 2; x++)
+ {
+ gdouble val1, val2;
+
+ g_object_get (config,
+ convolution_matrix_prop_name (x, y), &val1,
+ NULL);
+ g_object_get (config,
+ convolution_matrix_prop_name (4 - x, y), &val2,
+ NULL);
+
+ g_object_set (config,
+ convolution_matrix_prop_name (x, y), val2,
+ NULL);
+ g_object_set (config,
+ convolution_matrix_prop_name (4 - x, y), val1,
+ NULL);
+ }
+ }
+ }
+}
+
+GtkWidget *
+_gimp_prop_gui_new_convolution_matrix (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 *table;
+ GtkWidget *hbox;
+ GtkWidget *scale;
+ GtkWidget *vbox2;
+ const gchar *label;
+ gint x, y;
+
+ g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+ g_return_val_if_fail (param_specs != NULL, NULL);
+ g_return_val_if_fail (n_param_specs > 0, NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
+ /* matrix */
+
+ table = gtk_table_new (5, 5, TRUE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 2);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
+ for (y = 0; y < 5; y++)
+ {
+ for (x = 0; x < 5; x++)
+ {
+ GtkWidget *spin;
+
+ spin = gimp_prop_spin_button_new (config,
+ convolution_matrix_prop_name (x, y),
+ 1.0, 10.0, 2);
+ gtk_entry_set_width_chars (GTK_ENTRY (spin), 8);
+ gtk_table_attach (GTK_TABLE (table), spin,
+ x, x + 1, y, y + 1,
+ GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
+ 0, 0);
+ gtk_widget_show (spin);
+ }
+ }
+
+ /* rotate / flip buttons */
+ {
+ typedef struct
+ {
+ const gchar *tooltip;
+ const gchar *icon_name;
+ gint rotate;
+ gint flip;
+ } ButtonInfo;
+
+ gint i;
+ const ButtonInfo buttons[] = {
+ {
+ .tooltip = _("Rotate matrix 90° counter-clockwise"),
+ .icon_name = GIMP_ICON_OBJECT_ROTATE_270,
+ .rotate = 1,
+ .flip = 0
+ },
+ {
+ .tooltip = _("Rotate matrix 90° clockwise"),
+ .icon_name = GIMP_ICON_OBJECT_ROTATE_90,
+ .rotate = 3,
+ .flip = 0
+ },
+ {
+ .tooltip = _("Flip matrix horizontally"),
+ .icon_name = GIMP_ICON_OBJECT_FLIP_HORIZONTAL,
+ .rotate = 0,
+ .flip = 1
+ },
+ {
+ .tooltip = _("Flip matrix vertically"),
+ .icon_name = GIMP_ICON_OBJECT_FLIP_VERTICAL,
+ .rotate = 2,
+ .flip = 1
+ }};
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ for (i = 0; i < G_N_ELEMENTS (buttons); i++)
+ {
+ const ButtonInfo *info = &buttons[i];
+ GtkWidget *button;
+ GtkWidget *image;
+
+ button = gtk_button_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_set_tooltip_text (button, info->tooltip);
+ gtk_widget_set_can_focus (button, FALSE);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ gtk_widget_show (button);
+
+ image = gtk_image_new_from_icon_name (info->icon_name,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_container_add (GTK_CONTAINER (button), image);
+ gtk_widget_show (image);
+
+ g_object_set_data (G_OBJECT (button),
+ "convolution-matrix-rotate",
+ GINT_TO_POINTER (info->rotate));
+ g_object_set_data (G_OBJECT (button),
+ "convolution-matrix-flip",
+ GINT_TO_POINTER (info->flip));
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (convolution_matrix_rotate_flip),
+ config);
+ }
+ }
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
+ /* divisor / offset spin scales */
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ scale = gimp_prop_widget_new (config, "divisor",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
+ gtk_widget_show (scale);
+
+ scale = gimp_prop_widget_new (config, "offset",
+ area, context, NULL, NULL, &label);
+ gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
+ gtk_widget_show (scale);
+
+ /* rest of the properties */
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ vbox2 = _gimp_prop_gui_new_generic (config,
+ param_specs + 27, 4,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+ gtk_widget_show (vbox2);
+
+ vbox2 = _gimp_prop_gui_new_generic (config,
+ param_specs + 31,
+ n_param_specs - 31,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+ gtk_widget_show (vbox2);
+
+ return main_vbox;
+}
diff --git a/app/widgets/gimppropgui-convolution-matrix.h b/app/widgets/gimppropgui-convolution-matrix.h
new file mode 100644
index 0000000..acc7ac9
--- /dev/null
+++ b/app/widgets/gimppropgui-convolution-matrix.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-convolution-matrix.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_CONVOLUTION_MATRIX_H__
+#define __GIMP_PROP_GUI_CONVOLUTION_MATRIX_H__
+
+
+GtkWidget *
+_gimp_prop_gui_new_convolution_matrix (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator);
+
+
+#endif /* __GIMP_PROP_GUI_CONVOLUTION_MATRIX_H__ */
diff --git a/app/widgets/gimppropgui-diffration-patterns.c b/app/widgets/gimppropgui-diffration-patterns.c
new file mode 100644
index 0000000..3037843
--- /dev/null
+++ b/app/widgets/gimppropgui-diffration-patterns.c
@@ -0,0 +1,96 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-diffration-patterns.c
+ * Copyright (C) 2002-2014 Michael Natterer <mitch gimp org>
+ * Sven Neumann <sven gimp org>
+ *
+ * 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 <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "core/gimpcontext.h"
+
+#include "gimppropgui.h"
+#include "gimppropgui-constructors.h"
+#include "gimppropgui-diffration-patterns.h"
+
+#include "gimp-intl.h"
+
+
+GtkWidget *
+_gimp_prop_gui_new_diffraction_patterns (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator)
+{
+ GtkWidget *notebook;
+ GtkWidget *vbox;
+
+ g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+ g_return_val_if_fail (param_specs != NULL, NULL);
+ g_return_val_if_fail (n_param_specs > 0, NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
+ notebook = gtk_notebook_new ();
+
+ vbox = _gimp_prop_gui_new_generic (config,
+ param_specs + 0, 3,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
+ gtk_label_new (_("Frequencies")));
+ gtk_widget_show (vbox);
+
+ vbox = _gimp_prop_gui_new_generic (config,
+ param_specs + 3, 3,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
+ gtk_label_new (_("Contours")));
+ gtk_widget_show (vbox);
+
+ vbox = _gimp_prop_gui_new_generic (config,
+ param_specs + 6, 3,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
+ gtk_label_new (_("Sharp Edges")));
+ gtk_widget_show (vbox);
+
+ vbox = _gimp_prop_gui_new_generic (config,
+ param_specs + 9, 3,
+ area, context,
+ create_picker_func, picker_creator);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
+ gtk_label_new (_("Other Options")));
+ gtk_widget_show (vbox);
+
+ return notebook;
+}
diff --git a/app/widgets/gimppropgui-diffration-patterns.h b/app/widgets/gimppropgui-diffration-patterns.h
new file mode 100644
index 0000000..b703694
--- /dev/null
+++ b/app/widgets/gimppropgui-diffration-patterns.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimppropgui-diffration-patterns.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_DIFFRATION_PATTERNS_H__
+#define __GIMP_PROP_GUI_DIFFRATION_PATTERNS_H__
+
+
+GtkWidget *
+_gimp_prop_gui_new_diffraction_patterns (GObject *config,
+ GParamSpec **param_specs,
+ guint n_param_specs,
+ GeglRectangle *area,
+ GimpContext *context,
+ GimpCreatePickerFunc create_picker_func,
+ gpointer picker_creator);
+
+
+#endif /* __GIMP_PROP_GUI_DIFFRATION_PATTERNS_H__ */
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index 48723cb..06d0ca0 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -43,7 +43,11 @@
#include "gimpmessagebox.h"
#include "gimpspinscale.h"
#include "gimppropgui.h"
+#include "gimppropgui-channel-mixer.h"
#include "gimppropgui-color-balance.h"
+#include "gimppropgui-color-rotate.h"
+#include "gimppropgui-convolution-matrix.h"
+#include "gimppropgui-diffration-patterns.h"
#include "gimppropgui-constructors.h"
#include "gimppropgui-eval.h"
#include "gimppropwidgets.h"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index da5e879..89f5b9d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -536,8 +536,12 @@ app/widgets/gimppdbdialog.c
app/widgets/gimppickablepopup.c
app/widgets/gimppluginview.c
app/widgets/gimpprogressdialog.c
+app/widgets/gimppropgui-channel-mixer.c
app/widgets/gimppropgui-color-balance.c
+app/widgets/gimppropgui-color-rotate.c
app/widgets/gimppropgui-constructors.c
+app/widgets/gimppropgui-convolution-matrix.c
+app/widgets/gimppropgui-diffration-patterns.c
app/widgets/gimppropgui.c
app/widgets/gimppropwidgets.c
app/widgets/gimpsavedialog.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]