plug-ins/Lighting/lighting_ui.c ported to the new API.

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

	* plug-ins/Lighting/lighting_ui.c
	* plug-ins/MapObject/mapobject_ui.c: ported to the new API.
This commit is contained in:
Sven Neumann 2004-04-20 23:01:03 +00:00 committed by Sven Neumann
parent f4b2b3c146
commit 732fc05fa7
3 changed files with 63 additions and 99 deletions

View File

@ -1,3 +1,8 @@
2004-04-21 Sven Neumann <sven@gimp.org>
* plug-ins/Lighting/lighting_ui.c
* plug-ins/MapObject/mapobject_ui.c: ported to the new API.
2004-04-21 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am

View File

@ -82,17 +82,15 @@ static void toggleenvironment_update (GtkWidget *widget,
static void lightmenu_callback (GtkWidget *widget,
gpointer data);
static gint bumpmap_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static void bumpmap_drawable_callback (gint32 id,
gpointer data);
static gboolean bumpmap_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static gboolean envmap_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static void envmap_combo_callback (GtkWidget *widget,
gpointer data);
static gint envmap_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static void envmap_drawable_callback (gint32 id,
gpointer data);
/*
static GtkWidget *create_bump_page (void);
@ -270,43 +268,32 @@ zoomin_callback (GtkWidget *widget)
static gint
bumpmap_constrain (gint32 image_id,
gint32 drawable_id,
gint32 drawable_id,
gpointer data)
{
if (drawable_id == -1)
return TRUE;
return ((gimp_drawable_width (drawable_id) ==
gimp_drawable_width (mapvals.drawable_id)) &&
(gimp_drawable_height (drawable_id) ==
gimp_drawable_height (mapvals.drawable_id)));
}
static void
bumpmap_drawable_callback (gint32 id,
gpointer data)
{
mapvals.bumpmap_id = id;
}
static gint
envmap_constrain (gint32 image_id,
gint32 drawable_id,
gint32 drawable_id,
gpointer data)
{
if (drawable_id == -1)
return TRUE;
return (!gimp_drawable_is_gray (drawable_id) &&
!gimp_drawable_has_alpha (drawable_id));
}
static void
envmap_drawable_callback (gint32 id,
gpointer data)
envmap_combo_callback (GtkWidget *widget,
gpointer data)
{
mapvals.envmap_id = id;
env_width = gimp_drawable_width (mapvals.envmap_id);
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&mapvals.envmap_id);
env_width = gimp_drawable_width (mapvals.envmap_id);
env_height = gimp_drawable_height (mapvals.envmap_id);
}
@ -873,8 +860,6 @@ create_bump_page (void)
GtkWidget *frame;
GtkWidget *table;
GtkWidget *combo;
GtkWidget *optionmenu;
GtkWidget *menu;
GtkWidget *spinbutton;
GtkObject *adj;
@ -912,13 +897,17 @@ create_bump_page (void)
gtk_widget_set_sensitive (table, mapvals.bump_mapped);
g_object_set_data (G_OBJECT (toggle), "set_sensitive", table);
optionmenu = gtk_option_menu_new ();
menu = gimp_drawable_menu_new (bumpmap_constrain, bumpmap_drawable_callback,
NULL, mapvals.bumpmap_id);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
combo = gimp_drawable_combo_box_new (bumpmap_constrain, NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mapvals.bumpmap_id);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&mapvals.bumpmap_id);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Bumpm_ap Image:"), 1.0, 0.5,
optionmenu, 1, TRUE);
combo, 1, TRUE);
combo = gimp_int_combo_box_new (_("Linear"), LINEAR_MAP,
_("Logarithmic"), LOGARITHMIC_MAP,
@ -963,8 +952,7 @@ create_environment_page (void)
GtkWidget *toggle;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *optionmenu;
GtkWidget *menu;
GtkWidget *combo;
page = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (page), 4);
@ -1000,17 +988,18 @@ create_environment_page (void)
gtk_widget_set_sensitive (table, mapvals.env_mapped);
g_object_set_data (G_OBJECT (toggle), "set_sensitive", table);
optionmenu = gtk_option_menu_new ();
menu = gimp_drawable_menu_new (envmap_constrain, envmap_drawable_callback,
NULL, mapvals.envmap_id);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
combo = gimp_drawable_combo_box_new (envmap_constrain, NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mapvals.envmap_id);
g_signal_connect (combo, "changed",
G_CALLBACK (envmap_combo_callback),
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("En_vironment Image:"), 1.0, 0.5,
optionmenu, 1, TRUE);
gimp_help_set_help_data (optionmenu,
_("Environment image to use"),
NULL);
combo, 1, TRUE);
gimp_help_set_help_data (combo, _("Environment image to use"), NULL);
gtk_widget_show (page);

View File

@ -71,15 +71,10 @@ static void preview_callback (GtkWidget *widget,
static gint box_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static void box_drawable_callback (gint32 id,
static gint cylinder_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static gint cylinder_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
static void cylinder_drawable_callback (gint32 id,
gpointer data);
static GtkWidget * create_options_page (void);
static GtkWidget * create_light_page (void);
static GtkWidget * create_material_page (void);
@ -365,17 +360,6 @@ box_constrain (gint32 image_id,
!gimp_drawable_is_indexed (drawable_id));
}
static void
box_drawable_callback (gint32 id,
gpointer data)
{
gint i;
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data), "_mapwid_id"));
mapvals.boxmap_id[i] = id;
}
static gint
cylinder_constrain (gint32 image_id,
gint32 drawable_id,
@ -388,17 +372,6 @@ cylinder_constrain (gint32 image_id,
!gimp_drawable_is_indexed (drawable_id));
}
static void
cylinder_drawable_callback (gint32 id,
gpointer data)
{
gint i;
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data), "_mapwid_id"));
mapvals.cylindermap_id[i] = id;
}
/******************************/
/* Preview area event handler */
/******************************/
@ -1130,8 +1103,6 @@ create_box_page (void)
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *optionmenu;
GtkWidget *menu;
GtkObject *adj;
gint i;
@ -1160,21 +1131,21 @@ create_box_page (void)
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 5);
gtk_widget_show (table);
/* Option menues */
for (i = 0; i < 6; i++)
{
optionmenu = gtk_option_menu_new ();
g_object_set_data (G_OBJECT (optionmenu), "_mapwid_id",
GINT_TO_POINTER (i));
menu = gimp_drawable_menu_new (box_constrain, box_drawable_callback,
(gpointer) optionmenu,
mapvals.boxmap_id[i]);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
GtkWidget *combo;
combo = gimp_drawable_combo_box_new (box_constrain, NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mapvals.boxmap_id[i]);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&mapvals.boxmap_id[i]);
gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
gettext (labels[i]), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
}
/* Scale scales */
@ -1232,8 +1203,6 @@ create_cylinder_page (void)
GtkWidget *page;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *optionmenu;
GtkWidget *menu;
GtkObject *adj;
gint i;
@ -1257,18 +1226,19 @@ create_cylinder_page (void)
for (i = 0; i < 2; i++)
{
optionmenu = gtk_option_menu_new ();
g_object_set_data (G_OBJECT (optionmenu), "_mapwid_id",
GINT_TO_POINTER (i));
menu = gimp_drawable_menu_new (cylinder_constrain,
cylinder_drawable_callback,
(gpointer) optionmenu,
mapvals.cylindermap_id[i]);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
GtkWidget *combo;
combo = gimp_drawable_combo_box_new (cylinder_constrain, NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
mapvals.cylindermap_id[i]);
g_signal_connect (combo, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&mapvals.cylindermap_id[i]);
gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
gettext (labels[i]), 1.0, 0.5,
optionmenu, 1, FALSE);
combo, 1, FALSE);
}
frame = gtk_frame_new (_("Size"));