diff --git a/ChangeLog b/ChangeLog index 2a7d095249..aaa4299b1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ +Thu Mar 19 03:28:29 PST 1998 Manish Singh + + * plug-ins/script-fu/script-fu-scripts.c: handle delete + event for colorsel correctly + * plug-ins/polar/polar.c: minor cleanups + Thu Mar 19 01:04:56 PST 1998 Manish Singh - * applied gimp-jbuhler-980315-0 + * applied gimp-jbuhler-980315-0 (quelled warnings) Wed Mar 18 20:57:55 EST 1998 Adrian Likins diff --git a/plug-ins/common/polar.c b/plug-ins/common/polar.c index 47693d6464..cb4a4cc226 100644 --- a/plug-ins/common/polar.c +++ b/plug-ins/common/polar.c @@ -63,6 +63,10 @@ #include "gtk/gtk.h" #include "libgimp/gimp.h" +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* M_PI */ + #define sqr(x) ((x) * (x)) #define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0) @@ -199,9 +203,9 @@ query(void) { PARAM_DRAWABLE, "drawable", "Input drawable" }, { PARAM_FLOAT, "circle", "Circle depth in %" }, { PARAM_FLOAT, "angle", "Offset angle" }, - { PARAM_INT8, "backwards", "Map backwards?" }, - { PARAM_INT8, "inverse", "Map from top?" }, - { PARAM_INT8, "polrec", "Polar to rectangular?" }, + { PARAM_INT32, "backwards", "Map backwards?" }, + { PARAM_INT32, "inverse", "Map from top?" }, + { PARAM_INT32, "polrec", "Polar to rectangular?" }, }; /* args */ static GParamDef *return_vals = NULL; @@ -319,9 +323,9 @@ run(char *name, if (status == STATUS_SUCCESS) { pcvals.circle = param[3].data.d_float; pcvals.angle = param[4].data.d_float; - pcvals.backwards = param[5].data.d_int8; - pcvals.inverse = param[6].data.d_int8; - pcvals.polrec = param[7].data.d_int8; + pcvals.backwards = param[5].data.d_int32; + pcvals.inverse = param[6].data.d_int32; + pcvals.polrec = param[7].data.d_int32; } /* if */ break; @@ -954,7 +958,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Map Backwards"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.backwards); - gtk_signal_connect(GTK_OBJECT(toggle), "clicked", + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.backwards); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -963,7 +967,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Map from Top"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.inverse); - gtk_signal_connect( GTK_OBJECT(toggle), "clicked", + gtk_signal_connect( GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.inverse); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -972,7 +976,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Polar to Rectangular"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.polrec); - gtk_signal_connect( GTK_OBJECT(toggle), "clicked", + gtk_signal_connect( GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.polrec); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -1237,9 +1241,9 @@ dialog_cancel_callback(GtkWidget *widget, gpointer data) static void polar_toggle_callback (GtkWidget *widget, gpointer data) { - int *toggle_val; + gint *toggle_val; - toggle_val = (int *) data; + toggle_val = (gint *) data; if (GTK_TOGGLE_BUTTON (widget)->active) *toggle_val = TRUE; diff --git a/plug-ins/polar/polar.c b/plug-ins/polar/polar.c index 47693d6464..cb4a4cc226 100644 --- a/plug-ins/polar/polar.c +++ b/plug-ins/polar/polar.c @@ -63,6 +63,10 @@ #include "gtk/gtk.h" #include "libgimp/gimp.h" +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* M_PI */ + #define sqr(x) ((x) * (x)) #define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0) @@ -199,9 +203,9 @@ query(void) { PARAM_DRAWABLE, "drawable", "Input drawable" }, { PARAM_FLOAT, "circle", "Circle depth in %" }, { PARAM_FLOAT, "angle", "Offset angle" }, - { PARAM_INT8, "backwards", "Map backwards?" }, - { PARAM_INT8, "inverse", "Map from top?" }, - { PARAM_INT8, "polrec", "Polar to rectangular?" }, + { PARAM_INT32, "backwards", "Map backwards?" }, + { PARAM_INT32, "inverse", "Map from top?" }, + { PARAM_INT32, "polrec", "Polar to rectangular?" }, }; /* args */ static GParamDef *return_vals = NULL; @@ -319,9 +323,9 @@ run(char *name, if (status == STATUS_SUCCESS) { pcvals.circle = param[3].data.d_float; pcvals.angle = param[4].data.d_float; - pcvals.backwards = param[5].data.d_int8; - pcvals.inverse = param[6].data.d_int8; - pcvals.polrec = param[7].data.d_int8; + pcvals.backwards = param[5].data.d_int32; + pcvals.inverse = param[6].data.d_int32; + pcvals.polrec = param[7].data.d_int32; } /* if */ break; @@ -954,7 +958,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Map Backwards"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.backwards); - gtk_signal_connect(GTK_OBJECT(toggle), "clicked", + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.backwards); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -963,7 +967,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Map from Top"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.inverse); - gtk_signal_connect( GTK_OBJECT(toggle), "clicked", + gtk_signal_connect( GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.inverse); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -972,7 +976,7 @@ polarize_dialog(void) toggle = gtk_check_button_new_with_label("Polar to Rectangular"); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(toggle), pcvals.polrec); - gtk_signal_connect( GTK_OBJECT(toggle), "clicked", + gtk_signal_connect( GTK_OBJECT(toggle), "toggled", (GtkSignalFunc) polar_toggle_callback, &pcvals.polrec); gtk_box_pack_start( GTK_BOX (hbox), toggle, TRUE, TRUE, 0); @@ -1237,9 +1241,9 @@ dialog_cancel_callback(GtkWidget *widget, gpointer data) static void polar_toggle_callback (GtkWidget *widget, gpointer data) { - int *toggle_val; + gint *toggle_val; - toggle_val = (int *) data; + toggle_val = (gint *) data; if (GTK_TOGGLE_BUTTON (widget)->active) *toggle_val = TRUE; diff --git a/plug-ins/script-fu/script-fu-interface.c b/plug-ins/script-fu/script-fu-interface.c index 7de6f642e4..fbd409d05d 100644 --- a/plug-ins/script-fu/script-fu-interface.c +++ b/plug-ins/script-fu/script-fu-interface.c @@ -111,6 +111,9 @@ static void script_fu_preview_changed (GtkWidget *widget, gpointer data); static void script_fu_preview_cancel (GtkWidget *widget, gpointer data); +static gint script_fu_preview_delete (GtkWidget *widget, + GdkEvent *event, + gpointer data); /* * Local variables @@ -1095,12 +1098,12 @@ script_fu_preview_callback (GtkWidget *widget, SFColor *color; color = (SFColor *) data; + color->old_color[0] = color->color[0]; + color->old_color[1] = color->color[1]; + color->old_color[2] = color->color[2]; + if (!color->dialog) { - color->old_color[0] = color->color[0]; - color->old_color[1] = color->color[1]; - color->old_color[2] = color->color[2]; - color->dialog = gtk_color_selection_dialog_new ("Script-Fu Color Picker"); csd = GTK_COLOR_SELECTION_DIALOG (color->dialog); @@ -1109,6 +1112,9 @@ script_fu_preview_callback (GtkWidget *widget, gtk_signal_connect_object (GTK_OBJECT (csd->ok_button), "clicked", (GtkSignalFunc) gtk_widget_hide, GTK_OBJECT (color->dialog)); + gtk_signal_connect (GTK_OBJECT (csd), "delete_event", + (GtkSignalFunc) script_fu_preview_delete, + color); gtk_signal_connect (GTK_OBJECT (csd->cancel_button), "clicked", (GtkSignalFunc) script_fu_preview_cancel, color); @@ -1158,3 +1164,12 @@ script_fu_preview_cancel (GtkWidget *widget, script_fu_color_preview (color->preview, color->color); } + +static gint +script_fu_preview_delete (GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + script_fu_preview_cancel (widget, data); + return TRUE; +} diff --git a/plug-ins/script-fu/script-fu-scripts.c b/plug-ins/script-fu/script-fu-scripts.c index 7de6f642e4..fbd409d05d 100644 --- a/plug-ins/script-fu/script-fu-scripts.c +++ b/plug-ins/script-fu/script-fu-scripts.c @@ -111,6 +111,9 @@ static void script_fu_preview_changed (GtkWidget *widget, gpointer data); static void script_fu_preview_cancel (GtkWidget *widget, gpointer data); +static gint script_fu_preview_delete (GtkWidget *widget, + GdkEvent *event, + gpointer data); /* * Local variables @@ -1095,12 +1098,12 @@ script_fu_preview_callback (GtkWidget *widget, SFColor *color; color = (SFColor *) data; + color->old_color[0] = color->color[0]; + color->old_color[1] = color->color[1]; + color->old_color[2] = color->color[2]; + if (!color->dialog) { - color->old_color[0] = color->color[0]; - color->old_color[1] = color->color[1]; - color->old_color[2] = color->color[2]; - color->dialog = gtk_color_selection_dialog_new ("Script-Fu Color Picker"); csd = GTK_COLOR_SELECTION_DIALOG (color->dialog); @@ -1109,6 +1112,9 @@ script_fu_preview_callback (GtkWidget *widget, gtk_signal_connect_object (GTK_OBJECT (csd->ok_button), "clicked", (GtkSignalFunc) gtk_widget_hide, GTK_OBJECT (color->dialog)); + gtk_signal_connect (GTK_OBJECT (csd), "delete_event", + (GtkSignalFunc) script_fu_preview_delete, + color); gtk_signal_connect (GTK_OBJECT (csd->cancel_button), "clicked", (GtkSignalFunc) script_fu_preview_cancel, color); @@ -1158,3 +1164,12 @@ script_fu_preview_cancel (GtkWidget *widget, script_fu_color_preview (color->preview, color->color); } + +static gint +script_fu_preview_delete (GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + script_fu_preview_cancel (widget, data); + return TRUE; +}