2000-08-29 02:47:33 +08:00
|
|
|
/* Lighting Effects - A plug-in for GIMP
|
|
|
|
*
|
|
|
|
* Dialog creation and updaters, callbacks and event-handlers
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-12-30 08:23:34 +08:00
|
|
|
#include "config.h"
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
#include <libgimp/gimp.h>
|
2000-02-18 07:48:13 +08:00
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
#include "lighting_ui.h"
|
2000-02-18 07:48:13 +08:00
|
|
|
#include "lighting_main.h"
|
|
|
|
#include "lighting_image.h"
|
|
|
|
#include "lighting_apply.h"
|
|
|
|
#include "lighting_preview.h"
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
#include "amb1.xpm"
|
|
|
|
#include "amb2.xpm"
|
|
|
|
#include "diffint1.xpm"
|
|
|
|
#include "diffint2.xpm"
|
|
|
|
#include "diffref1.xpm"
|
|
|
|
#include "diffref2.xpm"
|
|
|
|
#include "specref1.xpm"
|
|
|
|
#include "specref2.xpm"
|
|
|
|
#include "high1.xpm"
|
|
|
|
#include "high2.xpm"
|
2000-12-30 08:23:34 +08:00
|
|
|
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
extern LightingValues mapvals;
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *appwin = NULL;
|
|
|
|
static GtkNotebook *options_note_book = NULL;
|
2000-08-29 22:27:40 +08:00
|
|
|
|
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *bump_page = NULL;
|
|
|
|
static GtkWidget *env_page = NULL;
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
GdkGC *gc = NULL;
|
|
|
|
GtkWidget *previewarea = NULL;
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *pointlightwid = NULL;
|
|
|
|
static GtkWidget *dirlightwid = NULL;
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static gint bump_page_pos = -1;
|
|
|
|
static gint env_page_pos = -1;
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
static void create_main_notebook (GtkWidget *container);
|
|
|
|
|
applied gimp-lecorfec-99041[02]-0, changes follow
* applied gimp-lecorfec-99041[02]-0, changes follow
* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.
* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.
* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.
* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.
* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).
* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)
* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.
* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).
* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.
* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).
* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.
* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".
* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.
* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).
* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.
* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.
* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.
* plug-ins/exchange/exchange.c (real_exchange):
ditto.
* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.
* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).
* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)
-Yosh
1999-04-16 05:49:09 +08:00
|
|
|
#ifdef _LIGHTNING_UNUSED_CODE
|
2000-02-18 07:48:13 +08:00
|
|
|
static void xyzval_update (GtkEntry *entry);
|
applied gimp-lecorfec-99041[02]-0, changes follow
* applied gimp-lecorfec-99041[02]-0, changes follow
* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.
* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.
* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.
* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.
* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).
* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)
* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.
* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).
* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.
* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).
* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.
* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".
* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.
* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).
* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.
* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.
* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.
* plug-ins/exchange/exchange.c (real_exchange):
ditto.
* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.
* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).
* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)
-Yosh
1999-04-16 05:49:09 +08:00
|
|
|
#endif
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
static void toggle_update (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static void togglebump_update (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2000-08-29 02:47:33 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void toggleenvironment_update (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
static void lightmenu_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
|
2004-04-21 07:01:03 +08:00
|
|
|
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);
|
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *create_bump_page (void);
|
2000-08-29 22:27:40 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *create_environment_page (void);
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2000-02-18 07:48:13 +08:00
|
|
|
|
applied gimp-lecorfec-99041[02]-0, changes follow
* applied gimp-lecorfec-99041[02]-0, changes follow
* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.
* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.
* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.
* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.
* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).
* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)
* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.
* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).
* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.
* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).
* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.
* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".
* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.
* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).
* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.
* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.
* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.
* plug-ins/exchange/exchange.c (real_exchange):
ditto.
* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.
* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).
* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)
-Yosh
1999-04-16 05:49:09 +08:00
|
|
|
#ifdef _LIGHTNING_UNUSED_CODE
|
1998-06-11 14:04:59 +08:00
|
|
|
/**********************************************************/
|
|
|
|
/* Update entry fields that affect the preview parameters */
|
|
|
|
/**********************************************************/
|
|
|
|
|
2000-12-30 08:23:34 +08:00
|
|
|
static void
|
|
|
|
xyzval_update (GtkEntry *entry)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
|
|
|
gdouble *valueptr;
|
2000-12-30 08:23:34 +08:00
|
|
|
gdouble value;
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
valueptr = (gdouble *) g_object_get_data (G_OBJECT (entry), "ValuePtr");
|
2000-12-30 08:23:34 +08:00
|
|
|
value = atof (gtk_entry_get_text (entry));
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-12-30 08:23:34 +08:00
|
|
|
*valueptr = value;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
applied gimp-lecorfec-99041[02]-0, changes follow
* applied gimp-lecorfec-99041[02]-0, changes follow
* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.
* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.
* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.
* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.
* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).
* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)
* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.
* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).
* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.
* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).
* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.
* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".
* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.
* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).
* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.
* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.
* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.
* plug-ins/exchange/exchange.c (real_exchange):
ditto.
* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.
* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).
* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)
-Yosh
1999-04-16 05:49:09 +08:00
|
|
|
#endif
|
1998-06-11 14:04:59 +08:00
|
|
|
|
|
|
|
/**********************/
|
|
|
|
/* Std. toggle update */
|
|
|
|
/**********************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
toggle_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_toggle_button_update (widget, data);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
draw_preview_image (TRUE);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/* Toggle bumpmapping update */
|
|
|
|
/*****************************/
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
togglebump_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_toggle_button_update (widget, data);
|
2003-10-30 04:57:21 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
if (mapvals.bump_mapped)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
bump_page_pos = g_list_length (options_note_book->children);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
bump_page = create_bump_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, bump_page,
|
2000-08-29 02:47:33 +08:00
|
|
|
gtk_label_new (_("Bumpmap")));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
else
|
2002-12-18 04:18:16 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_notebook_remove_page (options_note_book, bump_page_pos);
|
|
|
|
if (bump_page_pos < env_page_pos)
|
1998-06-11 14:04:59 +08:00
|
|
|
env_page_pos--;
|
|
|
|
bump_page_pos = 0;
|
|
|
|
}
|
|
|
|
}
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2002-10-17 05:18:11 +08:00
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
/*************************************/
|
|
|
|
/* Toggle environment mapping update */
|
|
|
|
/*************************************/
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
toggleenvironment_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_toggle_button_update (widget, data);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
if (mapvals.env_mapped)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
env_page_pos = g_list_length (options_note_book->children);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
env_page = create_environment_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, env_page,
|
2000-08-29 02:47:33 +08:00
|
|
|
gtk_label_new (_("Environment")));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_notebook_remove_page (options_note_book, env_page_pos);
|
|
|
|
if (env_page_pos < bump_page_pos)
|
1998-06-11 14:04:59 +08:00
|
|
|
bump_page_pos--;
|
|
|
|
env_page_pos = 0;
|
|
|
|
}
|
|
|
|
}
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2002-10-17 05:18:11 +08:00
|
|
|
|
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
/*****************************************/
|
|
|
|
/* Main window light type menu callback. */
|
|
|
|
/*****************************************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
lightmenu_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
if (mapvals.lightsource.type == POINT_LIGHT)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_hide (dirlightwid);
|
|
|
|
gtk_widget_show (pointlightwid);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2000-02-18 07:48:13 +08:00
|
|
|
else if (mapvals.lightsource.type == DIRECTIONAL_LIGHT)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_hide (pointlightwid);
|
|
|
|
gtk_widget_show (dirlightwid);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_hide (pointlightwid);
|
|
|
|
gtk_widget_hide (dirlightwid);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
interactive_preview_callback(NULL);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
mapmenu2_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
draw_preview_image (TRUE);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************/
|
|
|
|
/* Main window "Preview!" button callback */
|
|
|
|
/******************************************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
preview_callback (GtkWidget *widget)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
draw_preview_image (TRUE);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
/*********************************************/
|
|
|
|
/* Main window "-" (zoom in) button callback */
|
|
|
|
/*********************************************/
|
2000-08-29 02:47:33 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
zoomout_callback (GtkWidget *widget)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
mapvals.preview_zoom_factor *= 0.5;
|
|
|
|
draw_preview_image (TRUE);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2000-08-29 02:47:33 +08:00
|
|
|
*/
|
1998-06-11 14:04:59 +08:00
|
|
|
/*********************************************/
|
|
|
|
/* Main window "+" (zoom out) button callback */
|
|
|
|
/*********************************************/
|
2000-08-29 02:47:33 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
zoomin_callback (GtkWidget *widget)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
mapvals.preview_zoom_factor *= 2.0;
|
|
|
|
draw_preview_image (TRUE);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2000-08-29 02:47:33 +08:00
|
|
|
*/
|
1998-06-11 14:04:59 +08:00
|
|
|
/**********************************************/
|
2003-10-30 04:57:21 +08:00
|
|
|
/* Main window "Apply" button callback. */
|
1998-06-11 14:04:59 +08:00
|
|
|
/* Render to GIMP image, close down and exit. */
|
|
|
|
/**********************************************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static gint
|
|
|
|
bumpmap_constrain (gint32 image_id,
|
2004-04-21 07:01:03 +08:00
|
|
|
gint32 drawable_id,
|
2000-02-18 07:48:13 +08:00
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2002-10-17 05:18:11 +08:00
|
|
|
return ((gimp_drawable_width (drawable_id) ==
|
2002-12-18 04:18:16 +08:00
|
|
|
gimp_drawable_width (mapvals.drawable_id)) &&
|
|
|
|
(gimp_drawable_height (drawable_id) ==
|
|
|
|
gimp_drawable_height (mapvals.drawable_id)));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static gint
|
|
|
|
envmap_constrain (gint32 image_id,
|
2004-04-21 07:01:03 +08:00
|
|
|
gint32 drawable_id,
|
2000-02-18 07:48:13 +08:00
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
return (!gimp_drawable_is_gray (drawable_id) &&
|
|
|
|
!gimp_drawable_has_alpha (drawable_id));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
2004-04-21 07:01:03 +08:00
|
|
|
envmap_combo_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2004-04-21 07:01:03 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
|
|
|
|
&mapvals.envmap_id);
|
|
|
|
|
|
|
|
env_width = gimp_drawable_width (mapvals.envmap_id);
|
2000-02-18 07:48:13 +08:00
|
|
|
env_height = gimp_drawable_height (mapvals.envmap_id);
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************/
|
|
|
|
/* Dialog constructors */
|
|
|
|
/***********************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *
|
|
|
|
create_options_page (void)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *toggle;
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
page = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
/* General options */
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
frame = gimp_frame_new (_("General Options"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
2004-04-20 16:35:36 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
toggle = gtk_check_button_new_with_label (_("Use Bump Mapping"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.bump_mapped);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (togglebump_update),
|
|
|
|
&mapvals.bump_mapped);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Enable/disable bump-mapping (image depth)"),
|
|
|
|
NULL);
|
2003-10-30 04:57:21 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
toggle = gtk_check_button_new_with_label (_("Use Environment Mapping"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.env_mapped);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (toggleenvironment_update),
|
|
|
|
&mapvals.env_mapped);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Enable/disable environment mapping (reflection)"),
|
|
|
|
NULL);
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("T_ransparent Background"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.transparent_background);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (toggle_update),
|
|
|
|
&mapvals.transparent_background);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Make destination image transparent where bump "
|
|
|
|
"height is zero"),NULL);
|
|
|
|
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("Cre_ate New Image"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.create_new_image);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&mapvals.create_new_image);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Create a new image when applying filter"), NULL);
|
|
|
|
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("High _Quality Preview"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.previewquality);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (toggle_update),
|
|
|
|
&mapvals.previewquality);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
2000-08-29 02:47:33 +08:00
|
|
|
_("Enable/disable high quality preview"), NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-04-05 08:35:46 +08:00
|
|
|
#if 0
|
2000-02-18 07:48:13 +08:00
|
|
|
/* Antialiasing options */
|
2004-04-05 08:35:46 +08:00
|
|
|
/* commented out -- there is no code to implement this -- WES 4/02/04 */
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-09-07 04:44:47 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("E_nable Antialiasing"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.antialiasing);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
|
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&mapvals.antialiasing);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 12);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (table, mapvals.antialiasing);
|
2001-12-29 21:26:29 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "set_sensitive", table);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("_Depth:"), 0, 6,
|
2000-08-29 22:27:40 +08:00
|
|
|
mapvals.max_depth, 1.0, 5.0, 0.5, 1.0,
|
|
|
|
1, TRUE, 0, 0,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Antialiasing quality. Higher is better, "
|
|
|
|
"but slower"), NULL);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.max_depth);
|
2003-10-30 04:57:21 +08:00
|
|
|
|
2004-04-05 08:35:46 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("T_hreshold:"), 0, 6,
|
2000-08-29 02:47:33 +08:00
|
|
|
mapvals.pixel_treshold, 0.01, 1000.0, 1.0, 15.0, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Stop when pixel differences are smaller than "
|
|
|
|
"this value"), NULL);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.pixel_treshold);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.pixel_treshold,
|
|
|
|
0.001, 1000, 0.1, 1, 1, 0, 3);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.pixel_treshold);
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Threshold:"), 0.0, 1.0,
|
2000-02-18 07:48:13 +08:00
|
|
|
spinbutton, 1, TRUE);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Stop when pixel differences are smaller than "
|
|
|
|
"this value"), NULL);
|
2004-04-05 08:35:46 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (page);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
return page;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************/
|
|
|
|
/* Create light settings page */
|
|
|
|
/******************************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *
|
|
|
|
create_light_page (void)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
2004-04-20 16:35:36 +08:00
|
|
|
GtkWidget *combo;
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *colorbutton;
|
|
|
|
GtkObject *adj;
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
page = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
frame = gimp_frame_new (_("Light Settings"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new (_("None"), NO_LIGHT,
|
|
|
|
_("Directional"), DIRECTIONAL_LIGHT,
|
|
|
|
_("Point"), POINT_LIGHT,
|
|
|
|
/* _("Spot"), SPOT_LIGHT, */
|
|
|
|
NULL);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
mapvals.lightsource.type);
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (lightmenu_callback),
|
|
|
|
&mapvals.lightsource.type);
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-28 08:21:37 +08:00
|
|
|
_("L_ight Type:"), 0.0, 0.5, combo, 1, FALSE);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_help_set_help_data (combo, _("Type of light source to apply"), NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2001-01-11 06:49:45 +08:00
|
|
|
colorbutton = gimp_color_button_new (_("Select Lightsource Color"),
|
|
|
|
64, 16,
|
2001-01-15 14:24:24 +08:00
|
|
|
&mapvals.lightsource.color,
|
|
|
|
GIMP_COLOR_AREA_FLAT);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (colorbutton, "color_changed",
|
2003-10-30 04:57:21 +08:00
|
|
|
G_CALLBACK (gimp_color_button_get_color),
|
2001-12-29 21:26:29 +08:00
|
|
|
&mapvals.lightsource.color);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (colorbutton, "color_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Lig_ht Color:"), 0.0, 0.5,
|
2004-05-28 08:21:37 +08:00
|
|
|
colorbutton, 1, FALSE);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (colorbutton,
|
|
|
|
_("Set light source color"), NULL);
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
pointlightwid = gimp_frame_new (_("Position"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), pointlightwid, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
if (mapvals.lightsource.type == POINT_LIGHT)
|
|
|
|
gtk_widget_show (pointlightwid);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (pointlightwid), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_x = gimp_spin_button_new (&adj, mapvals.lightsource.position.x,
|
2000-02-21 20:05:45 +08:00
|
|
|
-G_MAXFLOAT, G_MAXFLOAT,
|
2000-02-18 07:48:13 +08:00
|
|
|
0.1, 1.0, 1.0, 0.0, 2);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_X:"), 0.0, 0.5,
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_x, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.position.x);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data ( spin_pos_x,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source X position in XYZ space"), NULL);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_y = gimp_spin_button_new (&adj, mapvals.lightsource.position.y,
|
2000-02-21 20:05:45 +08:00
|
|
|
-G_MAXFLOAT, G_MAXFLOAT,
|
2000-02-18 07:48:13 +08:00
|
|
|
0.1, 1.0, 1.0, 0.0, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Y:"), 0.0, 0.5,
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_y, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.position.y);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data ( spin_pos_y,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source Y position in XYZ space"), NULL);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_z = gimp_spin_button_new (&adj, mapvals.lightsource.position.z,
|
2000-02-21 20:05:45 +08:00
|
|
|
-G_MAXFLOAT, G_MAXFLOAT,
|
2000-02-18 07:48:13 +08:00
|
|
|
0.1, 1.0, 1.0, 0.0, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Z:"), 0.0, 0.5,
|
2002-10-17 05:18:11 +08:00
|
|
|
spin_pos_z, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.position.z);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
gimp_help_set_help_data (spin_pos_z,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source Z position in XYZ space"), NULL);
|
|
|
|
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
dirlightwid = gimp_frame_new (_("Direction Vector"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), dirlightwid, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
if (mapvals.lightsource.type == DIRECTIONAL_LIGHT)
|
|
|
|
gtk_widget_show (dirlightwid);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (dirlightwid), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_x = gimp_spin_button_new (&adj, mapvals.lightsource.direction.x,
|
2000-02-18 07:48:13 +08:00
|
|
|
-1.0, 1.0, 0.01, 0.1, 1.0, 0.0, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("X:"), 0.0, 0.5,
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_x, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.direction.x);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
gimp_help_set_help_data (spin_dir_x,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source X direction in XYZ space"), NULL);
|
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_y = gimp_spin_button_new (&adj, mapvals.lightsource.direction.y,
|
2000-02-18 07:48:13 +08:00
|
|
|
-1.0, 1.0, 0.01, 0.1, 1.0, 0.0, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Y:"), 0.0, 0.5,
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_y, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.direction.y);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
gimp_help_set_help_data (spin_dir_y,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source Y direction in XYZ space"), NULL);
|
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_z = gimp_spin_button_new (&adj, mapvals.lightsource.direction.z,
|
2000-02-18 07:48:13 +08:00
|
|
|
-1.0, 1.0, 0.01, 0.1, 1.0, 0.0, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Z:"), 0.0, 0.5,
|
2002-12-18 04:18:16 +08:00
|
|
|
spin_dir_z, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.lightsource.direction.z);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-12-18 04:18:16 +08:00
|
|
|
gimp_help_set_help_data (spin_dir_z,
|
2000-02-18 07:48:13 +08:00
|
|
|
_("Light source Z direction in XYZ space"), NULL);
|
|
|
|
|
|
|
|
gtk_widget_show (page);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2003-10-30 04:57:21 +08:00
|
|
|
return page;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************/
|
|
|
|
/* Create material settings page */
|
|
|
|
/*********************************/
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *
|
|
|
|
create_material_page (void)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2004-05-20 23:05:48 +08:00
|
|
|
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkObject *adj;
|
|
|
|
GtkWidget *pixmap;
|
|
|
|
|
|
|
|
page = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
|
|
|
|
|
|
|
|
frame = gimp_frame_new (_("Intensity Levels"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 4, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* Ambient intensity */
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (amb1_xpm);
|
2002-05-28 01:25:30 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Ambient:"), 0.0, 0.5,
|
2002-05-28 01:25:30 +08:00
|
|
|
pixmap, 1, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-18 07:48:13 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.material.ambient_int,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.1, 1.0, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.material.ambient_int);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Amount of original color to show where no "
|
|
|
|
"direct light falls"), NULL);
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (amb2_xpm);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
/* Diffuse intensity */
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (diffint1_xpm);
|
2002-05-28 01:25:30 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Diffuse:"), 0.0, 0.5,
|
2002-05-28 01:25:30 +08:00
|
|
|
pixmap, 1, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.material.diffuse_int,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.1, 1.0, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.material.diffuse_int);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Intensity of original color when lit by a light "
|
|
|
|
"source"), NULL);
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (diffint2_xpm);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
frame = gimp_frame_new (_("Reflectivity"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 4, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* Diffuse reflection */
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (diffref1_xpm);
|
2002-05-28 01:25:30 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("D_iffuse:"), 0.0, 0.5,
|
2002-05-28 01:25:30 +08:00
|
|
|
pixmap, 1, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.material.diffuse_ref,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.1, 1.0, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.material.diffuse_ref);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-12-18 04:18:16 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Higher values makes the object reflect more "
|
|
|
|
"light (appear lighter)"), NULL);
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (diffref2_xpm);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
/* Specular reflection */
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (specref1_xpm);
|
2002-05-28 01:25:30 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Specular:"), 0.0, 0.5,
|
2002-05-28 01:25:30 +08:00
|
|
|
pixmap, 1, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.material.specular_ref,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.1, 1.0, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.material.specular_ref);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-12-18 04:18:16 +08:00
|
|
|
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Controls how intense the highlights will be"),
|
|
|
|
NULL);
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (specref2_xpm);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
/* Highlight */
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (high1_xpm);
|
2002-05-28 01:25:30 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("_Highlight:"), 0.0, 0.5,
|
2002-05-28 01:25:30 +08:00
|
|
|
pixmap, 1, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.material.highlight,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.1, 1.0, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 2, 3,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.material.highlight);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-12-18 04:18:16 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Higher values makes the highlights more focused"),
|
|
|
|
NULL);
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
pixmap = gimp_pixmap_new (high2_xpm);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 2, 3,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
gtk_widget_show (page);
|
2003-10-30 04:57:21 +08:00
|
|
|
|
1998-06-11 14:04:59 +08:00
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
/* Create Bump mapping page */
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *
|
|
|
|
create_bump_page (void)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
2004-04-20 16:35:36 +08:00
|
|
|
GtkWidget *combo;
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkObject *adj;
|
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
page = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
|
2002-09-07 04:44:47 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
frame = gimp_frame_new (NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("E_nable Bump Mapping"));
|
2000-08-29 22:27:40 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.bump_mapped);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
|
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&mapvals.bump_mapped);
|
2004-04-05 08:35:46 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-08-29 22:27:40 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Enable/disable bump-mapping (image depth)"),
|
|
|
|
NULL);
|
|
|
|
|
2000-08-29 02:47:33 +08:00
|
|
|
table = gtk_table_new (6, 2, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
gtk_widget_set_sensitive (table, mapvals.bump_mapped);
|
2001-12-29 21:26:29 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "set_sensitive", table);
|
2000-08-29 22:27:40 +08:00
|
|
|
|
2004-04-21 07:01:03 +08:00
|
|
|
combo = gimp_drawable_combo_box_new (bumpmap_constrain, NULL);
|
2004-04-22 00:50:13 +08:00
|
|
|
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), mapvals.bumpmap_id,
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
|
|
|
&mapvals.bumpmap_id);
|
2004-04-21 07:01:03 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Bumpm_ap Image:"), 0.0, 0.5,
|
2004-05-28 08:21:37 +08:00
|
|
|
combo, 1, FALSE);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new (_("Linear"), LINEAR_MAP,
|
|
|
|
_("Logarithmic"), LOGARITHMIC_MAP,
|
|
|
|
_("Sinusoidal"), SINUSOIDAL_MAP,
|
|
|
|
_("Spherical"), SPHERICAL_MAP,
|
|
|
|
NULL);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
mapvals.bumpmaptype);
|
|
|
|
|
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (mapmenu2_callback),
|
|
|
|
&mapvals.bumpmaptype);
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-05-28 08:21:37 +08:00
|
|
|
_("Cu_rve:"), 0.0, 0.5, combo, 1, FALSE);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&adj, mapvals.bumpmax,
|
2000-02-21 20:05:45 +08:00
|
|
|
0, G_MAXFLOAT, 0.01, 0.1, 1.0, 0.0, 2);
|
2000-02-18 07:48:13 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("Ma_ximum Height:"), 0.0, 0.5,
|
2000-02-18 07:48:13 +08:00
|
|
|
spinbutton, 1, TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&mapvals.bumpmax);
|
2004-04-05 08:35:46 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
gimp_help_set_help_data (spinbutton,
|
|
|
|
_("Maximum height for bumps"),
|
|
|
|
NULL);
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (page);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
return page;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static GtkWidget *
|
|
|
|
create_environment_page (void)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *page;
|
2000-08-29 22:27:40 +08:00
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *table;
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *frame;
|
2004-04-21 07:01:03 +08:00
|
|
|
GtkWidget *combo;
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
page = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
|
2002-09-07 04:44:47 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
frame = gimp_frame_new (NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2002-05-28 01:25:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("E_nable Environment Mapping"));
|
2000-08-29 22:27:40 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.env_mapped);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
|
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&mapvals.env_mapped);
|
2004-04-05 08:35:46 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2000-08-29 22:27:40 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Enable/disable environment-mapping (reflection)"),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-07 04:44:47 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-08-29 22:27:40 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (table, mapvals.env_mapped);
|
2001-12-29 21:26:29 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "set_sensitive", table);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2004-04-21 07:01:03 +08:00
|
|
|
combo = gimp_drawable_combo_box_new (envmap_constrain, NULL);
|
2004-04-22 00:50:13 +08:00
|
|
|
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), mapvals.envmap_id,
|
|
|
|
G_CALLBACK (envmap_combo_callback),
|
|
|
|
NULL);
|
2004-04-21 07:01:03 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-05-20 23:05:48 +08:00
|
|
|
_("En_vironment Image:"), 0.0, 0.5,
|
2004-05-28 08:21:37 +08:00
|
|
|
combo, 1, FALSE);
|
2004-04-21 07:01:03 +08:00
|
|
|
gimp_help_set_help_data (combo, _("Environment image to use"), NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
|
|
|
gtk_widget_show (page);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
return page;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-08-29 02:47:33 +08:00
|
|
|
/*****************************/
|
|
|
|
/* Create notebook and pages */
|
|
|
|
/*****************************/
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
static void
|
|
|
|
create_main_notebook (GtkWidget *container)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *page;
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
options_note_book = GTK_NOTEBOOK (gtk_notebook_new ());
|
|
|
|
gtk_container_add (GTK_CONTAINER (container),
|
|
|
|
GTK_WIDGET (options_note_book));
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
page = create_options_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, page,
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("Op_tions")));
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
page = create_light_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, page,
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Light")));
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
page = create_material_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, page,
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Material")));
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-08-29 22:27:40 +08:00
|
|
|
page = create_bump_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, page,
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Bump Map")));
|
2000-08-29 22:27:40 +08:00
|
|
|
|
|
|
|
page = create_environment_page ();
|
|
|
|
gtk_notebook_append_page (options_note_book, page,
|
2002-05-28 01:25:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Environment Map")));
|
2000-08-29 22:27:40 +08:00
|
|
|
|
|
|
|
/*
|
2000-02-18 07:48:13 +08:00
|
|
|
if (mapvals.bump_mapped == TRUE)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
bump_page = create_bump_page ();
|
|
|
|
bump_page_pos = g_list_length (options_note_book->children);
|
|
|
|
gtk_notebook_append_page (options_note_book, bump_page,
|
2000-08-29 02:47:33 +08:00
|
|
|
gtk_label_new (_("Bumpmap")));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2003-10-30 04:57:21 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
if (mapvals.env_mapped == TRUE)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
env_page = create_environment_page ();
|
|
|
|
env_page_pos = g_list_length (options_note_book->children);
|
|
|
|
gtk_notebook_append_page (options_note_book, env_page,
|
2000-08-29 02:47:33 +08:00
|
|
|
gtk_label_new (_("Environment")));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
2000-08-29 22:27:40 +08:00
|
|
|
*/
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (GTK_WIDGET (options_note_book));
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
/********************************/
|
|
|
|
/* Create and show main dialog. */
|
|
|
|
/********************************/
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gboolean
|
2000-08-22 11:27:14 +08:00
|
|
|
main_dialog (GimpDrawable *drawable)
|
1998-06-11 14:04:59 +08:00
|
|
|
{
|
2000-02-18 07:48:13 +08:00
|
|
|
GtkWidget *main_hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *button;
|
2002-10-17 05:18:11 +08:00
|
|
|
GtkWidget *toggle;
|
2003-11-06 23:27:05 +08:00
|
|
|
gboolean run = FALSE;
|
2002-10-17 05:18:11 +08:00
|
|
|
|
2002-01-03 01:20:50 +08:00
|
|
|
/*
|
|
|
|
GtkWidget *image;
|
|
|
|
*/
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2001-06-22 20:58:57 +08:00
|
|
|
gimp_ui_init ("Lighting", FALSE);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
appwin = gimp_dialog_new (_("Lighting Effects"), "Lighting",
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2004-01-21 01:10:16 +08:00
|
|
|
gimp_standard_help_func, "plug-in-lighting",
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
2002-02-05 21:29:46 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
NULL);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
main_hbox = gtk_hbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 12);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (appwin)->vbox), main_hbox,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (main_hbox);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
/* Create the Preview */
|
|
|
|
/* ================== */
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2004-05-20 23:05:48 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_hbox), vbox, FALSE, FALSE, 0);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (vbox);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
|
|
|
/* Add preview widget and various buttons to the first part */
|
|
|
|
/* ======================================================== */
|
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
gtk_widget_realize (appwin);
|
|
|
|
|
|
|
|
previewarea = gtk_drawing_area_new ();
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (previewarea, PREVIEW_WIDTH, PREVIEW_HEIGHT);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_set_events (previewarea, (GDK_EXPOSURE_MASK |
|
|
|
|
GDK_BUTTON1_MOTION_MASK |
|
2003-10-30 04:57:21 +08:00
|
|
|
GDK_BUTTON_PRESS_MASK |
|
2000-02-18 07:48:13 +08:00
|
|
|
GDK_BUTTON_RELEASE_MASK));
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (previewarea, "event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_events),
|
|
|
|
previewarea);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), previewarea);
|
|
|
|
gtk_widget_show (previewarea);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
/* create preview options, frame and vbox */
|
2004-05-20 23:05:48 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Update"));
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_callback),
|
|
|
|
NULL);
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("I_nteractive"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
mapvals.interactive_preview);
|
2004-05-20 23:05:48 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2002-10-17 05:18:11 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&mapvals.interactive_preview);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
|
|
|
G_CALLBACK (interactive_preview_callback),
|
|
|
|
NULL);
|
2002-01-03 01:20:50 +08:00
|
|
|
|
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
gtk_widget_show (toggle);
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2002-10-17 05:18:11 +08:00
|
|
|
gimp_help_set_help_data (toggle,
|
|
|
|
_("Enable/disable real time preview of changes"),
|
|
|
|
NULL);
|
2002-01-03 01:20:50 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
create_main_notebook (main_hbox);
|
|
|
|
|
|
|
|
gtk_widget_show (appwin);
|
2004-05-20 23:05:48 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
{
|
2003-10-30 04:57:21 +08:00
|
|
|
GdkCursor *cursor;
|
2000-02-18 07:48:13 +08:00
|
|
|
|
2003-10-30 04:57:21 +08:00
|
|
|
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (previewarea),
|
|
|
|
GDK_HAND2);
|
|
|
|
gdk_window_set_cursor (previewarea->window, cursor);
|
|
|
|
gdk_cursor_unref (cursor);
|
2000-02-18 07:48:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
image_setup (drawable, TRUE);
|
|
|
|
|
2003-11-12 02:11:56 +08:00
|
|
|
if (gimp_dialog_run (GIMP_DIALOG (appwin)) == GTK_RESPONSE_OK)
|
2003-11-06 23:27:05 +08:00
|
|
|
run = TRUE;
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
if (preview_rgb_data != NULL)
|
2000-02-18 21:59:18 +08:00
|
|
|
g_free (preview_rgb_data);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
gtk_widget_destroy (appwin);
|
1998-06-11 14:04:59 +08:00
|
|
|
|
2000-02-18 07:48:13 +08:00
|
|
|
return run;
|
1998-06-11 14:04:59 +08:00
|
|
|
}
|