[gimp] plug-ins, modules: more port to GimpScaleEntry.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, modules: more port to GimpScaleEntry.
- Date: Sat, 31 Oct 2020 01:14:17 +0000 (UTC)
commit 7ebd19636cb4b690904978dada23d04d294a47a2
Author: Jehan <jehan girinstud io>
Date: Sat Oct 31 00:53:26 2020 +0100
plug-ins, modules: more port to GimpScaleEntry.
modules/color-selector-cmyk.c | 44 +++----
plug-ins/common/cml-explorer.c | 241 ++++++++++++++++---------------------
plug-ins/common/contrast-retinex.c | 76 +++++++-----
plug-ins/common/depth-merge.c | 88 +++++++-------
plug-ins/common/destripe.c | 32 ++---
plug-ins/common/file-raw-data.c | 97 +++++++--------
plug-ins/common/nl-filter.c | 58 +++++----
plug-ins/common/sphere-designer.c | 170 +++++++++++++-------------
plug-ins/common/tile-small.c | 44 +++----
plug-ins/common/van-gogh-lic.c | 88 +++++++-------
plug-ins/flame/flame.c | 226 +++++++++++++++++-----------------
plug-ins/gfig/gfig-dialog.c | 149 ++++++++++++-----------
12 files changed, 646 insertions(+), 667 deletions(-)
---
diff --git a/modules/color-selector-cmyk.c b/modules/color-selector-cmyk.c
index 22eaf77011..ddd391caff 100644
--- a/modules/color-selector-cmyk.c
+++ b/modules/color-selector-cmyk.c
@@ -49,7 +49,7 @@ struct _ColorselCmyk
GimpColorTransform *cmyk2rgb;
GimpCMYK cmyk;
- GtkAdjustment *adj[4];
+ GtkWidget *scales[4];
GtkWidget *name_label;
gboolean in_destruction;
@@ -71,7 +71,7 @@ static void colorsel_cmyk_set_color (GimpColorSelector *selector,
static void colorsel_cmyk_set_config (GimpColorSelector *selector,
GimpColorConfig *config);
-static void colorsel_cmyk_adj_update (GtkAdjustment *adj,
+static void colorsel_cmyk_scale_update (GimpScaleEntry *scale,
ColorselCmyk *module);
static void colorsel_cmyk_config_changed (ColorselCmyk *module);
@@ -168,20 +168,16 @@ colorsel_cmyk_init (ColorselCmyk *module)
for (i = 0; i < 4; i++)
{
- module->adj[i] = gimp_scale_entry_new (GTK_GRID (grid), 1, i,
- gettext (cmyk_labels[i]),
- -1, -1,
- 0.0,
- 0.0, 100.0,
- 1.0, 10.0,
- 0,
- TRUE, 0.0, 0.0,
- gettext (cmyk_tips[i]),
- NULL);
-
- g_signal_connect (module->adj[i], "value-changed",
- G_CALLBACK (colorsel_cmyk_adj_update),
+ module->scales[i] = gimp_scale_entry_new2 (gettext (cmyk_labels[i]),
+ 0.0, 0.0, 100.0, 0);
+ gimp_help_set_help_data (module->scales[i], gettext (cmyk_tips[i]), NULL);
+
+ g_signal_connect (module->scales[i], "value-changed",
+ G_CALLBACK (colorsel_cmyk_scale_update),
module);
+
+ gtk_grid_attach (GTK_GRID (grid), module->scales[i], 1, i, 3, 1);
+ gtk_widget_show (module->scales[i]);
}
module->name_label = gtk_label_new (NULL);
@@ -248,14 +244,14 @@ colorsel_cmyk_set_color (GimpColorSelector *selector,
for (i = 0; i < 4; i++)
{
- g_signal_handlers_block_by_func (module->adj[i],
- colorsel_cmyk_adj_update,
+ g_signal_handlers_block_by_func (module->scales[i],
+ colorsel_cmyk_scale_update,
module);
- gtk_adjustment_set_value (module->adj[i], values[i]);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (module->scales[i]), values[i]);
- g_signal_handlers_unblock_by_func (module->adj[i],
- colorsel_cmyk_adj_update,
+ g_signal_handlers_unblock_by_func (module->scales[i],
+ colorsel_cmyk_scale_update,
module);
}
}
@@ -285,18 +281,18 @@ colorsel_cmyk_set_config (GimpColorSelector *selector,
}
static void
-colorsel_cmyk_adj_update (GtkAdjustment *adj,
- ColorselCmyk *module)
+colorsel_cmyk_scale_update (GimpScaleEntry *scale,
+ ColorselCmyk *module)
{
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
gint i;
gdouble value;
for (i = 0; i < 4; i++)
- if (module->adj[i] == adj)
+ if (GIMP_SCALE_ENTRY (module->scales[i]) == scale)
break;
- value = gtk_adjustment_get_value (adj) / 100.0;
+ value = gimp_scale_entry_get_value (scale) / 100.0;
switch (i)
{
diff --git a/plug-ins/common/cml-explorer.c b/plug-ins/common/cml-explorer.c
index 2fdda897a6..563ab89524 100644
--- a/plug-ins/common/cml-explorer.c
+++ b/plug-ins/common/cml-explorer.c
@@ -91,7 +91,6 @@
#define PROGRESS_UPDATE_NUM 100
#define CML_LINE_SIZE 1024
#define TILE_CACHE_SIZE 32
-#define SCALE_WIDTH 130
#define PREVIEW_WIDTH 64
#define PREVIEW_HEIGHT 220
@@ -376,11 +375,11 @@ static void CML_explorer_toggle_entry_init (WidgetEntry *widget_entry,
gpointer value_ptr);
static void CML_explorer_int_entry_init (WidgetEntry *widget_entry,
- GtkAdjustment *object,
- gpointer value_ptr);
+ GtkWidget *scale,
+ gpointer value_ptr);
static void CML_explorer_double_entry_init (WidgetEntry *widget_entry,
- GtkAdjustment *object,
+ GtkWidget *scale,
gpointer value_ptr);
static void CML_explorer_menu_update (GtkWidget *widget,
@@ -1444,13 +1443,13 @@ CML_explorer_dialog (void)
gtk_label_new_with_mnemonic (_("_Advanced")));
{
- GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- GtkWidget *grid;
- GtkWidget *label;
- GtkWidget *combo;
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkAdjustment *adj;
+ GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ GtkWidget *grid;
+ GtkWidget *label;
+ GtkWidget *combo;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *scale;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
@@ -1483,23 +1482,19 @@ CML_explorer_dialog (void)
gtk_size_group_add_widget (group, label);
g_object_unref (group);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("Zoom scale:"), SCALE_WIDTH, 3,
- VALS.scale, 1, 10, 1, 2, 0,
- TRUE, 0, 0,
- NULL, NULL);
- gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
+ scale = gimp_scale_entry_new2 (_("Zoom scale:"), VALS.scale, 1, 10, 0);
+ gtk_size_group_add_widget (group, gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
CML_explorer_int_entry_init (&widget_pointers[3][1],
- adj, &VALS.scale);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
- _("Start offset:"), SCALE_WIDTH, 3,
- VALS.start_offset, 0, 100, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
- gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
+ scale, &VALS.scale);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
+
+ scale = gimp_scale_entry_new2 (_("Start offset:"), VALS.start_offset, 0, 100, 0);
+ gtk_size_group_add_widget (group, gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
CML_explorer_int_entry_init (&widget_pointers[3][2],
- adj, &VALS.start_offset);
+ scale, &VALS.start_offset);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 3, 1);
+ gtk_widget_show (scale);
frame =
gimp_frame_new (_("Seed of Random (only for \"From Seed\" Modes)"));
@@ -1512,14 +1507,12 @@ CML_explorer_dialog (void)
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_widget_show (grid);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("Seed:"), SCALE_WIDTH, 0,
- VALS.seed, 0, (guint32) -1, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
- gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
+ scale = gimp_scale_entry_new2 (_("Seed:"), VALS.seed, 0, (guint32) -1, 0);
+ gtk_size_group_add_widget (group, gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
CML_explorer_int_entry_init (&widget_pointers[3][3],
- adj, &VALS.seed);
+ scale, &VALS.seed);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 3, 1);
+ gtk_widget_show (scale);
random_sensitives[3].widget = grid;
random_sensitives[3].logic = FALSE;
@@ -1683,13 +1676,13 @@ static GtkWidget *
CML_dialog_channel_panel_new (CML_PARAM *param,
gint channel_id)
{
- GtkWidget *grid;
- GtkWidget *combo;
- GtkWidget *toggle;
- GtkWidget *button;
- GtkAdjustment *adj;
- gpointer *chank;
- gint index = 0;
+ GtkWidget *grid;
+ GtkWidget *combo;
+ GtkWidget *toggle;
+ GtkWidget *button;
+ GtkWidget *scale;
+ gpointer *chank;
+ gint index = 0;
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
@@ -1750,76 +1743,62 @@ CML_dialog_channel_panel_new (CML_PARAM *param,
gtk_widget_show (toggle);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Mod. rate:"), SCALE_WIDTH, 5,
- param->mod_rate, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Mod. rate:"), param->mod_rate, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->mod_rate);
+ scale, ¶m->mod_rate);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Env. sensitivity:"), SCALE_WIDTH, 5,
- param->env_sensitivity, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Env. sensitivity:"), param->env_sensitivity, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->env_sensitivity);
+ scale, ¶m->env_sensitivity);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Diffusion dist.:"), SCALE_WIDTH, 5,
- param->diffusion_dist, 2, 10, 1, 2, 0,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Diffusion dist.:"), param->diffusion_dist, 2, 10, 0);
CML_explorer_int_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->diffusion_dist);
+ scale, ¶m->diffusion_dist);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("# of subranges:"), SCALE_WIDTH, 5,
- param->range_num, 1, 10, 1, 2, 0,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("# of subranges:"), param->range_num, 1, 10, 0);
CML_explorer_int_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->range_num);
+ scale, ¶m->range_num);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("P(ower factor):"), SCALE_WIDTH, 5,
- param->power, 0.0, 10.0, 0.1, 1.0, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("P(ower factor):"), param->power, 0.0, 10.0, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->power);
+ scale, ¶m->power);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Parameter k:"), SCALE_WIDTH, 5,
- param->parameter_k, 0.0, 10.0, 0.1, 1.0, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Parameter k:"), param->parameter_k, 0.0, 10.0, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->parameter_k);
+ scale, ¶m->parameter_k);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Range low:"), SCALE_WIDTH, 5,
- param->range_l, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Range low:"), param->range_l, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->range_l);
+ scale, ¶m->range_l);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Range high:"), SCALE_WIDTH, 5,
- param->range_h, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Range high:"), param->range_h, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
- adj, ¶m->range_h);
+ scale, ¶m->range_h);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
chank = g_new (gpointer, 2);
@@ -1839,14 +1818,14 @@ CML_dialog_channel_panel_new (CML_PARAM *param,
static GtkWidget *
CML_dialog_advanced_panel_new (void)
{
- GtkWidget *vbox;
- GtkWidget *subframe;
- GtkWidget *grid;
- GtkAdjustment *adj;
- gint index = 0;
- gint widget_offset = 12;
- gint channel_id;
- CML_PARAM *param;
+ GtkWidget *vbox;
+ GtkWidget *subframe;
+ GtkWidget *grid;
+ GtkWidget *scale;
+ gint index = 0;
+ gint widget_offset = 12;
+ gint channel_id;
+ CML_PARAM *param;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
@@ -1868,34 +1847,28 @@ CML_dialog_advanced_panel_new (void)
index = 0;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Ch. sensitivity:"), SCALE_WIDTH, 0,
- param->ch_sensitivity, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Ch. sensitivity:"), param->ch_sensitivity, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
widget_offset],
- adj, ¶m->ch_sensitivity);
+ scale, ¶m->ch_sensitivity);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Mutation rate:"), SCALE_WIDTH, 0,
- param->mutation_rate, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Mutation rate:"), param->mutation_rate, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
widget_offset],
- adj, ¶m->mutation_rate);
+ scale, ¶m->mutation_rate);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
index++;
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, index,
- _("Mutation dist.:"), SCALE_WIDTH, 0,
- param->mutation_dist, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Mutation dist.:"), param->mutation_dist, 0.0, 1.0, 2);
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
widget_offset],
- adj, ¶m->mutation_dist);
+ scale, ¶m->mutation_dist);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, index, 3, 1);
+ gtk_widget_show (scale);
}
return vbox;
}
@@ -2561,10 +2534,10 @@ CML_explorer_toggle_entry_init (WidgetEntry *widget_entry,
/* int adjustment functions */
static void
-CML_explorer_int_adjustment_update (GtkAdjustment *adjustment,
- gpointer data)
+CML_explorer_int_adjustment_update (GimpScaleEntry *scale,
+ gint *value)
{
- gimp_int_adjustment_update (adjustment, data);
+ *value = (gint) gimp_scale_entry_get_value (scale);
preview_update ();
}
@@ -2572,21 +2545,21 @@ CML_explorer_int_adjustment_update (GtkAdjustment *adjustment,
static void
CML_explorer_int_entry_change_value (WidgetEntry *widget_entry)
{
- GtkAdjustment *adjustment = (GtkAdjustment *) (widget_entry->widget);
+ GimpScaleEntry *scale = GIMP_SCALE_ENTRY (widget_entry->widget);
- gtk_adjustment_set_value (adjustment, *(gint *) (widget_entry->value));
+ gimp_scale_entry_set_value (scale, *(gint *) (widget_entry->value));
}
static void
-CML_explorer_int_entry_init (WidgetEntry *widget_entry,
- GtkAdjustment *adjustment,
- gpointer value_ptr)
+CML_explorer_int_entry_init (WidgetEntry *widget_entry,
+ GtkWidget *scale,
+ gpointer value_ptr)
{
- g_signal_connect (adjustment, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (CML_explorer_int_adjustment_update),
value_ptr);
- widget_entry->widget = (GtkWidget *) adjustment;
+ widget_entry->widget = scale;
widget_entry->value = value_ptr;
widget_entry->updater = CML_explorer_int_entry_change_value;
}
@@ -2594,10 +2567,10 @@ CML_explorer_int_entry_init (WidgetEntry *widget_entry,
/* double adjustment functions */
static void
-CML_explorer_double_adjustment_update (GtkAdjustment *adjustment,
- gpointer data)
+CML_explorer_double_adjustment_update (GimpScaleEntry *scale,
+ gdouble *value)
{
- gimp_double_adjustment_update (adjustment, data);
+ *value = gimp_scale_entry_get_value (scale);
preview_update ();
}
@@ -2605,21 +2578,21 @@ CML_explorer_double_adjustment_update (GtkAdjustment *adjustment,
static void
CML_explorer_double_entry_change_value (WidgetEntry *widget_entry)
{
- GtkAdjustment *adjustment = (GtkAdjustment *) (widget_entry->widget);
+ GimpScaleEntry *scale = GIMP_SCALE_ENTRY (widget_entry->widget);
- gtk_adjustment_set_value (adjustment, *(gdouble *) (widget_entry->value));
+ gimp_scale_entry_set_value (scale, *(gdouble *) (widget_entry->value));
}
static void
-CML_explorer_double_entry_init (WidgetEntry *widget_entry,
- GtkAdjustment *adjustment,
- gpointer value_ptr)
+CML_explorer_double_entry_init (WidgetEntry *widget_entry,
+ GtkWidget *scale,
+ gpointer value_ptr)
{
- g_signal_connect (adjustment, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (CML_explorer_double_adjustment_update),
value_ptr);
- widget_entry->widget = (GtkWidget *) adjustment;
+ widget_entry->widget = scale;
widget_entry->value = value_ptr;
widget_entry->updater = CML_explorer_double_entry_change_value;
}
diff --git a/plug-ins/common/contrast-retinex.c b/plug-ins/common/contrast-retinex.c
index 0745c35c4d..e395816fea 100644
--- a/plug-ins/common/contrast-retinex.c
+++ b/plug-ins/common/contrast-retinex.c
@@ -31,8 +31,6 @@
#define MAX_RETINEX_SCALES 8
#define MIN_GAUSSIAN_SCALE 16
#define MAX_GAUSSIAN_SCALE 250
-#define SCALE_WIDTH 150
-#define ENTRY_WIDTH 4
typedef struct
@@ -126,6 +124,11 @@ static void gausssmooth (gfloat *in,
gint rowtride,
gauss3_coefs *c);
+static void contrast_retinex_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value);
+static void contrast_retinex_scale_entry_update_float (GimpScaleEntry *entry,
+ gfloat *value);
+
/*
* MSRCR = MultiScale Retinex with Color Restoration
*/
@@ -308,13 +311,13 @@ retinex_run (GimpProcedure *procedure,
static gboolean
retinex_dialog (GimpDrawable *drawable)
{
- GtkWidget *dialog;
- GtkWidget *main_vbox;
- GtkWidget *preview;
- GtkWidget *grid;
- GtkWidget *combo;
- GtkAdjustment *adj;
- gboolean run;
+ GtkWidget *dialog;
+ GtkWidget *main_vbox;
+ GtkWidget *preview;
+ GtkWidget *grid;
+ GtkWidget *combo;
+ GtkWidget *scale;
+ gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@@ -371,43 +374,38 @@ retinex_dialog (GimpDrawable *drawable)
combo, 2);
gtk_widget_show (combo);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("_Scale:"), SCALE_WIDTH, ENTRY_WIDTH,
- rvals.scale,
- MIN_GAUSSIAN_SCALE, MAX_GAUSSIAN_SCALE, 1, 1, 0,
- TRUE, 0, 0, NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_Scale:"), rvals.scale, MIN_GAUSSIAN_SCALE, MAX_GAUSSIAN_SCALE, 0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (contrast_retinex_scale_entry_update_int),
&rvals.scale);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
- _("Scale _division:"), SCALE_WIDTH, ENTRY_WIDTH,
- rvals.nscales,
- 0, MAX_RETINEX_SCALES, 1, 1, 0,
- TRUE, 0, 0, NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Scale _division:"), rvals.nscales, 0, MAX_RETINEX_SCALES, 0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (contrast_retinex_scale_entry_update_int),
&rvals.nscales);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 3,
- _("Dy_namic:"), SCALE_WIDTH, ENTRY_WIDTH,
- rvals.cvar, 0, 4, 0.1, 0.1, 1,
- TRUE, 0, 0, NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Dy_namic:"), rvals.cvar, 0, 4, 1);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_float_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (contrast_retinex_scale_entry_update_float),
&rvals.cvar);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 3, 3, 1);
+ gtk_widget_show (scale);
gtk_widget_show (dialog);
@@ -877,3 +875,17 @@ compute_mean_var (gfloat *src, gfloat *mean, gfloat *var, gint size, gint bytes)
*var = ( vsquared - (*mean * *mean) );
*var = sqrt(*var); /* var */
}
+
+static void
+contrast_retinex_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value)
+{
+ *value = (gint) gimp_scale_entry_get_value (entry);
+}
+
+static void
+contrast_retinex_scale_entry_update_float (GimpScaleEntry *entry,
+ gfloat *value)
+{
+ *value = (gfloat) gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/common/depth-merge.c b/plug-ins/common/depth-merge.c
index a82a0d1bda..b2b2a3430d 100644
--- a/plug-ins/common/depth-merge.c
+++ b/plug-ins/common/depth-merge.c
@@ -157,8 +157,8 @@ static void dialogDepthMap1ChangedCallback (GtkWidget *widget,
static void dialogDepthMap2ChangedCallback (GtkWidget *widget,
DepthMerge *dm);
-static void dialogValueScaleUpdateCallback (GtkAdjustment *adjustment,
- gpointer data);
+static void dialogValueScaleUpdateCallback (GimpScaleEntry *scale,
+ gfloat *value);
static void util_fillReducedBuffer (guchar *dest,
const Babl *dest_format,
@@ -688,15 +688,15 @@ DepthMerge_executeRegion (DepthMerge *dm,
static gboolean
DepthMerge_dialog (DepthMerge *dm)
{
- GtkWidget *dialog;
- GtkWidget *vbox;
- GtkWidget *frame;
- GtkWidget *grid;
- GtkWidget *hbox;
- GtkWidget *label;
- GtkWidget *combo;
- GtkAdjustment *adj;
- gboolean run;
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+ GtkWidget *frame;
+ GtkWidget *grid;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *combo;
+ GtkWidget *scale;
+ gboolean run;
dm->interface = g_new0 (DepthMergeInterface, 1);
@@ -810,45 +810,41 @@ DepthMerge_dialog (DepthMerge *dm)
gtk_widget_show (combo);
/* Numeric parameters */
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 4,
- _("O_verlap:"), 0, 6,
- dm->params.overlap, 0, 2, 0.001, 0.01, 3,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
+ scale = gimp_scale_entry_new2 (_("O_verlap:"), dm->params.overlap, 0, 2, 3);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.001, 0.01);
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (dialogValueScaleUpdateCallback),
&(dm->params.overlap));
- g_object_set_data (G_OBJECT (adj), "dm", dm);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 5,
- _("O_ffset:"), 0, 6,
- dm->params.offset, -1, 1, 0.001, 0.01, 3,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
+ g_object_set_data (G_OBJECT (scale), "dm", dm);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 4, 3, 1);
+ gtk_widget_show (scale);
+
+ scale = gimp_scale_entry_new2 (_("O_ffset:"), dm->params.offset, -1, 1, 3);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.001, 0.01);
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (dialogValueScaleUpdateCallback),
&(dm->params.offset));
- g_object_set_data (G_OBJECT (adj), "dm", dm);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 6,
- _("Sc_ale 1:"), 0, 6,
- dm->params.scale1, -1, 1, 0.001, 0.01, 3,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
+ g_object_set_data (G_OBJECT (scale), "dm", dm);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 5, 3, 1);
+ gtk_widget_show (scale);
+
+ scale = gimp_scale_entry_new2 (_("Sc_ale 1:"), dm->params.scale1, -1, 1, 3);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.001, 0.01);
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (dialogValueScaleUpdateCallback),
&(dm->params.scale1));
- g_object_set_data (G_OBJECT (adj), "dm", dm);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 7,
- _("Sca_le 2:"), 0, 6,
- dm->params.scale2, -1, 1, 0.001, 0.01, 3,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
+ g_object_set_data (G_OBJECT (scale), "dm", dm);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 6, 3, 1);
+ gtk_widget_show (scale);
+
+ scale = gimp_scale_entry_new2 (_("Sca_le 2:"), dm->params.scale2, -1, 1, 3);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.001, 0.01);
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (dialogValueScaleUpdateCallback),
&(dm->params.scale2));
- g_object_set_data (G_OBJECT (adj), "dm", dm);
+ g_object_set_data (G_OBJECT (scale), "dm", dm);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 7, 3, 1);
+ gtk_widget_show (scale);
dm->interface->active = TRUE;
@@ -1052,12 +1048,12 @@ dialogDepthMap2ChangedCallback (GtkWidget *widget,
}
static void
-dialogValueScaleUpdateCallback (GtkAdjustment *adjustment,
- gpointer data)
+dialogValueScaleUpdateCallback (GimpScaleEntry *scale,
+ gfloat *value)
{
- DepthMerge *dm = g_object_get_data (G_OBJECT (adjustment), "dm");
+ DepthMerge *dm = g_object_get_data (G_OBJECT (scale), "dm");
- gimp_float_adjustment_update (adjustment, data);
+ *value = (gfloat) gimp_scale_entry_get_value (scale);
DepthMerge_updatePreview (dm);
}
diff --git a/plug-ins/common/destripe.c b/plug-ins/common/destripe.c
index b30733fd03..f002571cba 100644
--- a/plug-ins/common/destripe.c
+++ b/plug-ins/common/destripe.c
@@ -35,7 +35,6 @@
#define PLUG_IN_BINARY "destripe"
#define PLUG_IN_ROLE "gimp-destripe"
#define PLUG_IN_VERSION "0.2"
-#define SCALE_WIDTH 140
#define MAX_AVG 100
@@ -83,6 +82,8 @@ static void destripe_preview (GimpDrawable *drawabl
GimpPreview *preview);
static gboolean destripe_dialog (GimpDrawable *drawable);
+static void destripe_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value);
G_DEFINE_TYPE (Destripe, destripe, GIMP_TYPE_PLUG_IN)
@@ -446,9 +447,8 @@ destripe_dialog (GimpDrawable *drawable)
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
- GtkWidget *grid;
+ GtkWidget *scale;
GtkWidget *button;
- GtkAdjustment *adj;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@@ -483,22 +483,15 @@ destripe_dialog (GimpDrawable *drawable)
G_CALLBACK (destripe_preview),
drawable);
- grid = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
- gtk_box_pack_start (GTK_BOX (main_vbox), grid, FALSE, FALSE, 0);
- gtk_widget_show (grid);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("_Width:"), SCALE_WIDTH, 0,
- vals.avg_width, 2, MAX_AVG, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Width:"), vals.avg_width, 2, MAX_AVG, 0);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (destripe_scale_entry_update_int),
&vals.avg_width);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_box_pack_start (GTK_BOX (main_vbox), scale, FALSE, FALSE, 6);
+ gtk_widget_show (scale);
button = gtk_check_button_new_with_mnemonic (_("Create _histogram"));
gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0);
@@ -520,3 +513,10 @@ destripe_dialog (GimpDrawable *drawable)
return run;
}
+
+static void
+destripe_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value)
+{
+ *value = (gint) gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index 128b9d214d..54e374e272 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -199,6 +199,8 @@ static gboolean save_dialog (GimpImage *image,
static void palette_callback (GtkFileChooser *button,
GimpPreviewArea *preview);
+static void file_raw_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value);
G_DEFINE_TYPE (Raw, raw, GIMP_TYPE_PLUG_IN)
@@ -1750,18 +1752,18 @@ static gboolean
load_dialog (GFile *file,
gboolean is_hgt)
{
- GtkWidget *dialog;
- GtkWidget *main_vbox;
- GtkWidget *preview;
- GtkWidget *sw;
- GtkWidget *viewport;
- GtkWidget *frame;
- GtkWidget *grid;
- GtkWidget *combo;
- GtkWidget *button;
- GtkAdjustment *adj;
- goffset file_size;
- gboolean run;
+ GtkWidget *dialog;
+ GtkWidget *main_vbox;
+ GtkWidget *preview;
+ GtkWidget *sw;
+ GtkWidget *viewport;
+ GtkWidget *frame;
+ GtkWidget *grid;
+ GtkWidget *combo;
+ GtkWidget *button;
+ GtkWidget *scale;
+ goffset file_size;
+ gboolean run;
file_size = get_file_info (file);
@@ -1908,52 +1910,47 @@ load_dialog (GFile *file,
G_CALLBACK (preview_update),
preview);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("O_ffset:"), -1, 9,
- runtime->file_offset, 0, file_size, 1, 1000, 0,
- TRUE, 0.0, 0.0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("O_ffset:"), runtime->file_offset, 0, file_size, 0);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 1, 1000);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (file_raw_scale_entry_update_int),
&runtime->file_offset);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (preview_update),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
if (! is_hgt)
{
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
- _("_Width:"), -1, 9,
- runtime->image_width, 1, file_size, 1, 10, 0,
- TRUE, 0.0, 0.0,
- NULL, NULL);
-
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Width:"), runtime->image_width, 1, file_size, 0);
+
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (file_raw_scale_entry_update_int),
&runtime->image_width);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (preview_update_size),
preview);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (preview_update),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 3,
- _("_Height:"), -1, 9,
- runtime->image_height, 1, file_size, 1, 10, 0,
- TRUE, 0.0, 0.0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_Height:"), runtime->image_height, 1, file_size, 0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (file_raw_scale_entry_update_int),
&runtime->image_height);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (preview_update_size),
preview);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (preview_update),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 3, 3, 1);
+ gtk_widget_show (scale);
}
@@ -1983,18 +1980,17 @@ load_dialog (GFile *file,
G_CALLBACK (palette_update),
preview);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("Off_set:"), -1, 0,
- runtime->palette_offset, 0, 1 << 24, 1, 768, 0,
- TRUE, 0.0, 0.0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Off_set:"), runtime->palette_offset, 0, 1 << 24, 0);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 1, 768);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (file_raw_scale_entry_update_int),
&runtime->palette_offset);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (palette_update),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
button = gtk_file_chooser_button_new (_("Select Palette File"),
GTK_FILE_CHOOSER_ACTION_OPEN);
@@ -2081,3 +2077,10 @@ palette_callback (GtkFileChooser *button,
palette_update (preview);
}
+
+static void
+file_raw_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value)
+{
+ *value = (gint) gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/common/nl-filter.c b/plug-ins/common/nl-filter.c
index d3bb736775..a4c04842bd 100644
--- a/plug-ins/common/nl-filter.c
+++ b/plug-ins/common/nl-filter.c
@@ -107,6 +107,9 @@ static void nlfiltRow (guchar *srclast,
gint bpp,
gint filtno);
+static void nlfilter_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value);
+
G_DEFINE_TYPE (Nlfilter, nlfilter, GIMP_TYPE_PLUG_IN)
@@ -1079,16 +1082,16 @@ nlfilter_preview (GimpDrawable *drawable,
static gboolean
nlfilter_dialog (GimpDrawable *drawable)
{
- GtkWidget *dialog;
- GtkWidget *main_vbox;
- GtkWidget *preview;
- GtkWidget *frame;
- GtkWidget *alpha_trim;
- GtkWidget *opt_est;
- GtkWidget *edge_enhance;
- GtkWidget *grid;
- GtkAdjustment *adj;
- gboolean run;
+ GtkWidget *dialog;
+ GtkWidget *main_vbox;
+ GtkWidget *preview;
+ GtkWidget *frame;
+ GtkWidget *alpha_trim;
+ GtkWidget *opt_est;
+ GtkWidget *edge_enhance;
+ GtkWidget *grid;
+ GtkWidget *scale;
+ gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@@ -1154,29 +1157,25 @@ nlfilter_dialog (GimpDrawable *drawable)
gtk_box_pack_start (GTK_BOX (main_vbox), grid, FALSE, FALSE, 0);
gtk_widget_show (grid);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("A_lpha:"), 0, 0,
- nlfvals.alpha, 0.0, 1.0, 0.05, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("A_lpha:"), nlfvals.alpha, 0.0, 1.0, 2);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (nlfilter_scale_entry_update_double),
&nlfvals.alpha);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("_Radius:"), 0, 0,
- nlfvals.radius, 1.0 / 3.0, 1.0, 0.05, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Radius:"), nlfvals.radius, 1.0 / 3.0, 1.0, 2);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (nlfilter_scale_entry_update_double),
&nlfvals.radius);
- g_signal_connect_swapped (adj, "value-changed",
+ g_signal_connect_swapped (scale, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
gtk_widget_show (dialog);
@@ -1186,3 +1185,10 @@ nlfilter_dialog (GimpDrawable *drawable)
return run;
}
+
+static void
+nlfilter_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value)
+{
+ *value = gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/common/sphere-designer.c b/plug-ins/common/sphere-designer.c
index 70cbc35a6d..d3e85ae00b 100644
--- a/plug-ins/common/sphere-designer.c
+++ b/plug-ins/common/sphere-designer.c
@@ -348,15 +348,15 @@ static struct textures_t textures[] =
static GtkTreeView *texturelist = NULL;
-static GtkAdjustment *scalexscale, *scaleyscale, *scalezscale;
-static GtkAdjustment *rotxscale, *rotyscale, *rotzscale;
-static GtkAdjustment *posxscale, *posyscale, *poszscale;
-static GtkAdjustment *scalescale;
-static GtkAdjustment *turbulencescale;
-static GtkAdjustment *amountscale;
-static GtkAdjustment *expscale;
-static GtkWidget *typemenu;
-static GtkWidget *texturemenu;
+static GtkWidget *scalexscale, *scaleyscale, *scalezscale;
+static GtkWidget *rotxscale, *rotyscale, *rotzscale;
+static GtkWidget *posxscale, *posyscale, *poszscale;
+static GtkWidget *scalescale;
+static GtkWidget *turbulencescale;
+static GtkWidget *amountscale;
+static GtkWidget *expscale;
+static GtkWidget *typemenu;
+static GtkWidget *texturemenu;
#define DOT(a,b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2])
@@ -1899,24 +1899,24 @@ setvals (texture *t)
return;
noupdate = TRUE;
- gtk_adjustment_set_value (amountscale, t->amount);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (amountscale), t->amount);
- gtk_adjustment_set_value (scalescale, t->oscale);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (scalescale), t->oscale);
- gtk_adjustment_set_value (scalexscale, t->scale.x);
- gtk_adjustment_set_value (scaleyscale, t->scale.y);
- gtk_adjustment_set_value (scalezscale, t->scale.z);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (scalexscale), t->scale.x);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (scaleyscale), t->scale.y);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (scalezscale), t->scale.z);
- gtk_adjustment_set_value (rotxscale, t->rotate.x);
- gtk_adjustment_set_value (rotyscale, t->rotate.y);
- gtk_adjustment_set_value (rotzscale, t->rotate.z);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (rotxscale), t->rotate.x);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (rotyscale), t->rotate.y);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (rotzscale), t->rotate.z);
- gtk_adjustment_set_value (posxscale, t->translate.x);
- gtk_adjustment_set_value (posyscale, t->translate.y);
- gtk_adjustment_set_value (poszscale, t->translate.z);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (posxscale), t->translate.x);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (posyscale), t->translate.y);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (poszscale), t->translate.z);
- gtk_adjustment_set_value (turbulencescale, t->turbulence.x);
- gtk_adjustment_set_value (expscale, t->exp);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (turbulencescale), t->turbulence.x);
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (expscale), t->exp);
drawcolor1 (NULL);
drawcolor2 (NULL);
@@ -2444,25 +2444,25 @@ getscales (GtkWidget *widget,
if (!t)
return;
- t->amount = gtk_adjustment_get_value (amountscale);
- t->exp = gtk_adjustment_get_value (expscale);
+ t->amount = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (amountscale));
+ t->exp = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (expscale));
- f = gtk_adjustment_get_value (turbulencescale);
+ f = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (turbulencescale));
vset (&t->turbulence, f, f, f);
- t->oscale = gtk_adjustment_get_value (scalescale);
+ t->oscale = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (scalescale));
- t->scale.x = gtk_adjustment_get_value (scalexscale);
- t->scale.y = gtk_adjustment_get_value (scaleyscale);
- t->scale.z = gtk_adjustment_get_value (scalezscale);
+ t->scale.x = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (scalexscale));
+ t->scale.y = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (scaleyscale));
+ t->scale.z = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (scalezscale));
- t->rotate.x = gtk_adjustment_get_value (rotxscale);
- t->rotate.y = gtk_adjustment_get_value (rotyscale);
- t->rotate.z = gtk_adjustment_get_value (rotzscale);
+ t->rotate.x = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (rotxscale));
+ t->rotate.y = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (rotyscale));
+ t->rotate.z = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (rotzscale));
- t->translate.x = gtk_adjustment_get_value (posxscale);
- t->translate.y = gtk_adjustment_get_value (posyscale);
- t->translate.z = gtk_adjustment_get_value (poszscale);
+ t->translate.x = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (posxscale));
+ t->translate.y = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (posyscale));
+ t->translate.z = gimp_scale_entry_get_value (GIMP_SCALE_ENTRY (poszscale));
restartrender ();
}
@@ -2825,34 +2825,35 @@ makewindow (void)
G_CALLBACK (color2_changed),
NULL);
- scalescale = gimp_scale_entry_new (GTK_GRID (grid), 0, 3, _("Scale:"),
- 100, -1, 1.0, 0.0, 10.0, 0.1, 1.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ scalescale = gimp_scale_entry_new2 (_("Scale:"), 1.0, 0.0, 10.0, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scalescale), 0.1, 1.0);
g_signal_connect (scalescale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scalescale, 0, 3, 3, 1);
+ gtk_widget_show (scalescale);
- turbulencescale = gimp_scale_entry_new (GTK_GRID (grid), 0, 4,
- _("Turbulence:"),
- 100, -1, 1.0, 0.0, 10.0, 0.1, 1.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ turbulencescale = gimp_scale_entry_new2 (_("Turbulence:"), 1.0, 0.0, 10.0, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (turbulencescale), 0.1, 1.0);
g_signal_connect (turbulencescale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), turbulencescale, 0, 4, 3, 1);
+ gtk_widget_show (turbulencescale);
- amountscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 5, _("Amount:"),
- 100, -1, 1.0, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0.0, 0.0, NULL, NULL);
+ amountscale = gimp_scale_entry_new2 (_("Amount:"), 1.0, 0.0, 1.0, 2);
g_signal_connect (amountscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), amountscale, 0, 5, 3, 1);
+ gtk_widget_show (amountscale);
- expscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 6, _("Exp.:"),
- 100, -1, 1.0, 0.0, 1.0, 0.01, 0.1, 2,
- TRUE, 0.0, 0.0, NULL, NULL);
+ expscale = gimp_scale_entry_new2 (_("Exp.:"), 1.0, 0.0, 1.0, 2);
g_signal_connect (expscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), expscale, 0, 6, 3, 1);
+ gtk_widget_show (expscale);
frame = gimp_frame_new (_("Transformations"));
gtk_box_pack_start (GTK_BOX (main_hbox), frame, TRUE, TRUE, 0);
@@ -2868,73 +2869,80 @@ makewindow (void)
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
gtk_widget_show (grid);
- scalexscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 0, _("Scale X:"),
- 100, -1, 1.0, 0.0, 10.0, 0.1, 1.0, 2,
- TRUE, 0.0, 0.0, NULL, NULL);
+ scalexscale = gimp_scale_entry_new2 (_("Scale X:"), 1.0, 0.0, 10.0, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scalexscale), 0.1, 1.0);
g_signal_connect (scalexscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scalexscale, 0, 0, 3, 1);
+ gtk_widget_show (scalexscale);
- scaleyscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 1, _("Scale Y:"),
- 100, -1, 1.0, 0.0, 10.0, 0.1, 1.0, 2,
- TRUE, 0.0, 0.0, NULL, NULL);
+ scaleyscale = gimp_scale_entry_new2 (_("Scale Y:"), 1.0, 0.0, 10.0, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scaleyscale), 0.1, 1.0);
g_signal_connect (scaleyscale, "value-changed",
G_CALLBACK (getscales),
NULL);
- scalezscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 2, _("Scale Z:"),
- 100, -1, 1.0, 0.0, 10.0, 0.1, 1.0, 2,
- TRUE, 0.0, 0.0, NULL, NULL);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 0, 2), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 1, 2), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 2, 2), 6);
+ gtk_grid_attach (GTK_GRID (grid), scaleyscale, 0, 1, 3, 1);
+ gtk_widget_show (scaleyscale);
+
+ scalezscale = gimp_scale_entry_new2 (_("Scale Z:"), 1.0, 0.0, 10.0, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scalezscale), 0.1, 1.0);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scalezscale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_scale(GIMP_SCALE_ENTRY (scalezscale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_spin_button (GIMP_SCALE_ENTRY (scalezscale)), 6);
g_signal_connect (scalezscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scalezscale, 0, 2, 3, 1);
+ gtk_widget_show (scalezscale);
- rotxscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 3, _("Rotate X:"),
- 100, -1, 0.0, 0.0, 360.0, 1.0, 10.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ rotxscale = gimp_scale_entry_new2 (_("Rotate X:"), 0.0, 0.0, 360.0, 1);
g_signal_connect (rotxscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), rotxscale, 0, 3, 3, 1);
+ gtk_widget_show (rotxscale);
- rotyscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 4, _("Rotate Y:"),
- 100, -1, 0.0, 0.0, 360.0, 1.0, 10.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ rotyscale = gimp_scale_entry_new2 (_("Rotate Y:"), 0.0, 0.0, 360.0, 1);
g_signal_connect (rotyscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), rotyscale, 0, 4, 3, 1);
+ gtk_widget_show (rotyscale);
- rotzscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 5, _("Rotate Z:"),
- 100, -1, 0.0, 0.0, 360.0, 1.0, 10.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 0, 5), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 1, 5), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 2, 5), 6);
+ rotzscale = gimp_scale_entry_new2 (_("Rotate Z:"), 0.0, 0.0, 360.0, 1);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (rotzscale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_scale (GIMP_SCALE_ENTRY (rotzscale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_spin_button (GIMP_SCALE_ENTRY (rotzscale)), 6);
g_signal_connect (rotzscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), rotzscale, 0, 5, 3, 1);
+ gtk_widget_show (rotzscale);
- posxscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 6, _("Position X:"),
- 100, -1, 0.0, -20.0, 20.0, 0.1, 1.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ posxscale = gimp_scale_entry_new2 (_("Position X:"), 0.0, -20.0, 20.0, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (posxscale), 0.1, 1.0);
g_signal_connect (posxscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), posxscale, 0, 6, 3, 1);
+ gtk_widget_show (posxscale);
- posyscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 7, _("Position Y:"),
- 100, -1, 0.0, -20.0, 20.0, 0.1, 1.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ posyscale = gimp_scale_entry_new2 (_("Position Y:"), 0.0, -20.0, 20.0, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (posyscale), 0.1, 1.0);
g_signal_connect (posyscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), posyscale, 0, 7, 3, 1);
+ gtk_widget_show (posyscale);
- poszscale = gimp_scale_entry_new (GTK_GRID (grid), 0, 8, _("Position Z:"),
- 100, -1, 0.0, -20.0, 20.0, 0.1, 1.0, 1,
- TRUE, 0.0, 0.0, NULL, NULL);
+ poszscale = gimp_scale_entry_new2 (_("Position Z:"), 0.0, -20.0, 20.0, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (poszscale), 0.1, 1.0);
g_signal_connect (poszscale, "value-changed",
G_CALLBACK (getscales),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), poszscale, 0, 8, 3, 1);
+ gtk_widget_show (poszscale);
gtk_widget_show (window);
diff --git a/plug-ins/common/tile-small.c b/plug-ins/common/tile-small.c
index 7a52487f17..287f1cb397 100644
--- a/plug-ins/common/tile-small.c
+++ b/plug-ins/common/tile-small.c
@@ -50,7 +50,6 @@
/***** Magic numbers *****/
#define PREVIEW_SIZE 128
-#define SCALE_WIDTH 80
#define MAX_SEGS 6
@@ -116,8 +115,8 @@ static GimpValueArray * tile_run (GimpProcedure *procedure,
static gboolean tileit_dialog (GimpDrawable *drawable);
-static void tileit_scale_update (GtkAdjustment *adjustment,
- gpointer data);
+static void tileit_scale_update (GimpScaleEntry *entry,
+ gint *value);
static void tileit_exp_update (GtkWidget *widget,
gpointer value);
@@ -404,12 +403,11 @@ tileit_dialog (GimpDrawable *drawable)
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *grid;
- GtkWidget *grid2;
GtkWidget *button;
GtkWidget *label;
GtkWidget *spinbutton;
GtkAdjustment *adj;
- GtkAdjustment *scale;
+ GtkWidget *scale;
GtkWidget *toggle;
GSList *orientation_group = NULL;
gboolean run;
@@ -621,40 +619,26 @@ tileit_dialog (GimpDrawable *drawable)
/* Widget for selecting the Opacity */
- grid2 = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (grid2), 6);
- gtk_box_pack_start (GTK_BOX (vbox), grid2, FALSE, FALSE, 0);
- gtk_widget_show (grid2);
-
- scale = gimp_scale_entry_new (GTK_GRID (grid2), 0, 0,
- _("O_pacity:"), SCALE_WIDTH, -1,
- opacity, 0, 100, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("O_pacity:"), opacity, 0, 100, 0);
g_signal_connect (scale, "value-changed",
G_CALLBACK (tileit_scale_update),
&opacity);
+ gtk_widget_show (scale);
+ gtk_widget_set_sensitive (scale, gimp_drawable_has_alpha (drawable));
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 6);
+
/* Lower frame saying how many segments */
frame = gimp_frame_new (_("Number of Segments"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
- grid = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
- gtk_container_add (GTK_CONTAINER (frame), grid);
- gtk_widget_show (grid);
-
- gtk_widget_set_sensitive (grid2, gimp_drawable_has_alpha (drawable));
-
- scale = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- "_n²", SCALE_WIDTH, -1,
- itvals.numtiles, 2, MAX_SEGS, 1, 1, 0,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 ("_n²", itvals.numtiles, 2, MAX_SEGS, 0);
g_signal_connect (scale, "value-changed",
G_CALLBACK (tileit_scale_update),
&itvals.numtiles);
+ gtk_container_add (GTK_CONTAINER (frame), scale);
+ gtk_widget_show (scale);
gtk_widget_show (dlg);
dialog_update_preview ();
@@ -874,10 +858,10 @@ tileit_radio_update (GtkWidget *widget,
static void
-tileit_scale_update (GtkAdjustment *adjustment,
- gpointer data)
+tileit_scale_update (GimpScaleEntry *scale,
+ gint *value)
{
- gimp_int_adjustment_update (adjustment, data);
+ *value = RINT (gimp_scale_entry_get_value (scale));
dialog_update_preview ();
}
diff --git a/plug-ins/common/van-gogh-lic.c b/plug-ins/common/van-gogh-lic.c
index 33f962b6d4..c483273b1a 100644
--- a/plug-ins/common/van-gogh-lic.c
+++ b/plug-ins/common/van-gogh-lic.c
@@ -91,6 +91,8 @@ static GimpValueArray * lic_run (GimpProcedure *procedure,
GimpDrawable *drawable,
const GimpValueArray *args,
gpointer run_data);
+static void lic_scale_entry_update (GimpScaleEntry *entry,
+ gdouble *value);
G_DEFINE_TYPE (Lic, lic, GIMP_TYPE_PLUG_IN)
@@ -686,14 +688,14 @@ effect_image_constrain (GimpImage *image,
static gboolean
create_main_dialog (void)
{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *frame;
- GtkWidget *grid;
- GtkWidget *combo;
- GtkAdjustment *scale_data;
- gint row;
- gboolean run;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *frame;
+ GtkWidget *grid;
+ GtkWidget *combo;
+ GtkWidget *scale;
+ gint row;
+ gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@@ -783,50 +785,43 @@ create_main_dialog (void)
row = 0;
- scale_data = gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
- _("_Filter length:"), 0, 6,
- licvals.filtlen, 0.1, 64, 1.0, 8.0, 1,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (scale_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Filter length:"), licvals.filtlen, 0.1, 64, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 1.0, 8.0);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (lic_scale_entry_update),
&licvals.filtlen);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, row++, 3, 1);
+ gtk_widget_show (scale);
- scale_data = gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
- _("_Noise magnitude:"), 0, 6,
- licvals.noisemag, 1, 5, 0.1, 1.0, 1,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (scale_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Noise magnitude:"), licvals.noisemag, 1, 5, 1);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (lic_scale_entry_update),
&licvals.noisemag);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, row++, 3, 1);
+ gtk_widget_show (scale);
- scale_data = gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
- _("In_tegration steps:"), 0, 6,
- licvals.intsteps, 1, 40, 1.0, 5.0, 1,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (scale_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("In_tegration steps:"), licvals.intsteps, 1, 40, 1);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (lic_scale_entry_update),
&licvals.intsteps);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, row++, 3, 1);
+ gtk_widget_show (scale);
- scale_data = gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
- _("_Minimum value:"), 0, 6,
- licvals.minv, -100, 0, 1, 10, 1,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (scale_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Minimum value:"), licvals.minv, -100, 0, 1);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (lic_scale_entry_update),
&licvals.minv);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, row++, 3, 1);
+ gtk_widget_show (scale);
- scale_data = gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
- _("M_aximum value:"), 0, 6,
- licvals.maxv, 0, 100, 1, 10, 1,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (scale_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("M_aximum value:"),
+ licvals.maxv, 0, 100, 1);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (lic_scale_entry_update),
&licvals.maxv);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, row++, 3, 1);
+ gtk_widget_show (scale);
gtk_widget_show (dialog);
@@ -953,3 +948,10 @@ lic_run (GimpProcedure *procedure,
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}
+
+static void
+lic_scale_entry_update (GimpScaleEntry *entry,
+ gdouble *value)
+{
+ *value = gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/flame/flame.c b/plug-ins/flame/flame.c
index e00b45d818..df85a3b71e 100644
--- a/plug-ins/flame/flame.c
+++ b/plug-ins/flame/flame.c
@@ -42,7 +42,6 @@
#define BUFFER_SIZE 10000
-#define SCALE_WIDTH 150
#define PREVIEW_SIZE 150
#define EDIT_PREVIEW_SIZE 85
#define NMUTANTS 9
@@ -104,6 +103,10 @@ static void combo_callback (GtkWidget *widget,
gpointer data);
static void init_mutants (void);
+static void flame_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value);
+static void flame_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value);
G_DEFINE_TYPE (Flame, flame, GIMP_TYPE_PLUG_IN)
@@ -671,16 +674,16 @@ edit_callback (GtkWidget *widget,
if (edit_dialog == NULL)
{
- GtkWidget *main_vbox;
- GtkWidget *frame;
- GtkWidget *grid;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *button;
- GtkWidget *combo;
- GtkWidget *label;
- GtkAdjustment *adj;
- gint i, j;
+ GtkWidget *main_vbox;
+ GtkWidget *frame;
+ GtkWidget *grid;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *button;
+ GtkWidget *combo;
+ GtkWidget *label;
+ GtkWidget *scale;
+ gint i, j;
edit_dialog = gimp_dialog_new (_("Edit Flame"), PLUG_IN_ROLE,
parent, GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -750,24 +753,17 @@ edit_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
- grid = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
- gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
- gtk_widget_show(grid);
-
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("_Speed:"), SCALE_WIDTH, 0,
- pick_speed,
- 0.05, 0.5, 0.01, 0.1, 2,
- TRUE, 0, 0,
- NULL, NULL);
-
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Speed:"), pick_speed, 0.05, 0.5, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.01, 0.1);
+
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&pick_speed);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_edit_preview),
NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 6);
+ gtk_widget_show (scale);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -994,15 +990,15 @@ cmap_constrain (GimpImage *image,
static gboolean
flame_dialog (void)
{
- GtkWidget *main_vbox;
- GtkWidget *notebook;
- GtkWidget *label;
- GtkWidget *frame;
- GtkWidget *button;
- GtkWidget *grid;
- GtkWidget *box;
- GtkAdjustment *adj;
- gboolean run;
+ GtkWidget *main_vbox;
+ GtkWidget *notebook;
+ GtkWidget *label;
+ GtkWidget *frame;
+ GtkWidget *button;
+ GtkWidget *grid;
+ GtkWidget *box;
+ GtkWidget *scale;
+ gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@@ -1114,83 +1110,71 @@ flame_dialog (void)
gtk_box_pack_start (GTK_BOX (box), grid, FALSE, FALSE, 0);
gtk_widget_show (grid);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("_Brightness:"), SCALE_WIDTH, 5,
- config.cp.brightness,
- 0, 5, 0.1, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_Brightness:"), config.cp.brightness, 0, 5, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.brightness);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("Co_ntrast:"), SCALE_WIDTH, 5,
- config.cp.contrast,
- 0, 5, 0.1, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Co_ntrast:"), config.cp.contrast, 0, 5, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.contrast);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
- _("_Gamma:"), SCALE_WIDTH, 5,
- config.cp.gamma,
- 1, 5, 0.1, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 0, 2), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 1, 2), 6);
- gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 2, 2), 6);
-
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("_Gamma:"), config.cp.gamma, 1, 5, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 1.0);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)), 6);
+ gtk_widget_set_margin_bottom (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)), 6);
+
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.gamma);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 3,
- _("Sample _density:"), SCALE_WIDTH, 5,
- config.cp.sample_density,
- 0.1, 20, 1, 5, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Sample _density:"), config.cp.sample_density, 0.1, 20, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.1, 5.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.sample_density);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 3, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 4,
- _("Spa_tial oversample:"), SCALE_WIDTH, 5,
- config.cp.spatial_oversample,
- 1, 4, 0.01, 0.1, 0,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Spa_tial oversample:"), config.cp.spatial_oversample, 1, 4, 0);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.01, 0.1);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_int),
&config.cp.spatial_oversample);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 4, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 5,
- _("Spatial _filter radius:"), SCALE_WIDTH, 5,
- config.cp.spatial_filter_radius,
- 0, 4, 0.2, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("Spatial _filter radius:"), config.cp.spatial_filter_radius, 0, 4, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.2, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.spatial_filter_radius);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 5, 3, 1);
+ gtk_widget_show (scale);
{
GtkWidget *hbox;
@@ -1273,47 +1257,41 @@ flame_dialog (void)
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), grid, label);
gtk_widget_show (grid);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("_Zoom:"), SCALE_WIDTH, 0,
- config.cp.zoom,
- -4, 4, 0.5, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_Zoom:"), config.cp.zoom, -4, 4, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.5, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.zoom);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
- _("_X:"), SCALE_WIDTH, 0,
- config.cp.center[0],
- -2, 2, 0.5, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_X:"), config.cp.center[0], -2, 2, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.5, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.center[0]);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 3, 1);
+ gtk_widget_show (scale);
- adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
- _("_Y:"), SCALE_WIDTH, 0,
- config.cp.center[1],
- -2, 2, 0.5, 1, 2,
- TRUE, 0, 0,
- NULL, NULL);
+ scale = gimp_scale_entry_new2 (_("_Y:"), config.cp.center[1], -2, 2, 2);
+ gimp_scale_entry_set_increments (GIMP_SCALE_ENTRY (scale), 0.5, 1.0);
- g_signal_connect (adj, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (flame_scale_entry_update_double),
&config.cp.center[1]);
- g_signal_connect (adj, "value-changed",
+ g_signal_connect (scale, "value-changed",
G_CALLBACK (set_flame_preview),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 3, 1);
+ gtk_widget_show (scale);
set_flame_preview ();
@@ -1325,3 +1303,17 @@ flame_dialog (void)
return run;
}
+
+static void
+flame_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value)
+{
+ *value = (gint) gimp_scale_entry_get_value (entry);
+}
+
+static void
+flame_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value)
+{
+ *value = gimp_scale_entry_get_value (entry);
+}
diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c
index 29e9b19bec..35dd22a8b4 100644
--- a/plug-ins/gfig/gfig-dialog.c
+++ b/plug-ins/gfig/gfig-dialog.c
@@ -124,14 +124,14 @@ selection_option selopt =
/* Should be kept in sync with GfigOpts */
typedef struct
{
- GtkAdjustment *gridspacing;
- GtkAdjustment *grid_sectors_desired;
- GtkAdjustment *grid_radius_interval;
- GtkWidget *gridtypemenu;
- GtkWidget *drawgrid;
- GtkWidget *snap2grid;
- GtkWidget *lockongrid;
- GtkWidget *showcontrol;
+ GtkWidget *gridspacing;
+ GtkWidget *grid_sectors_desired;
+ GtkWidget *grid_radius_interval;
+ GtkWidget *gridtypemenu;
+ GtkWidget *drawgrid;
+ GtkWidget *snap2grid;
+ GtkWidget *lockongrid;
+ GtkWidget *showcontrol;
} GfigOptWidgets;
static GfigOptWidgets gfig_opt_widget = { NULL, NULL, NULL, NULL, NULL, NULL };
@@ -191,6 +191,11 @@ static void toggle_obj_type (GtkRadioAction *action,
static GtkUIManager *create_ui_manager (GtkWidget *window);
+static void gfig_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value);
+static void gfig_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value);
+
gboolean
gfig_dialog (void)
@@ -1238,7 +1243,7 @@ gfig_prefs_action_callback (GtkAction *widget,
GtkWidget *main_vbox;
GtkWidget *grid;
GtkWidget *toggle;
- GtkAdjustment *size_data;
+ GtkWidget *undo_scale;
GtkWidget *scale;
GtkAdjustment *scale_data;
@@ -1309,15 +1314,12 @@ gfig_prefs_action_callback (GtkAction *widget,
gtk_box_pack_start (GTK_BOX (main_vbox), grid, FALSE, FALSE, 6);
gtk_widget_show (grid);
- size_data = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("Max undo:"), 100, 50,
- selvals.maxundo,
- MIN_UNDO, MAX_UNDO, 1, 2, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (size_data, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ undo_scale = gimp_scale_entry_new2 (_("Max undo:"), selvals.maxundo, MIN_UNDO, MAX_UNDO, 0);
+ g_signal_connect (undo_scale, "value-changed",
+ G_CALLBACK (gfig_scale_entry_update_int),
&selvals.maxundo);
+ gtk_grid_attach (GTK_GRID (grid), undo_scale, 0, 0, 3, 1);
+ gtk_widget_show (undo_scale);
page_menu_bg = gimp_int_combo_box_new (_("Transparent"), LAYER_TRANS_BG,
_("Background"), LAYER_BG_BG,
@@ -1381,13 +1383,13 @@ gfig_grid_action_callback (GtkAction *action,
if (!dialog)
{
- GtkWidget *main_vbox;
- GtkWidget *hbox;
- GtkWidget *grid;
- GtkWidget *combo;
- GtkAdjustment *size_data;
- GtkAdjustment *sectors_data;
- GtkAdjustment *radius_data;
+ GtkWidget *main_vbox;
+ GtkWidget *hbox;
+ GtkWidget *grid;
+ GtkWidget *combo;
+ GtkWidget *grid_scale;
+ GtkWidget *sectors_scale;
+ GtkWidget *radius_scale;
dialog = gimp_dialog_new (_("Grid"), "gimp-gfig-grid",
GTK_WIDGET (data), 0, NULL, NULL,
@@ -1420,59 +1422,52 @@ gfig_grid_action_callback (GtkAction *action,
gtk_box_pack_start (GTK_BOX (main_vbox), grid, FALSE, FALSE, 0);
gtk_widget_show (grid);
- size_data = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("Grid spacing:"), 100, 50,
- selvals.opts.gridspacing,
- MIN_GRID, MAX_GRID, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (size_data, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ grid_scale = gimp_scale_entry_new2 (_("Grid spacing:"),
+ selvals.opts.gridspacing,
+ MIN_GRID, MAX_GRID, 0);
+ g_signal_connect (grid_scale, "value-changed",
+ G_CALLBACK (gfig_scale_entry_update_int),
&selvals.opts.gridspacing);
- g_signal_connect (size_data, "value-changed",
+ g_signal_connect (grid_scale, "value-changed",
G_CALLBACK (draw_grid_clear),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), grid_scale, 0, 0, 3, 1);
+ gtk_widget_show (grid_scale);
- gfig_opt_widget.gridspacing = size_data;
+ gfig_opt_widget.gridspacing = grid_scale;
g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.gridspacing),
(gpointer) &gfig_opt_widget.gridspacing);
- sectors_data = gimp_scale_entry_new (GTK_GRID (grid), 0, 3,
- _("Polar grid sectors desired:"), 1, 5,
- selvals.opts.grid_sectors_desired,
- 5, 360, 5, 1, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (sectors_data, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ sectors_scale = gimp_scale_entry_new2 (_("Polar grid sectors desired:"),
+ selvals.opts.grid_sectors_desired,
+ 5, 360, 0);
+ g_signal_connect (sectors_scale, "value-changed",
+ G_CALLBACK (gfig_scale_entry_update_int),
&selvals.opts.grid_sectors_desired);
- g_signal_connect (sectors_data, "value-changed",
+ g_signal_connect (sectors_scale, "value-changed",
G_CALLBACK (draw_grid_clear),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), sectors_scale, 0, 3, 3, 1);
+ gtk_widget_show (sectors_scale);
- gfig_opt_widget.grid_sectors_desired = sectors_data;
+
+ gfig_opt_widget.grid_sectors_desired = sectors_scale;
g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.grid_sectors_desired),
(gpointer) &gfig_opt_widget.grid_sectors_desired);
-
- gfig_opt_widget.gridspacing = size_data;
- g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.gridspacing),
- (gpointer) &gfig_opt_widget.gridspacing);
-
- radius_data = gimp_scale_entry_new (GTK_GRID (grid), 0, 4,
- _("Polar grid radius interval:"), 1, 5,
- selvals.opts.grid_radius_interval,
- 5, 50, 5, 1, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (radius_data, "value-changed",
- G_CALLBACK (gimp_double_adjustment_update),
+ radius_scale = gimp_scale_entry_new2 (_("Polar grid radius interval:"),
+ selvals.opts.grid_radius_interval,
+ 5, 50, 0);
+ g_signal_connect (radius_scale, "value-changed",
+ G_CALLBACK (gfig_scale_entry_update_double),
&selvals.opts.grid_radius_interval);
- g_signal_connect (radius_data, "value-changed",
+ g_signal_connect (radius_scale, "value-changed",
G_CALLBACK (draw_grid_clear),
NULL);
+ gtk_grid_attach (GTK_GRID (grid), radius_scale, 0, 4, 3, 1);
+ gtk_widget_show (radius_scale);
- gfig_opt_widget.grid_radius_interval = radius_data;
+ gfig_opt_widget.grid_radius_interval = radius_scale;
g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.grid_radius_interval),
(gpointer) &gfig_opt_widget.grid_radius_interval);
@@ -1561,19 +1556,19 @@ options_update (GFigObj *old_obj)
if (selvals.opts.gridspacing != gfig_context->current_obj->opts.gridspacing)
{
if (gfig_opt_widget.gridspacing)
- gtk_adjustment_set_value (gfig_opt_widget.gridspacing,
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (gfig_opt_widget.gridspacing),
gfig_context->current_obj->opts.gridspacing);
}
if (selvals.opts.grid_sectors_desired != gfig_context->current_obj->opts.grid_sectors_desired)
{
if (gfig_opt_widget.grid_sectors_desired)
- gtk_adjustment_set_value (gfig_opt_widget.grid_sectors_desired,
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (gfig_opt_widget.grid_sectors_desired),
gfig_context->current_obj->opts.grid_sectors_desired);
}
if (selvals.opts.grid_radius_interval != gfig_context->current_obj->opts.grid_radius_interval)
{
if (gfig_opt_widget.grid_radius_interval)
- gtk_adjustment_set_value (gfig_opt_widget.grid_radius_interval,
+ gimp_scale_entry_set_value (GIMP_SCALE_ENTRY (gfig_opt_widget.grid_radius_interval),
gfig_context->current_obj->opts.grid_radius_interval);
}
if (selvals.opts.gridtype != gfig_context->current_obj->opts.gridtype)
@@ -1719,8 +1714,8 @@ num_sides_widget (const gchar *d_title,
gint adj_min,
gint adj_max)
{
- GtkWidget *grid;
- GtkAdjustment *size_data;
+ GtkWidget *grid;
+ GtkWidget *scale;
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
@@ -1728,14 +1723,12 @@ num_sides_widget (const gchar *d_title,
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
gtk_widget_show (grid);
- size_data = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
- _("Sides:"), 0, 0,
- *num_sides, adj_min, adj_max, 1, 10, 0,
- TRUE, 0, 0,
- NULL, NULL);
- g_signal_connect (size_data, "value-changed",
- G_CALLBACK (gimp_int_adjustment_update),
+ scale = gimp_scale_entry_new2 (_("Sides:"), *num_sides, adj_min, adj_max, 0);
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK (gfig_scale_entry_update_int),
num_sides);
+ gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 3, 1);
+ gtk_widget_show (scale);
if (which_way)
{
@@ -2192,3 +2185,17 @@ gfig_draw_line (gint x0, gint y0, gint x1, gint y1, cairo_t *cr)
draw_item (cr, FALSE);
}
+
+static void
+gfig_scale_entry_update_double (GimpScaleEntry *entry,
+ gdouble *value)
+{
+ *value = gimp_scale_entry_get_value (entry);
+}
+
+static void
+gfig_scale_entry_update_int (GimpScaleEntry *entry,
+ gint *value)
+{
+ *value = (gint) gimp_scale_entry_get_value (entry);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]