gimp/plug-ins/fp/fp_gtk.c

1147 lines
34 KiB
C
Raw Normal View History

2000-01-11 23:48:00 +08:00
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
New file. * plug-ins/makefile.msc: New file. * plug-ins/*/*.c (Well, not really all files, but many): Portability fixes. Include config.h, and guard inclusion of POSIX and Unix headers like <unistd.h>, <dirent.h> and <sys/time.h>. Include <string.h> if functions from it are used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(), thus no need to include <netinet/in.h>. Include <io.h> on Win32 when using open/read/write (which actually are defined as _open/_read/_write by glib.h). Define S_* macros if necessary on Win32. Define rint() and M_PI if necessary (these definitions should be factored out somewhere, no sense repeating them in lots of files). Open files in binary mode when needed. * plug-ins/FractalExplorer/FractalExplorer.c: Use g_malloc()/g_free(). Use g_strdup_printf(). * plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>. * plug-ins/destripe/destripe.c: Guard use of SIGBUS. * plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for NULL returns from g_malloc() and g_new() as they abort on failure. Use g_strdup_printf(). * plug-ins/gz/gz.c: Win32 version of running the subprocess. * plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for non-Unix (OS/2 and Win32), for instance HAVE_MMAP. * plug-ins/script-fu/interp_slib.c: Win32 version of myruntime(). * plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh). * plug-ins/script-fu/script-fu-console.c: Bypass on Win32. * plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use g_strdup_printf() instead of separate malloc() and sprintf(). Use g_strescape() for strings being passed to Scheme. Some Win32-only stuff.
1999-05-29 09:28:24 +08:00
#include <string.h>
2000-01-11 23:48:00 +08:00
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
1999-12-28 00:18:06 +08:00
#include "libgimp/stdplugins-intl.h"
#include "fp.h"
2000-01-11 23:48:00 +08:00
AdvancedWindow AW = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
extern FP_Params Current;
extern GDrawable *drawable, *mask;
2000-01-11 23:48:00 +08:00
FP_Intensity ShMidHi[] = { SHADOWS, MIDTONES, HIGHLIGHTS };
int HueSatVal[] = { BY_HUE, BY_SAT, BY_VAL };
gint nudgeArray[256];
GtkWidget *origPreview, *curPreview;
GtkWidget *rPreview, *gPreview, *bPreview;
GtkWidget *cPreview, *yPreview, *mPreview;
GtkWidget *centerPreview;
GtkWidget *darkerPreview, *lighterPreview, *middlePreview;
GtkWidget *allOrSell, *dlg;
GtkWidget *plusSatPreview, *SatPreview, *minusSatPreview;
struct
{
2000-01-11 23:48:00 +08:00
GtkWidget *bna,
*palette,
*rough,
*range,
*show,
*lnd,
*pixelsBy,
*frameSelect,
*satur;
} fpFrames;
fpInterface FPint =
{
FALSE /* run */
};
ReducedImage *reduced;
/***********************************************************/
/************ Main Dialog Window ******************/
/***********************************************************/
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_bna (void)
{
GtkWidget *frame, *blabel, *alabel, *bframe, *aframe, *table;
2000-01-11 23:48:00 +08:00
Create_A_Preview (&origPreview, &bframe, reduced->width, reduced->height);
Create_A_Preview (&curPreview, &aframe, reduced->width, reduced->height);
2000-01-11 23:48:00 +08:00
frame = gtk_frame_new (_("Before and After"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
/* All the previews */
2000-01-11 23:48:00 +08:00
alabel = gtk_label_new (_("Current:"));
gtk_widget_show (alabel);
gtk_misc_set_alignment (GTK_MISC (alabel), 0.0, 0.5);
blabel = gtk_label_new (_("Original:"));
gtk_widget_show (blabel);
gtk_misc_set_alignment (GTK_MISC (blabel), 0.0, 0.5);
table = gtk_table_new (2, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), blabel, 0, 1, 0, 1,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), alabel, 1, 2, 0, 1,
0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), bframe, 0, 1, 1, 2,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), aframe, 1, 2, 1, 2,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_widget_show (table);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
return frame;
}
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
/* close a sub dialog (from window manager) by simulating toggle click */
2000-01-11 23:48:00 +08:00
void
sub_dialog_destroy (GtkWidget *dialog,
GdkEvent *ev,
gpointer dummy)
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
{
2000-01-11 23:48:00 +08:00
GtkWidget *button =
GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (dialog), "ctrlButton"));
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
2000-01-11 23:48:00 +08:00
gtk_signal_emit_by_name (GTK_OBJECT (button), "clicked", dialog);
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
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_circle_palette (void)
{
GtkWidget *frame, *table;
GtkWidget *rVbox, *rFrame;
GtkWidget *gVbox, *gFrame;
GtkWidget *bVbox, *bFrame;
GtkWidget *cVbox, *cFrame;
GtkWidget *yVbox, *yFrame;
GtkWidget *mVbox, *mFrame;
GtkWidget *centerVbox, *centerFrame;
GtkWidget *win;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
1999-12-28 00:18:06 +08:00
gtk_container_border_width (GTK_CONTAINER (frame), 4);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
table = gtk_table_new (11, 11, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_widget_show (table);
gtk_container_add (GTK_CONTAINER (frame), table);
2000-01-11 23:48:00 +08:00
Create_A_Preview (&rPreview, &rFrame, reduced->width, reduced->height);
Create_A_Preview (&gPreview, &gFrame, reduced->width, reduced->height);
Create_A_Preview (&bPreview, &bFrame, reduced->width, reduced->height);
Create_A_Preview (&cPreview, &cFrame, reduced->width, reduced->height);
Create_A_Preview (&yPreview, &yFrame, reduced->width, reduced->height);
Create_A_Preview (&mPreview, &mFrame, reduced->width, reduced->height);
Create_A_Preview (&centerPreview, &centerFrame,
reduced->width, reduced->height);
Create_A_Table_Entry (&rVbox, rFrame, _("Red:"));
Create_A_Table_Entry (&gVbox, gFrame, _("Green:"));
Create_A_Table_Entry (&bVbox, bFrame, _("Blue:"));
Create_A_Table_Entry (&cVbox, cFrame, _("Cyan:"));
Create_A_Table_Entry (&yVbox, yFrame, _("Yellow:"));
Create_A_Table_Entry (&mVbox, mFrame, _("Magenta:"));
Create_A_Table_Entry (&centerVbox, centerFrame, _("Current:"));
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), rVbox, 8, 11 ,4 , 7,
GTK_EXPAND , GTK_EXPAND, 0 ,0);
gtk_table_attach (GTK_TABLE (table), gVbox, 2, 5, 0, 3,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), bVbox, 2, 5, 8, 11,
GTK_EXPAND, GTK_EXPAND,0,0);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), cVbox, 0, 3, 4, 7,
GTK_EXPAND, GTK_EXPAND, 0 ,0);
gtk_table_attach (GTK_TABLE (table), yVbox, 6, 9, 0, 3,
GTK_EXPAND, GTK_EXPAND, 0 ,0);
gtk_table_attach (GTK_TABLE (table), mVbox, 6, 9, 8, 11,
GTK_EXPAND, GTK_EXPAND, 0 ,0);
gtk_table_attach (GTK_TABLE (table), centerVbox, 4, 7, 4, 7,
GTK_EXPAND, GTK_EXPAND, 0 ,0);
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gimp_help_connect_help_accel (win, gimp_plugin_help_func, "filters/fp.html");
gtk_window_set_title (GTK_WINDOW (win), _("Hue Variations"));
gtk_container_add (GTK_CONTAINER (win), frame);
gtk_signal_connect (GTK_OBJECT (win), "delete_event",
GTK_SIGNAL_FUNC (sub_dialog_destroy),
NULL);
return win;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_rough (void)
{
GtkWidget *frame, *scale, *vbox;
GtkObject *data;
1999-12-28 00:18:06 +08:00
frame = gtk_frame_new (_("Roughness"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
data = gtk_adjustment_new (Current.Rough, 0, 1.0, 0.05, 0.01, 0.0);
Current.roughnessScale = scale = gtk_hscale_new (GTK_ADJUSTMENT (data));
gtk_widget_set_usize (scale, 60, 0);
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_scale_set_digits (GTK_SCALE (scale), 2);
gtk_signal_connect (GTK_OBJECT (data), "value_changed",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (fp_scale_update),
&Current.Rough);
gtk_widget_show (scale);
2000-01-11 23:48:00 +08:00
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER( frame), vbox);
return frame;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_range (void)
{
GtkWidget *frame, *vbox;
GSList *group=NULL;
1999-12-28 00:18:06 +08:00
frame = gtk_frame_new (_("Affected Range"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_widget_show (vbox);
group = Button_In_A_Box (vbox, group, _("Shadows"),
GTK_SIGNAL_FUNC (fp_change_current_range),
ShMidHi + SHADOWS,
Current.Range == SHADOWS);
group = Button_In_A_Box (vbox, group, _("Midtones"),
GTK_SIGNAL_FUNC (fp_change_current_range),
ShMidHi + MIDTONES,
Current.Range == MIDTONES);
group=Button_In_A_Box (vbox, group, _("Highlights"),
GTK_SIGNAL_FUNC (fp_change_current_range),
ShMidHi + HIGHLIGHTS,
Current.Range == HIGHLIGHTS);
return frame;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_control (void)
{
GtkWidget *frame, *box;
1999-12-28 00:18:06 +08:00
frame = gtk_frame_new (_("Windows"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
box = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_container_set_border_width (GTK_CONTAINER (box), 4);
gtk_widget_show (box);
Frames_Check_Button_In_A_Box (box, _("Hue"),
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.palette,
Current.VisibleFrames & HUE);
Frames_Check_Button_In_A_Box (box, _("Saturation"),
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.satur,
Current.VisibleFrames & SATURATION);
Frames_Check_Button_In_A_Box (box, _("Value"),
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.lnd,
Current.VisibleFrames & VALUE);
Frames_Check_Button_In_A_Box (box, _("Advanced"),
GTK_SIGNAL_FUNC (fp_show_hide_frame),
AW.window,
FALSE);
return frame;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_lnd (void)
{
GtkWidget *frame, *table, *lighterFrame, *middleFrame, *darkerFrame;
GtkWidget *lighterVbox, *middleVbox, *darkerVbox;
GtkWidget *win;
2000-01-11 23:48:00 +08:00
Create_A_Preview (&lighterPreview, &lighterFrame,
reduced->width, reduced->height);
Create_A_Preview (&middlePreview, &middleFrame,
reduced->width, reduced->height);
Create_A_Preview (&darkerPreview, &darkerFrame,
reduced->width, reduced->height);
2000-01-11 23:48:00 +08:00
Create_A_Table_Entry (&lighterVbox, lighterFrame, _("Lighter:"));
Create_A_Table_Entry (&middleVbox, middleFrame, _("Current:"));
Create_A_Table_Entry (&darkerVbox, darkerFrame, _("Darker:"));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
2000-01-11 23:48:00 +08:00
gtk_container_border_width (GTK_CONTAINER (frame), 6);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
table = gtk_table_new (1, 11, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_widget_show (table);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), lighterVbox, 0, 3, 0, 1,
GTK_EXPAND , GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), middleVbox, 4, 7, 0, 1,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), darkerVbox, 8, 11, 0, 1,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_container_add (GTK_CONTAINER (frame), table);
2000-01-11 23:48:00 +08:00
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gimp_help_connect_help_accel (win, gimp_plugin_help_func, "filters/fp.html");
gtk_window_set_title (GTK_WINDOW (win), _("Value Variations"));
gtk_container_add (GTK_CONTAINER (win), frame);
gtk_signal_connect (GTK_OBJECT (win), "delete_event",
GTK_SIGNAL_FUNC (sub_dialog_destroy),
NULL);
return win;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_msnls (void)
{
GtkWidget *frame, *table, *lessFrame, *middleFrame, *moreFrame;
GtkWidget *lessVbox, *middleVbox, *moreVbox;
GtkWidget *win;
2000-01-11 23:48:00 +08:00
Create_A_Preview (&minusSatPreview, &lessFrame,
reduced->width, reduced->height);
Create_A_Preview (&SatPreview, &middleFrame,
reduced->width, reduced->height);
Create_A_Preview (&plusSatPreview, &moreFrame,
reduced->width, reduced->height);
2000-01-11 23:48:00 +08:00
Create_A_Table_Entry (&moreVbox, moreFrame, _("More Sat:"));
Create_A_Table_Entry (&middleVbox, middleFrame, _("Current:"));
Create_A_Table_Entry (&lessVbox, lessFrame, _("Less Sat:"));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
1999-12-28 00:18:06 +08:00
gtk_container_border_width (GTK_CONTAINER (frame), 4);
2000-01-11 23:48:00 +08:00
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
table = gtk_table_new (1, 11, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_widget_show (table);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), moreVbox, 0, 3, 0, 1,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), middleVbox, 4, 7, 0, 1,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_table_attach (GTK_TABLE (table), lessVbox, 8, 11, 0, 1,
GTK_EXPAND, GTK_EXPAND, 0, 0);
gtk_container_add (GTK_CONTAINER (frame), table);
2000-01-11 23:48:00 +08:00
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gimp_help_connect_help_accel (win, gimp_plugin_help_func, "filters/fp.html");
gtk_window_set_title (GTK_WINDOW (win), _("Saturation Variations"));
gtk_container_add (GTK_CONTAINER (win), frame);
gtk_signal_connect (GTK_OBJECT (win), "delete_event",
GTK_SIGNAL_FUNC (sub_dialog_destroy),
NULL);
return win;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_pixels_select_by (void)
{
GtkWidget *frame, *vbox;
GSList *group=NULL;
2000-01-11 23:48:00 +08:00
frame = gtk_frame_new (_("Select Pixels by"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
2000-01-11 23:48:00 +08:00
gtk_widget_show (frame);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_widget_show (vbox);
group = Button_In_A_Box (vbox, group, _("Hue"),
GTK_SIGNAL_FUNC (fp_change_current_pixels_by),
HueSatVal + 0,
Current.ValueBy == BY_HUE);
group = Button_In_A_Box (vbox,group, _("Saturation"),
GTK_SIGNAL_FUNC (fp_change_current_pixels_by),
HueSatVal + 1,
Current.ValueBy == BY_SAT);
group = Button_In_A_Box (vbox,group, _("Value"),
GTK_SIGNAL_FUNC (fp_change_current_pixels_by),
HueSatVal + 2,
Current.ValueBy == BY_VAL);
return frame;
}
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_show (void)
{
GtkWidget *frame, *vbox;
2000-01-11 23:48:00 +08:00
GSList *group = NULL;
2000-01-11 23:48:00 +08:00
frame = gtk_frame_new(_("Show"));
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_widget_show (vbox);
2000-01-11 23:48:00 +08:00
group = Button_In_A_Box (vbox, group, _("Entire Image"),
GTK_SIGNAL_FUNC (fp_entire_image),
&Current.SlctnOnly,
FALSE);
2000-01-11 23:48:00 +08:00
group = Button_In_A_Box (vbox, group, _("Selection Only"),
GTK_SIGNAL_FUNC (fp_selection_only),
&Current.SlctnOnly,
TRUE);
2000-01-11 23:48:00 +08:00
group = Button_In_A_Box (vbox, group, _("Selection In Context"),
GTK_SIGNAL_FUNC (fp_selection_in_context),
&Current.SlctnOnly,
FALSE);
return frame;
}
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 __FP_UNUSED_STUFF__
2000-01-11 23:48:00 +08:00
GtkWidget *
fp_create_frame_select (void)
{
GtkWidget *frame, *box;
2000-01-11 23:48:00 +08:00
frame = gtk_frame_new (_("Display"));
1999-12-28 00:18:06 +08:00
gtk_container_border_width (GTK_CONTAINER (frame), 4);
2000-01-11 23:48:00 +08:00
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
box = gtk_hbox_new (FALSE, 8);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_container_set_border_width (GTK_CONTAINER (box),4);
gtk_widget_show (box);
1999-12-28 00:18:06 +08:00
Check_Button_In_A_Box (box, _("CirclePalette"),
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.palette,TRUE);
1999-12-28 00:18:06 +08:00
Check_Button_In_A_Box (box, _("Lighter And Darker"),
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.lnd,TRUE);
1999-12-28 00:18:06 +08:00
Check_Button_In_A_Box (box, _("Saturation"),
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (fp_show_hide_frame),
fpFrames.satur,FALSE);
return frame;
}
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-01-11 23:48:00 +08:00
void Create_A_Preview (GtkWidget **preview,
GtkWidget **frame,
int previewWidth,
int previewHeight)
{
2000-01-11 23:48:00 +08:00
*frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (*frame), GTK_SHADOW_IN);
2000-01-11 23:48:00 +08:00
gtk_widget_show (*frame);
2000-01-11 23:48:00 +08:00
*preview = gtk_preview_new (Current.Color ?
GTK_PREVIEW_COLOR : GTK_PREVIEW_GRAYSCALE);
gtk_preview_size (GTK_PREVIEW (*preview), previewWidth, previewHeight);
2000-01-11 23:48:00 +08:00
gtk_widget_show (*preview);
gtk_container_add (GTK_CONTAINER (*frame), *preview);
}
2000-01-11 23:48:00 +08:00
GSList *
Button_In_A_Box (GtkWidget *vbox,
GSList *group,
guchar *label,
GtkSignalFunc function,
gpointer data,
gboolean clicked)
{
GtkWidget *button;
2000-01-11 23:48:00 +08:00
button = gtk_radio_button_new_with_label (group, label);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (function),
data);
2000-01-11 23:48:00 +08:00
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
if (clicked)
2000-01-11 23:48:00 +08:00
gtk_button_clicked (GTK_BUTTON (button));
return gtk_radio_button_group (GTK_RADIO_BUTTON (button));
}
2000-01-11 23:48:00 +08:00
void
Check_Button_In_A_Box (GtkWidget *vbox,
guchar *label,
GtkSignalFunc function,
gpointer data,
gboolean clicked)
{
GtkWidget *button;
2000-01-11 23:48:00 +08:00
button = gtk_check_button_new_with_label (label);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (function),
data);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clicked);
2000-01-11 23:48:00 +08:00
gtk_widget_show (button);
}
2000-01-11 23:48:00 +08:00
void
Frames_Check_Button_In_A_Box (GtkWidget *vbox,
guchar *label,
GtkSignalFunc function,
GtkWidget *frame,
gboolean clicked)
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
{
GtkWidget *button;
2000-01-11 23:48:00 +08:00
button = gtk_check_button_new_with_label (label);
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
gtk_signal_connect (GTK_OBJECT (button), "clicked",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (function),
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
frame);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clicked);
gtk_object_set_data (GTK_OBJECT (frame), "ctrlButton", (gpointer) button);
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
2000-01-11 23:48:00 +08:00
gtk_widget_show (button);
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
}
2000-01-11 23:48:00 +08:00
void
Create_A_Table_Entry (GtkWidget **box,
GtkWidget *SmallerFrame,
gchar *description)
{
GtkWidget *label, *button, *table;
2000-01-11 23:48:00 +08:00
*box = gtk_vbox_new (FALSE, 1);
gtk_container_border_width (GTK_CONTAINER (*box), PR_BX_BRDR);
gtk_widget_show (*box);
2000-01-11 23:48:00 +08:00
label = gtk_label_new (description);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
2000-01-11 23:48:00 +08:00
table = gtk_table_new (2, 1, FALSE);
gtk_widget_show (table);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (*box), table, TRUE, TRUE, 0);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
0, 0, 0, 0);
2000-01-11 23:48:00 +08:00
if (strcmp (description, "Current:"))
{
button = gtk_button_new ();
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (selectionMade),
description);
gtk_container_add (GTK_CONTAINER (button), SmallerFrame);
gtk_widget_show (button);
gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2,
0, 0, 0, 4);
}
else
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), SmallerFrame, 0, 1, 1, 2,
0, 0, 0, 4);
}
void
2000-01-11 23:48:00 +08:00
fp_redraw_all_windows (void)
{
2000-01-11 23:48:00 +08:00
reduced = Reduce_The_Image (drawable,mask,
Current.PreviewSize,
Current.SlctnOnly);
Adjust_Preview_Sizes (reduced->width, reduced->height);
/*gtk_container_check_resize(GTK_CONTAINER(fpFrames.palette), NULL);*/
2000-01-11 23:48:00 +08:00
gtk_widget_draw (fpFrames.palette, NULL);
/*gtk_container_check_resize(GTK_CONTAINER(fpFrames.satur), NULL);*/
2000-01-11 23:48:00 +08:00
gtk_widget_draw (fpFrames.satur, NULL);
/*gtk_container_check_resize(GTK_CONTAINER(fpFrames.lnd), NULL);*/
2000-01-11 23:48:00 +08:00
gtk_widget_draw (fpFrames.lnd, NULL);
/*gtk_container_check_resize(GTK_CONTAINER(dlg), NULL);*/
2000-01-11 23:48:00 +08:00
gtk_widget_draw (dlg, NULL);
refreshPreviews (Current.VisibleFrames);
}
void
2000-01-11 23:48:00 +08:00
fp_entire_image (GtkWidget *button,
gpointer data)
{
2000-01-11 23:48:00 +08:00
if (!GTK_TOGGLE_BUTTON (button)->active)
return;
Current.SlctnOnly = 0;
2000-01-11 23:48:00 +08:00
fp_redraw_all_windows ();
}
void
2000-01-11 23:48:00 +08:00
fp_selection_only (GtkWidget *button,
gpointer data)
{
2000-01-11 23:48:00 +08:00
static int notFirstTime = 0;
if (!(notFirstTime++))
return;
2000-01-11 23:48:00 +08:00
if (!GTK_TOGGLE_BUTTON (button)->active)
return;
Current.SlctnOnly = 1;
2000-01-11 23:48:00 +08:00
fp_redraw_all_windows ();
}
void
2000-01-11 23:48:00 +08:00
fp_selection_in_context (GtkWidget *button,
gpointer data)
{
2000-01-11 23:48:00 +08:00
if (!GTK_TOGGLE_BUTTON (button)->active)
return;
2000-01-11 23:48:00 +08:00
Current.SlctnOnly = 2;
2000-01-11 23:48:00 +08:00
fp_redraw_all_windows ();
}
2000-01-11 23:48:00 +08:00
void
fp_show_hide_frame (GtkWidget *button,
GtkWidget *frame)
{
2000-01-11 23:48:00 +08:00
int prev = Current.VisibleFrames;
if (frame == NULL)
return;
if (GTK_TOGGLE_BUTTON (button)->active)
{
if (!GTK_WIDGET_VISIBLE (frame))
{
gtk_widget_show (frame);
if (frame==fpFrames.palette)
Current.VisibleFrames |= HUE;
else if (frame==fpFrames.satur)
Current.VisibleFrames |= SATURATION;
else if (frame==fpFrames.lnd)
Current.VisibleFrames |= VALUE;
refreshPreviews (Current.VisibleFrames & ~prev);
}
}
else
{
if (GTK_WIDGET_VISIBLE (frame))
{
gtk_widget_hide (frame);
if (frame==fpFrames.palette)
Current.VisibleFrames &= ~HUE;
else if (frame==fpFrames.satur)
Current.VisibleFrames &= ~SATURATION;
else if (frame==fpFrames.lnd)
Current.VisibleFrames &= ~VALUE;
}
}
}
2000-01-11 23:48:00 +08:00
void
Adjust_Preview_Sizes (gint width,
gint height)
{
2000-01-11 23:48:00 +08:00
gtk_preview_size (GTK_PREVIEW (origPreview), width, height);
gtk_preview_size (GTK_PREVIEW (curPreview), width, height);
gtk_preview_size (GTK_PREVIEW (rPreview), width, height);
gtk_preview_size (GTK_PREVIEW (gPreview), width, height);
gtk_preview_size (GTK_PREVIEW (bPreview), width, height);
gtk_preview_size (GTK_PREVIEW (cPreview), width, height);
gtk_preview_size (GTK_PREVIEW (yPreview), width, height);
gtk_preview_size (GTK_PREVIEW (mPreview), width, height);
gtk_preview_size (GTK_PREVIEW (centerPreview), width, height);
gtk_preview_size (GTK_PREVIEW (lighterPreview), width, height);
gtk_preview_size (GTK_PREVIEW (darkerPreview), width, height);
gtk_preview_size (GTK_PREVIEW (middlePreview), width, height);
gtk_preview_size (GTK_PREVIEW (minusSatPreview), width, height);
gtk_preview_size (GTK_PREVIEW (SatPreview), width, height);
gtk_preview_size (GTK_PREVIEW (plusSatPreview), width, height);
}
void
2000-01-11 23:48:00 +08:00
selectionMade (GtkWidget *widget,
gpointer data)
{
Current.Touched[Current.ValueBy] = 1;
2000-01-11 23:48:00 +08:00
if (!strcmp ("Red:", data)) Update_Current_FP (HUE, RED);
else if (!strcmp ("Green:", data)) Update_Current_FP (HUE, GREEN);
else if (!strcmp ("Blue:", data)) Update_Current_FP (HUE, BLUE);
else if (!strcmp ("Cyan:", data)) Update_Current_FP (HUE, CYAN);
else if (!strcmp ("Yellow:", data)) Update_Current_FP (HUE, YELLOW);
else if (!strcmp ("Magenta:", data)) Update_Current_FP (HUE, MAGENTA);
else if (!strcmp ("Darker:", data)) Update_Current_FP (VALUE, DOWN);
else if (!strcmp ("Lighter:", data)) Update_Current_FP (VALUE, UP);
else if (!strcmp ("More Sat:", data))
Update_Current_FP (SATURATION, UP);
else if (!strcmp ("Less Sat:", data))
Update_Current_FP (SATURATION, DOWN );
refreshPreviews (Current.VisibleFrames);
}
void
2000-01-11 23:48:00 +08:00
refreshPreviews (gint which)
{
2000-01-11 23:48:00 +08:00
fp_Create_Nudge (nudgeArray);
fp_render_preview (origPreview, NONEATALL, 0);
fp_render_preview (curPreview, CURRENT, 0);
if (which & HUE)
{
fp_render_preview (rPreview, HUE, RED);
fp_render_preview (gPreview, HUE, GREEN);
fp_render_preview (bPreview, HUE, BLUE);
fp_render_preview (cPreview, HUE, CYAN);
fp_render_preview (yPreview, HUE, YELLOW);
fp_render_preview (mPreview, HUE, MAGENTA);
fp_render_preview (centerPreview, CURRENT, 0);
}
if (which & VALUE)
{
fp_render_preview (lighterPreview, VALUE, UP);
fp_render_preview (middlePreview, CURRENT, 0);
fp_render_preview (darkerPreview, VALUE, DOWN);
}
if (which & SATURATION)
{
fp_render_preview (plusSatPreview, SATURATION, UP);
fp_render_preview (SatPreview, CURRENT, 0);
fp_render_preview (minusSatPreview, SATURATION, DOWN);
}
}
void
fp_ok_callback (GtkWidget *widget,
2000-01-11 23:48:00 +08:00
gpointer data)
{
FPint.run = TRUE;
2000-01-11 23:48:00 +08:00
gtk_widget_destroy (GTK_WIDGET (data));
}
void
fp_scale_update (GtkAdjustment *adjustment,
float *scale_val)
{
static float prevValue=.25;
2000-01-11 23:48:00 +08:00
*scale_val = adjustment->value;
2000-01-11 23:48:00 +08:00
if (prevValue != adjustment->value)
{
fp_Create_Nudge (nudgeArray);
refreshPreviews (Current.VisibleFrames);
if (AW.window != NULL && GTK_WIDGET_VISIBLE (AW.window))
fp_create_smoothness_graph (AW.aliasingPreview);
prevValue = adjustment->value;
}
}
void
2000-01-11 23:48:00 +08:00
fp_change_current_range (GtkAdjustment *button,
gint *Intensity)
{
static FP_Intensity prevValue=MIDTONES;
static int notFirstTime=0;
if (!(notFirstTime++)) return;
2000-01-11 23:48:00 +08:00
if (!GTK_TOGGLE_BUTTON (button)->active) return;
if (*Intensity == prevValue) return;
Current.Range = *Intensity;
2000-01-11 23:48:00 +08:00
refreshPreviews (Current.VisibleFrames);
if (AW.window != NULL && GTK_WIDGET_VISIBLE (AW.window))
2000-01-11 23:48:00 +08:00
fp_create_smoothness_graph (AW.aliasingPreview);
prevValue = *Intensity;
}
void
2000-01-11 23:48:00 +08:00
fp_change_current_pixels_by (GtkWidget *button,
gint *valueBy)
{
int prevValue=VALUE;
static int notFirstTime=0;
if (!(notFirstTime++)) return;
if (!GTK_TOGGLE_BUTTON(button)->active) return;
if (*valueBy == prevValue) return;
Current.ValueBy = *valueBy;
2000-01-11 23:48:00 +08:00
refreshPreviews (Current.VisibleFrames);
if (AW.window != NULL &&
GTK_WIDGET_VISIBLE (AW.window) &&
AW.rangePreview != NULL)
fp_range_preview_spill (AW.rangePreview,Current.ValueBy);
prevValue = *valueBy;
}
void
2000-01-11 23:48:00 +08:00
fp_advanced_call (void)
{
if (AW.window!=NULL)
2000-01-11 23:48:00 +08:00
if (GTK_WIDGET_VISIBLE (AW.window))
gtk_widget_hide (AW.window);
else
2000-01-11 23:48:00 +08:00
gtk_widget_show (AW.window);
else
2000-01-11 23:48:00 +08:00
fp_advanced_dialog ();
}
2000-01-11 23:48:00 +08:00
int
fp_dialog (void)
{
GtkWidget *bna;
GtkWidget *palette;
GtkWidget *lnd;
GtkWidget *show;
GtkWidget *rough;
GtkWidget *range;
GtkWidget *pixelsBy;
GtkWidget *satur;
GtkWidget *control;
GtkWidget *table;
guchar *color_cube;
gchar **argv;
2000-01-11 23:48:00 +08:00
gint argc;
2000-01-11 23:48:00 +08:00
reduced = Reduce_The_Image (drawable,mask,
Current.PreviewSize,
Current.SlctnOnly);
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("fp");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
gtk_preview_set_gamma (gimp_gamma ());
gtk_preview_set_install_cmap (gimp_install_cmap ());
color_cube = gimp_color_cube ();
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
color_cube[2], color_cube[3]);
gtk_widget_set_default_visual (gtk_preview_get_visual ());
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
/********************************************************************/
/************************* All the Standard Stuff *******************/
2000-01-11 23:48:00 +08:00
dlg = gimp_dialog_new (_("Filter Pack Simulation"), "fp",
gimp_plugin_help_func, "filters/fp.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
2000-01-11 23:48:00 +08:00
_("OK"), fp_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
_("Reset"), resetFilterPacks,
NULL, NULL, NULL, FALSE, FALSE,
_("Cancel"), gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
2000-01-11 23:48:00 +08:00
NULL);
1999-11-27 04:58:27 +08:00
2000-01-11 23:48:00 +08:00
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
/********************************************************************/
2000-01-11 23:48:00 +08:00
fp_advanced_dialog ();
fpFrames.bna = bna = fp_create_bna();
fpFrames.rough = rough = fp_create_rough();
fpFrames.range = range = fp_create_range();
fpFrames.palette = palette = fp_create_circle_palette();
fpFrames.lnd = lnd = fp_create_lnd();
fpFrames.show = show = fp_create_show();
fpFrames.satur = satur = fp_create_msnls();
fpFrames.pixelsBy = pixelsBy = fp_create_pixels_select_by();
control = fp_create_control();
/********************************************************************/
/******************** PUT EVRYTHING TOGETHER ******************/
2000-01-11 23:48:00 +08:00
table = gtk_table_new (4, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), bna, 0, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), control, 1, 2, 1, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), rough, 1, 2, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), show, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), range, 0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), pixelsBy, 0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
gtk_widget_show (table);
gtk_widget_show (dlg);
2000-01-11 23:48:00 +08:00
refreshPreviews (Current.VisibleFrames);
gtk_main ();
gdk_flush ();
return FPint.run;
}
/***********************************************************/
/************ Advanced Options Window ******************/
/***********************************************************/
2000-01-11 23:48:00 +08:00
void
fp_advanced_ok (void)
{
2000-01-11 23:48:00 +08:00
gtk_widget_hide (AW.window);
}
void
2000-01-11 23:48:00 +08:00
As_You_Drag (GtkWidget *button)
{
2000-01-11 23:48:00 +08:00
static gboolean notFirstTime = FALSE;
2000-01-11 23:48:00 +08:00
if (! notFirstTime)
return;
notFirstTime = TRUE;
if (GTK_TOGGLE_BUTTON (button)->active)
{
Current.RealTime=TRUE;
gtk_range_set_update_policy (GTK_RANGE (Current.roughnessScale),0);
gtk_range_set_update_policy (GTK_RANGE (Current.aliasingScale),0);
gtk_range_set_update_policy (GTK_RANGE (Current.previewSizeScale),0);
}
else
{
Current.RealTime=FALSE;
gtk_range_set_update_policy (GTK_RANGE (Current.roughnessScale),
GTK_UPDATE_DELAYED);
gtk_range_set_update_policy (GTK_RANGE (Current.aliasingScale),
GTK_UPDATE_DELAYED);
gtk_range_set_update_policy (GTK_RANGE (Current.previewSizeScale),
GTK_UPDATE_DELAYED);
}
return;
}
void
preview_size_scale_update (GtkAdjustment *adjustment,
float *scale_val)
{
Current.PreviewSize = adjustment->value;
fp_redraw_all_windows();
}
2000-01-11 23:48:00 +08:00
gint
fp_advanced_dialog (void)
{
1999-12-28 00:18:06 +08:00
guchar *rangeNames[] = { N_("Shadows:"), N_("Midtones:"), N_("Highlights:")};
GtkWidget *frame, *mainvbox;
GtkObject *smoothnessData;
GtkWidget *graphFrame, *table, *scale;
GtkWidget *vbox, *label, *labelTable;
GtkWidget *optionsFrame;
2000-01-11 23:48:00 +08:00
gint i;
2000-01-11 23:48:00 +08:00
AW.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
2000-01-11 23:48:00 +08:00
gimp_help_connect_help_accel (AW.window, gimp_plugin_help_func,
"filters/fp.html");
2000-01-11 23:48:00 +08:00
gtk_window_set_title (GTK_WINDOW (AW.window),
_("Advanced Filter Pack Options"));
gtk_signal_connect (GTK_OBJECT (AW.window), "delete_event",
GTK_SIGNAL_FUNC (sub_dialog_destroy),
NULL);
mainvbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 6);
gtk_container_add (GTK_CONTAINER (AW.window), mainvbox);
gtk_widget_show (mainvbox);
frame = gtk_frame_new (_("Smoothness of Aliasing"));
gtk_box_pack_start (GTK_BOX (mainvbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
2000-01-11 23:48:00 +08:00
table = gtk_table_new (3, 1, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
2000-01-11 23:48:00 +08:00
graphFrame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (graphFrame), GTK_SHADOW_IN);
2000-01-11 23:48:00 +08:00
gtk_container_border_width (GTK_CONTAINER (graphFrame),0);
gtk_widget_show (graphFrame);
gtk_table_attach (GTK_TABLE (table), graphFrame, 0, 1, 0, 1,
GTK_EXPAND, 0, 0, 0);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (graphFrame), vbox);
gtk_widget_show (vbox);
2000-01-11 23:48:00 +08:00
AW.aliasingPreview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (AW.aliasingPreview), 256, MAX_ROUGHNESS);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (vbox),AW.aliasingPreview, TRUE, TRUE, 0);
gtk_widget_show (AW.aliasingPreview);
fp_create_smoothness_graph (AW.aliasingPreview);
AW.rangePreview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (AW.rangePreview), 256, RANGE_HEIGHT);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start(GTK_BOX(vbox),AW.rangePreview, TRUE, TRUE, 0);
gtk_widget_show (AW.rangePreview);
fp_range_preview_spill (AW.rangePreview, Current.ValueBy);
2000-01-11 23:48:00 +08:00
labelTable = gtk_table_new (3, 4, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (labelTable), 4);
gtk_table_set_row_spacings (GTK_TABLE (labelTable), 2);
gtk_widget_show (labelTable);
gtk_table_attach (GTK_TABLE (table), labelTable, 0, 1, 1, 2,
GTK_EXPAND, 0, 0, 0);
2000-01-11 23:48:00 +08:00
for (i = 0; i < 12; i++)
{
2000-01-11 23:48:00 +08:00
label = Current.rangeLabels[i] = gtk_label_new ("-");
if (!(i % 4))
{
gtk_label_set_text (GTK_LABEL(label), gettext (rangeNames[i/4]));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
}
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (labelTable), label, i%4, i%4+1, i/4, i/4+1,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
}
2000-01-11 23:48:00 +08:00
/************************************************************/
2000-01-11 23:48:00 +08:00
AW.aliasingGraph = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (AW.aliasingGraph),
2000-01-11 23:48:00 +08:00
2 * MARGIN + 256,
RANGE_HEIGHT);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (vbox), AW.aliasingGraph, TRUE, TRUE, 0);
gtk_widget_show (AW.aliasingGraph);
gtk_widget_set_events (AW.aliasingGraph, RANGE_ADJUST_MASK);
gtk_signal_connect (GTK_OBJECT (AW.aliasingGraph),"event",
GTK_SIGNAL_FUNC (FP_Range_Change_Events),
&Current);
/************************************************************/
smoothnessData = gtk_adjustment_new (Current.Alias, 0, 1.0, 0.05, 0.01, 0.0);
2000-01-11 23:48:00 +08:00
Current.aliasingScale = scale =
gtk_hscale_new (GTK_ADJUSTMENT (smoothnessData));
gtk_widget_set_usize (scale, 200, 0);
gtk_scale_set_digits (GTK_SCALE (scale), 2);
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (scale), 0);
gtk_signal_connect (GTK_OBJECT (smoothnessData), "value_changed",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (fp_scale_update),
&Current.Alias);
gtk_widget_show (scale);
2000-01-11 23:48:00 +08:00
gtk_table_attach (GTK_TABLE (table), scale, 0, 1, 2, 3,
0, 0, 0, 0);
/******************* MISC OPTIONS ***************************/
2000-01-11 23:48:00 +08:00
optionsFrame = gtk_frame_new (_("Miscellaneous Options"));
gtk_widget_show (optionsFrame);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (mainvbox), optionsFrame, TRUE, TRUE, 0);
2000-01-11 23:48:00 +08:00
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (optionsFrame), vbox);
gtk_widget_show (vbox);
2000-01-11 23:48:00 +08:00
Check_Button_In_A_Box (vbox, _("Preview as You Drag"),
GTK_SIGNAL_FUNC (As_You_Drag),
NULL, TRUE);
frame = gtk_frame_new (_("Preview Size"));
gtk_widget_show (frame);
smoothnessData = gtk_adjustment_new (Current.PreviewSize,
50, MAX_PREVIEW_SIZE,
5, 5, 0.0);
2000-01-11 23:48:00 +08:00
Current.previewSizeScale = scale =
gtk_hscale_new (GTK_ADJUSTMENT (smoothnessData));
gtk_container_add (GTK_CONTAINER (frame),scale);
gtk_widget_set_usize (scale, 100, 0);
gtk_scale_set_digits (GTK_SCALE (scale), 0);
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
gtk_range_set_update_policy (GTK_RANGE (scale), 0);
gtk_signal_connect (GTK_OBJECT (smoothnessData), "value_changed",
2000-01-11 23:48:00 +08:00
GTK_SIGNAL_FUNC (preview_size_scale_update),
&Current.PreviewSize);
gtk_widget_show (scale);
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
return 1;
}