[gimp] app: support GeglParamSpecSeed in generated operation UI
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: support GeglParamSpecSeed in generated operation UI
- Date: Fri, 30 Nov 2012 02:00:15 +0000 (UTC)
commit d8a9804702a6516a4e8dfd2c3d9838a8d9919a43
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 30 02:58:48 2012 +0100
app: support GeglParamSpecSeed in generated operation UI
and add a "New Seed" button next to the random seed entry.
app/core/gimpparamspecs-duplicate.c | 8 ++++++++
app/widgets/gimppropwidgets.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpparamspecs-duplicate.c b/app/core/gimpparamspecs-duplicate.c
index 2bd5f28..c3ed61a 100644
--- a/app/core/gimpparamspecs-duplicate.c
+++ b/app/core/gimpparamspecs-duplicate.c
@@ -162,6 +162,14 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
pspec->flags |
GIMP_CONFIG_PARAM_SERIALIZE);
}
+ else if (GEGL_IS_PARAM_SPEC_SEED (pspec))
+ {
+ return gegl_param_spec_seed (pspec->name,
+ g_param_spec_get_nick (pspec),
+ g_param_spec_get_blurb (pspec),
+ pspec->flags |
+ GIMP_CONFIG_PARAM_SERIALIZE);
+ }
else if (G_IS_PARAM_SPEC_INT (pspec))
{
GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec);
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 26fd7ed..4cc6bcf 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -1443,6 +1443,16 @@ gimp_prop_table_chain_toggled (GimpChainButton *chain,
}
}
+static void
+gimp_prop_table_new_seed_clicked (GtkButton *button,
+ GtkAdjustment *adj)
+{
+ guint32 value = g_random_int_range (gtk_adjustment_get_lower (adj),
+ gtk_adjustment_get_upper (adj));
+
+ gtk_adjustment_set_value (adj, value);
+}
+
GtkWidget *
gimp_prop_table_new (GObject *config,
GType owner_type,
@@ -1526,6 +1536,30 @@ gimp_prop_table_new (GObject *config,
widget = gimp_prop_enum_combo_box_new (config, pspec->name, 0, 0);
label = g_param_spec_get_nick (pspec);
}
+ else if (GEGL_IS_PARAM_SPEC_SEED (pspec))
+ {
+ GtkAdjustment *adj;
+ GtkWidget *scale;
+ GtkWidget *button;
+
+ widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+
+ scale = gimp_prop_spin_scale_new (config, pspec->name,
+ g_param_spec_get_nick (pspec),
+ 1.0, 1.0, 0);
+ gtk_box_pack_start (GTK_BOX (widget), scale, TRUE, TRUE, 0);
+ gtk_widget_show (scale);
+
+ button = gtk_button_new_with_label (_("New Seed"));
+ gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (scale));
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (gimp_prop_table_new_seed_clicked),
+ adj);
+ }
else if (G_IS_PARAM_SPEC_INT (pspec) ||
G_IS_PARAM_SPEC_UINT (pspec) ||
G_IS_PARAM_SPEC_FLOAT (pspec) ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]