Commit b0c328af authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plug-ins/common/align_layers.c plug-ins/common/borderaverage.c

2004-04-20  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/align_layers.c
	* plug-ins/common/borderaverage.c
	* plug-ins/common/channel_mixer.c
	* plug-ins/common/gif.c
	* plug-ins/common/mng.c
	* plug-ins/flame/flame.c
	* plug-ins/gfig/gfig.c: ported remaining plug-ins to GimpIntComboBox.
parent 8cd676ed
2004-04-20 Sven Neumann <sven@gimp.org>
* plug-ins/common/align_layers.c
* plug-ins/common/borderaverage.c
* plug-ins/common/channel_mixer.c
* plug-ins/common/gif.c
* plug-ins/common/mng.c
* plug-ins/flame/flame.c
* plug-ins/gfig/gfig.c: ported remaining plug-ins to GimpIntComboBox.
2004-04-20 Sven Neumann <sven@gimp.org>
* plug-ins/common/iwarp.c (iwarp_get_pixel): check tile != NULL
......
/* align_layers.c -- This is a plug-in for the GIMP (1.0's API)
/* align_layers.c
* Author: Shuji Narazaki <narazaki@InetQ.or.jp>
* Time-stamp: <1999-12-18 05:48:38 yasuhiro>
* Version: 0.26
*
* Copyright (C) 1997-1998 Shuji Narazaki <narazaki@InetQ.or.jp>
......@@ -350,7 +349,7 @@ align_layers_get_align_offsets (gint32 drawable_id,
gint *x,
gint *y)
{
GimpDrawable *layer = gimp_drawable_get (drawable_id);
GimpDrawable *layer = gimp_drawable_get (drawable_id);
switch (VALS.h_base)
{
......@@ -358,7 +357,7 @@ align_layers_get_align_offsets (gint32 drawable_id,
*x = 0;
break;
case H_BASE_CENTER:
*x = (gint) (layer->width / 2);
*x = layer->width / 2;
break;
case H_BASE_RIGHT:
*x = layer->width;
......@@ -367,13 +366,14 @@ align_layers_get_align_offsets (gint32 drawable_id,
*x = 0;
break;
}
switch (VALS.v_base)
{
case V_BASE_TOP:
*y = 0;
break;
case V_BASE_CENTER:
*y = (gint) (layer->height / 2);
*y = layer->height / 2;
break;
case V_BASE_BOTTOM:
*y = layer->height;
......@@ -382,6 +382,8 @@ align_layers_get_align_offsets (gint32 drawable_id,
*y = 0;
break;
}
gimp_drawable_detach (layer);
}
/* dialog stuff */
......@@ -391,7 +393,7 @@ align_layers_dialog (void)
GtkWidget *dlg;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *optionmenu;
GtkWidget *combo;
GtkWidget *toggle;
GtkObject *adj;
gboolean run;
......@@ -419,61 +421,66 @@ align_layers_dialog (void)
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
optionmenu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&VALS.h_style, VALS.h_style,
combo = gimp_int_combo_box_new (_("None"), H_NONE,
_("Collect"), H_COLLECT,
_("Fill (left to right)"), LEFT2RIGHT,
_("Fill (right to left)"), RIGHT2LEFT,
_("Snap to Grid"), SNAP2HGRID,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_style);
_("None"), H_NONE, NULL,
_("Collect"), H_COLLECT, NULL,
_("Fill (left to right)"), LEFT2RIGHT, NULL,
_("Fill (right to left)"), RIGHT2LEFT, NULL,
_("Snap to Grid"), SNAP2HGRID, NULL,
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&VALS.h_style);
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("_Horizontal Style:"), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
optionmenu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&VALS.h_base, VALS.h_base,
combo = gimp_int_combo_box_new (_("Left Edge"), H_BASE_LEFT,
_("Center"), H_BASE_CENTER,
_("Right Edge"), H_BASE_RIGHT,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_base);
_("Left Edge"), H_BASE_LEFT, NULL,
_("Center"), H_BASE_CENTER, NULL,
_("Right Edge"), H_BASE_RIGHT, NULL,
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&VALS.h_base);
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Ho_rizontal Base:"), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
optionmenu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&VALS.v_style, VALS.v_style,
combo = gimp_int_combo_box_new (_("None"), V_NONE,
_("Collect"), V_COLLECT,
_("Fill (top to bottom)"), TOP2BOTTOM,
_("Fill (bottom to top)"), BOTTOM2TOP,
_("Snap to Grid"), SNAP2VGRID,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_style);
_("None"), V_NONE, NULL,
_("Collect"), V_COLLECT, NULL,
_("Fill (top to bottom)"), TOP2BOTTOM, NULL,
_("Fill (bottom to top)"), BOTTOM2TOP, NULL,
_("Snap to Grid"), SNAP2VGRID, NULL,
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&VALS.v_style);
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("_Vertical Style:"), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
optionmenu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&VALS.v_base, VALS.v_base,
combo = gimp_int_combo_box_new (_("Top Edge"), V_BASE_TOP,
_("Center"), V_BASE_CENTER,
_("Bottom Edge"), V_BASE_BOTTOM,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_base);
_("Top Edge"), V_BASE_TOP, NULL,
_("Center"), V_BASE_CENTER, NULL,
_("Bottom Edge"), V_BASE_BOTTOM, NULL,
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&VALS.v_base);
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
_("Ver_tical Base:"), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
toggle = gtk_check_button_new_with_mnemonic
(_("_Ignore the Bottom Layer even if Visible"));
......
......@@ -351,9 +351,12 @@ borderaverage_dialog (void)
GtkWidget *label;
GtkWidget *spinbutton;
GtkObject *adj;
GtkWidget *menu;
GtkWidget *combo;
gboolean run;
const gchar *labels[] =
{ "1", "2", "4", "8", "16", "32", "64", "128", "256" };
gimp_ui_init ("borderaverage", FALSE);
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
......@@ -406,24 +409,17 @@ borderaverage_dialog (void)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
menu = gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&borderaverage_bucket_exponent,
borderaverage_bucket_exponent,
_("1 (nonsense?)"), 0, NULL,
"2", 1, NULL,
"4", 2, NULL,
"8", 3, NULL,
"16", 4, NULL,
"32", 5, NULL,
"64", 6, NULL,
"128", 7, NULL,
_("256 (nonsense?)"), 8, NULL,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
gtk_widget_show (menu);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
combo = gimp_int_combo_box_new_array (G_N_ELEMENTS (labels), labels);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
borderaverage_bucket_exponent);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&borderaverage_bucket_exponent);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
gtk_widget_show (dlg);
......
......@@ -89,7 +89,7 @@ typedef struct
GtkAdjustment *green_data;
GtkAdjustment *blue_data;
GtkWidget *option_menu;
GtkWidget *combo;
CmModeType old_output_channel;
......@@ -146,7 +146,7 @@ static void cm_save_file_callback (GtkWidget *widget,
static void cm_save_file_response_callback (GtkFileSelection *filesel,
gint response_id,
CmParamsType *mix);
static void cm_option_callback (GtkWidget *widget,
static void cm_combo_callback (GtkWidget *widget,
CmParamsType *mix);
static gboolean cm_force_overwrite (const gchar *filename,
......@@ -592,23 +592,24 @@ cm_dialog (void)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
mix.option_menu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (cm_option_callback),
&mix, mix.output_channel,
mix.combo = gimp_int_combo_box_new (_("Red"), CM_RED_CHANNEL,
_("Green"), CM_GREEN_CHANNEL,
_("Blue"), CM_BLUE_CHANNEL,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (mix.combo),
mix.output_channel);
_("Red"), CM_RED_CHANNEL, NULL,
_("Green"), CM_GREEN_CHANNEL, NULL,
_("Blue"), CM_BLUE_CHANNEL, NULL,
NULL);
g_signal_connect (mix.combo, "changed",
G_CALLBACK (cm_combo_callback),
&mix);
gtk_box_pack_start (GTK_BOX (hbox), mix.option_menu, FALSE, FALSE, 0);
gtk_widget_show (mix.option_menu);
gtk_box_pack_start (GTK_BOX (hbox), mix.combo, FALSE, FALSE, 0);
gtk_widget_show (mix.combo);
if (mix.monochrome_flag == TRUE)
gtk_widget_set_sensitive (mix.option_menu, FALSE);
if (mix.monochrome_flag)
gtk_widget_set_sensitive (mix.combo, FALSE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), mix.option_menu);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), mix.combo);
/*........................................................... */
......@@ -960,13 +961,13 @@ cm_monochrome_callback (GtkWidget *widget,
{
mix->old_output_channel = mix->output_channel;
mix->monochrome_flag = TRUE;
gtk_widget_set_sensitive (mix->option_menu, FALSE);
gtk_widget_set_sensitive (mix->combo, FALSE);
}
else
{
mix->output_channel = mix->old_output_channel;
mix->monochrome_flag = FALSE;
gtk_widget_set_sensitive (mix->option_menu, TRUE);
gtk_widget_set_sensitive (mix->combo, TRUE);
}
cm_set_adjusters (mix);
......@@ -1139,8 +1140,8 @@ cm_load_file_response_callback (GtkFileSelection *fs,
fclose (fp);
gimp_int_option_menu_set_history (GTK_OPTION_MENU (mix->option_menu),
mix->output_channel);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (mix->combo),
mix->output_channel);
cm_set_adjusters (mix);
if (mix->preview_flag)
......@@ -1149,7 +1150,8 @@ cm_load_file_response_callback (GtkFileSelection *fs,
else
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (mix->filename), g_strerror (errno));
gimp_filename_to_utf8 (mix->filename),
g_strerror (errno));
}
}
......@@ -1368,10 +1370,11 @@ cm_save_file (CmParamsType *mix,
*
*--------------------------------------------------------------------*/
static void
cm_option_callback (GtkWidget *widget,
CmParamsType *mix)
cm_combo_callback (GtkWidget *widget,
CmParamsType *mix)
{
gimp_menu_item_update (widget, &mix->output_channel);
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
(gint *) &mix->output_channel);
cm_set_adjusters (mix);
}
......
......@@ -1248,7 +1248,7 @@ save_dialog (gint32 image_ID)
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *align;
GtkWidget *disposal_option_menu;
GtkWidget *combo;
GtkWidget *scrolled_window;
#ifdef FACEHUGGERS
GimpParasite *GIF2_CMNT;
......@@ -1404,20 +1404,22 @@ save_dialog (gint32 image_ID)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
disposal_option_menu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
&gsvals.default_dispose, gsvals.default_dispose,
combo = gimp_int_combo_box_new (_("I don't Care"),
DISPOSE_UNSPECIFIED,
_("Cumulative Layers (Combine)"),
DISPOSE_COMBINE,
_("One Frame per Layer (Replace)"),
DISPOSE_REPLACE,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
gsvals.default_dispose);
_("I don't Care"),
DISPOSE_UNSPECIFIED, NULL,
_("Cumulative Layers (Combine)"),
DISPOSE_COMBINE, NULL,
_("One Frame per Layer (Replace)"),
DISPOSE_REPLACE, NULL,
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&gsvals.default_dispose);
NULL);
gtk_box_pack_start (GTK_BOX (hbox), disposal_option_menu, FALSE, FALSE, 0);
gtk_widget_show (disposal_option_menu);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
......@@ -1425,10 +1427,10 @@ save_dialog (gint32 image_ID)
/* If the image has only one layer it can't be animated, so
desensitize the animation options. */
if (nlayers == 1) gtk_widget_set_sensitive (frame, FALSE);
if (nlayers == 1)
gtk_widget_set_sensitive (frame, FALSE);
gtk_widget_show (frame);
gtk_widget_show (dlg);
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
......
......@@ -1174,7 +1174,7 @@ mng_save_dialog (gint32 image_id)
GtkWidget *table;
GtkWidget *toggle;
GtkWidget *hbox;
GtkWidget *menu;
GtkWidget *combo;
GtkWidget *label;
GtkWidget *scale;
GtkObject *scale_adj;
......@@ -1268,46 +1268,42 @@ mng_save_dialog (gint32 image_id)
gimp_image_get_layers (image_id, &num_layers);
if (num_layers == 1)
menu = gimp_int_option_menu_new (FALSE,
G_CALLBACK (gimp_menu_item_update),
&mng_data.default_chunks,
mng_data.default_chunks,
_("PNG"), CHUNKS_PNG_D, NULL,
_("JNG"), CHUNKS_JNG_D, NULL,
NULL);
combo = gimp_int_combo_box_new (_("PNG"), CHUNKS_PNG_D,
_("JNG"), CHUNKS_JNG_D,
NULL);
else
menu = gimp_int_option_menu_new (FALSE,
G_CALLBACK (gimp_menu_item_update),
&mng_data.default_chunks,
mng_data.default_chunks,
combo = gimp_int_combo_box_new (_("PNG + Delta PNG"), CHUNKS_PNG_D,
_("JNG + Delta PNG"), CHUNKS_JNG_D,
_("All PNG"), CHUNKS_PNG,
_("All JNG"), CHUNKS_JNG,
NULL);
_("PNG + Delta PNG"), CHUNKS_PNG_D, NULL,
_("JNG + Delta PNG"), CHUNKS_JNG_D, NULL,
_("All PNG"), CHUNKS_PNG, NULL,
_("All JNG"), CHUNKS_JNG, NULL,
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mng_data.default_chunks);
NULL);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&mng_data.default_chunks);
gtk_widget_set_sensitive (menu, FALSE);
gtk_widget_set_sensitive (combo, FALSE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Default Chunks Type:"), 1.0, 0.5,
menu, 1, FALSE);
combo, 1, FALSE);
menu = gimp_int_option_menu_new (FALSE,
G_CALLBACK (gimp_menu_item_update),
&mng_data.default_dispose,
mng_data.default_dispose,
combo = gimp_int_combo_box_new (_("Combine"), DISPOSE_COMBINE,
_("Replace"), DISPOSE_REPLACE,
NULL);
_("Combine"), DISPOSE_COMBINE, NULL,
_("Replace"), DISPOSE_REPLACE, NULL,
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mng_data.default_dispose);
NULL);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&mng_data.default_dispose);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Default Frame Disposal:"), 1.0, 0.5,
menu, 1, FALSE);
combo, 1, FALSE);
scale_adj = gtk_adjustment_new (mng_data.compression_level,
0.0, 9.0, 1.0, 1.0, 0.0);
......
......@@ -66,7 +66,7 @@ static void load_callback (GtkWidget *widget,
static void save_callback (GtkWidget *widget,
gpointer data);
static void set_edit_preview (void);
static void menu_cb (GtkWidget *widget,
static void combo_callback (GtkWidget *widget,
gpointer data);
static void init_mutants (void);
......@@ -616,7 +616,7 @@ edit_callback (GtkWidget *widget,
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *optionmenu;
GtkWidget *combo;
GtkWidget *label;
GtkObject *adj;
gint i, j;
......@@ -711,27 +711,30 @@ edit_callback (GtkWidget *widget,
G_CALLBACK (randomize_callback),
NULL);
optionmenu =
gimp_int_option_menu_new (FALSE, G_CALLBACK (menu_cb),
&config.variation, VARIATION_SAME,
combo = gimp_int_combo_box_new (_("Same"), VARIATION_SAME,
_("Random"), variation_random,
_("Linear"), 0,
_("Sinusoidal"), 1,
_("Spherical"), 2,
_("Swirl"), 3,
_("Horseshoe"), 4,
_("Polar"), 5,
_("Bent"), 6,
NULL);
_("Same"), VARIATION_SAME, NULL,
_("Random"), variation_random, NULL,
_("Linear"), 0, NULL,
_("Sinusoidal"), 1, NULL,
_("Spherical"), 2, NULL,
_("Swirl"), 3, NULL,
_("Horseshoe"), 4, NULL,
_("Polar"), 5, NULL,
_("Bent"), 6, NULL,
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
VARIATION_SAME);
NULL);
gtk_box_pack_end (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
g_signal_connect (combo, "changed",
G_CALLBACK (combo_callback),
&config.variation);
gtk_box_pack_end (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
label = gtk_label_new_with_mnemonic (_("_Variation:"));
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), optionmenu);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
gtk_widget_show (label);
gtk_widget_show (main_vbox);
......@@ -775,13 +778,14 @@ save_callback (GtkWidget *widget,
}
static void
menu_cb (GtkWidget *widget,
gpointer data)
combo_callback (GtkWidget *widget,
gpointer data)
{
gimp_menu_item_update (widget, data);
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
if (VARIATION_SAME != config.variation)
random_control_point (&edit_cp, config.variation);
init_mutants ();
set_edit_preview ();
}
......@@ -1073,7 +1077,7 @@ dialog (void)
GtkWidget *label;
GtkWidget *menuitem;
GtkWidget *option_menu;
gint32 save_drawable = config.cmap_drawable;
gint32 save_drawable = config.cmap_drawable;
sep = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box), sep, FALSE, FALSE, 0);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment