From f50e083734fb1f7f913a1fa654b68cd6d0309452 Mon Sep 17 00:00:00 2001 From: Maurits Rijk Date: Fri, 6 Jun 2003 10:39:27 +0000 Subject: [PATCH] Fix for #114496 and #83947. Minor code clean-up. --- ChangeLog | 13 +++ plug-ins/common/CML_explorer.c | 94 +++++++++++-------- plug-ins/gflare/gflare.c | 17 +--- plug-ins/imagemap/imap_csim_parse.c | 111 ++++++++++++----------- plug-ins/script-fu/scripts/old-photo.scm | 104 ++++++++++----------- 5 files changed, 187 insertions(+), 152 deletions(-) diff --git a/ChangeLog b/ChangeLog index 066338197a..c126d65a4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-06-06 Maurits + + * plug-ins/script-fu/scripts/old-photo.scm: fix for #114496 (Script-Fu: + Old Photo can't be completely undone) + + * plug-ins/common/CML_explorer.c: fix for #83947 (CML explorer: + multiple instantiations of Load Parameters dialog) + 2003-06-06 Michael Natterer * app/widgets/gimpitemfactory.c (gimp_item_factory_set_label): @@ -300,6 +308,11 @@ * plug-ins/xjt/xjt.c: Use _mkdir() on Win32. +2003-05-30 Maurits Rijk + + * plug-ins/gflare/gflare.c: fixed type in mnemonics for edit dialog + and removed unused typedef. + 2003-05-30 Maurits Rijk * plug-ins/common/film.c (film_dialog): fix for #113882 (Clean-up Film diff --git a/plug-ins/common/CML_explorer.c b/plug-ins/common/CML_explorer.c index ad9a1e4a7a..20f8c0f721 100644 --- a/plug-ins/common/CML_explorer.c +++ b/plug-ins/common/CML_explorer.c @@ -1533,7 +1533,7 @@ CML_explorer_dialog (void) CML_initial_value_sensitives_update (); - /* Displaying preview might takes a long time. Thus, fisrt, dialog itself + /* Displaying preview might takes a long time. Thus, first, dialog itself * should be shown before making preview in it. */ gtk_widget_show (dlg); @@ -2080,29 +2080,38 @@ static void CML_save_to_file_callback (GtkWidget *widget, gpointer data) { - GtkWidget *filesel; + static GtkWidget *filesel; - filesel = gtk_file_selection_new (_("Save Parameters to")); - gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE); + if (!filesel) + { + filesel = gtk_file_selection_new (_("Save Parameters to")); + gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE); + + g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button, + "clicked", + G_CALLBACK (CML_execute_save_to_file), + filesel); - g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button, - "clicked", - G_CALLBACK (CML_execute_save_to_file), - filesel); + g_signal_connect_swapped(G_OBJECT(filesel), "delete_event", + G_CALLBACK (gtk_widget_hide), + filesel); - g_signal_connect_swapped (GTK_FILE_SELECTION (filesel)->cancel_button, - "clicked", - G_CALLBACK (gtk_widget_destroy), - filesel); + g_signal_connect_swapped (GTK_FILE_SELECTION (filesel)->cancel_button, + "clicked", + G_CALLBACK (gtk_widget_hide), + filesel); + gimp_help_connect (filesel, gimp_standard_help_func, + "filters/cml_explorer.html"); + } if (strlen (VALS.last_file_name) > 0) gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), VALS.last_file_name); - gimp_help_connect (filesel, gimp_standard_help_func, - "filters/cml_explorer.html"); - - gtk_widget_show (filesel); + if (GTK_WIDGET_VISIBLE (filesel)) + gdk_window_raise (filesel->window); + else + gtk_widget_show (filesel); } static void @@ -2212,7 +2221,7 @@ CML_execute_save_to_file (GtkWidget *widget, sizeof (VALS.last_file_name) - 1); } - gtk_widget_destroy (GTK_WIDGET (data)); + gtk_widget_hide (GTK_WIDGET (data)); } static gint @@ -2278,32 +2287,45 @@ static void CML_load_from_file_callback (GtkWidget *widget, gpointer data) { - GtkWidget *filesel; + static GtkWidget *filesel; + + if (!filesel) + { + filesel = gtk_file_selection_new (""); + + gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE); + + g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button, + "clicked", + G_CALLBACK (CML_execute_load_from_file), + filesel); + + g_signal_connect_swapped(G_OBJECT(filesel), "delete_event", + G_CALLBACK (gtk_widget_hide), + filesel); + + g_signal_connect_swapped (GTK_FILE_SELECTION (filesel)->cancel_button, + "clicked", + G_CALLBACK (gtk_widget_hide), + filesel); + + gimp_help_connect (filesel, gimp_standard_help_func, + "filters/cml_explorer.html"); + } if ((selective_load_source == 0) || (selective_load_destination == 0)) - filesel = gtk_file_selection_new (_("Load Parameters from")); + gtk_window_set_title (GTK_WINDOW (filesel), _("Load Parameters from")); else - filesel = gtk_file_selection_new (_("Selective Load from")); - gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE); - - g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button, - "clicked", - G_CALLBACK (CML_execute_load_from_file), - filesel); - - g_signal_connect_swapped (GTK_FILE_SELECTION (filesel)->cancel_button, - "clicked", - G_CALLBACK (gtk_widget_destroy), - filesel); - + gtk_window_set_title (GTK_WINDOW (filesel), _("Selective Load from")); + if (strlen (VALS.last_file_name) > 0) gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), VALS.last_file_name); - gimp_help_connect (filesel, gimp_standard_help_func, - "filters/cml_explorer.html"); - - gtk_widget_show (filesel); + if (GTK_WIDGET_VISIBLE (filesel)) + gdk_window_raise (filesel->window); + else + gtk_widget_show (filesel); } static void diff --git a/plug-ins/gflare/gflare.c b/plug-ins/gflare/gflare.c index 1e4386ee1b..5b6290c4f2 100644 --- a/plug-ins/gflare/gflare.c +++ b/plug-ins/gflare/gflare.c @@ -304,15 +304,6 @@ typedef struct /* these values don't belong to drawable, though. */ } DrawableInfo; -typedef struct -{ - GimpTile *tile; - gint col; - gint row; - gint shadow; - gint dirty; -} TileKeeper; - typedef struct _GradientMenu GradientMenu; typedef void (* GradientMenuCallback) (gchar *gradient_name, gpointer data); @@ -3430,7 +3421,7 @@ ed_make_page_general (GFlareEditor *ed, option_menu, 1, TRUE); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("_General"))); + gtk_label_new_with_mnemonic (_("_General"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_GENERAL); @@ -3535,7 +3526,7 @@ ed_make_page_glow (GFlareEditor *ed, gtk_widget_show (table); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("G_low"))); + gtk_label_new_with_mnemonic (_("G_low"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_GLOW); @@ -3667,7 +3658,7 @@ ed_make_page_rays (GFlareEditor *ed, gtk_widget_show (table); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("_Rays"))); + gtk_label_new_with_mnemonic (_("_Rays"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_RAYS); @@ -3862,7 +3853,7 @@ ed_make_page_sflare (GFlareEditor *ed, NULL); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("_Second Flares"))); + gtk_label_new_with_mnemonic (_("_Second Flares"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_SFLARE); diff --git a/plug-ins/imagemap/imap_csim_parse.c b/plug-ins/imagemap/imap_csim_parse.c index d0004d3de9..708edc85d4 100644 --- a/plug-ins/imagemap/imap_csim_parse.c +++ b/plug-ins/imagemap/imap_csim_parse.c @@ -99,12 +99,12 @@ typedef union { -#define YYFINAL 103 +#define YYFINAL 106 #define YYFLAG -32768 #define YYNTBASE 33 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 282 ? yytranslate[x] : 62) +#define YYTRANSLATE(x) ((unsigned)(x) <= 282 ? yytranslate[x] : 63) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -147,12 +147,12 @@ static const short yyprhs[] = 34, 38, 42, 44, 46, 53, 54, 57, 59, 61, 63, 67, 71, 75, 76, 79, 84, 86, 89, 90, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, - 113, 117, 121, 125, 127, 131, 135, 139, 143, 147, - 151 + 113, 117, 121, 125, 128, 129, 132, 136, 140, 144, + 148, 152, 156 }; static const short yyrhs[] = { - 34, 40, 41, 46, 61, 0, 29, 3, 4, 30, + 34, 40, 41, 46, 62, 0, 29, 3, 4, 30, 28, 35, 48, 0, 0, 35, 36, 0, 37, 0, 38, 0, 7, 30, 39, 0, 8, 30, 28, 0, 15, 30, 28, 0, 5, 30, 39, 0, 6, 30, @@ -162,12 +162,12 @@ static const short yyrhs[] = 0, 24, 28, 26, 0, 0, 46, 47, 0, 29, 12, 49, 48, 0, 31, 0, 32, 31, 0, 0, 49, 50, 0, 51, 0, 52, 0, 53, 0, 54, - 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, - 0, 60, 0, 13, 30, 28, 0, 14, 30, 28, - 0, 16, 30, 28, 0, 17, 0, 15, 30, 28, - 0, 18, 30, 28, 0, 19, 30, 28, 0, 20, - 30, 28, 0, 21, 30, 28, 0, 22, 30, 28, - 0, 29, 10, 31, 0 + 0, 56, 0, 57, 0, 58, 0, 59, 0, 60, + 0, 61, 0, 13, 30, 28, 0, 14, 30, 28, + 0, 16, 30, 28, 0, 17, 55, 0, 0, 30, + 28, 0, 15, 30, 28, 0, 18, 30, 28, 0, + 19, 30, 28, 0, 20, 30, 28, 0, 21, 30, + 28, 0, 22, 30, 28, 0, 29, 10, 31, 0 }; #endif @@ -180,8 +180,8 @@ static const short yyrline[] = 84, 90, 96, 100, 106, 112, 113, 116, 117, 118, 121, 126, 133, 143, 144, 147, 154, 155, 158, 159, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 174, 191, 249, 259, 264, 270, 276, 282, 288, 294, - 300 + 174, 191, 249, 259, 264, 265, 270, 276, 282, 288, + 294, 300, 306 }; #endif @@ -200,9 +200,9 @@ static const char *const yytname[] = "image_height", "integer_value", "start_map", "comment_lines", "comment_line", "real_comment", "author_line", "description_line", "area_list", "area", "xhtml_close", "tag_list", "tag", "shape_tag", - "coords_tag", "href_tag", "nohref_tag", "alt_tag", "target_tag", - "onmouseover_tag", "onmouseout_tag", "onfocus_tag", "onblur_tag", - "end_map", 0 + "coords_tag", "href_tag", "nohref_tag", "optional_value", "alt_tag", + "target_tag", "onmouseover_tag", "onmouseout_tag", "onfocus_tag", + "onblur_tag", "end_map", 0 }; #endif @@ -213,8 +213,8 @@ static const short yyr1[] = 37, 38, 39, 39, 40, 41, 41, 42, 42, 42, 43, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61 + 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, + 60, 61, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -224,8 +224,8 @@ static const short yyr2[] = 3, 3, 1, 1, 6, 0, 2, 1, 1, 1, 3, 3, 3, 0, 2, 4, 1, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, - 3 + 3, 3, 3, 2, 0, 2, 3, 3, 3, 3, + 3, 3, 3 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -237,20 +237,20 @@ static const short yydefact[] = 0, 0, 0, 0, 16, 19, 17, 18, 0, 3, 0, 0, 0, 0, 0, 24, 1, 0, 0, 21, 22, 20, 0, 28, 0, 0, 0, 0, 0, 26, - 0, 4, 5, 6, 2, 14, 50, 0, 0, 0, - 0, 0, 0, 27, 0, 0, 0, 0, 43, 0, + 0, 4, 5, 6, 2, 14, 52, 0, 0, 0, + 0, 0, 0, 27, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 25, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 12, 13, 10, 11, - 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 41, 44, 42, 45, 46, 47, 48, - 49, 0, 0, 0 + 7, 8, 9, 0, 0, 0, 0, 0, 43, 0, + 0, 0, 0, 0, 40, 41, 46, 42, 45, 47, + 48, 49, 50, 51, 0, 0, 0 }; static const short yydefgoto[] = { - 101, 2, 27, 41, 42, 43, 78, 5, 8, 14, + 104, 2, 27, 41, 42, 43, 78, 5, 8, 14, 15, 16, 17, 18, 25, 44, 47, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 26 + 68, 69, 88, 70, 71, 72, 73, 74, 75, 26 }; static const short yypact[] = @@ -260,23 +260,23 @@ static const short yypact[] = 14, 17, 18, 19, -3,-32768,-32768, -5, 9,-32768, -32768,-32768, 15,-32768, 20, 21, 25, 26, 28,-32768, 16,-32768,-32768,-32768,-32768,-32768,-32768, -2, -6, -6, - -6, 29, 31,-32768, 30, 32, 33, 34,-32768, 35, - 36, 37, 38, 39,-32768,-32768,-32768,-32768,-32768,-32768, + -6, 29, 31,-32768, 30, 32, 33, 34, 35, 36, + 37, 38, 39, 40,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 42, 43, 44, 45, 46, 47, 48, - 49, 50,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 52, 53,-32768 + -32768,-32768,-32768, 43, 44, 45, 46, 47,-32768, 48, + 49, 50, 51, 52,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, 53, 54,-32768 }; static const short yypgoto[] = { -32768,-32768,-32768,-32768,-32768,-32768, -26,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 1,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768 + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768 }; -#define YYLAST 78 +#define YYLAST 80 static const short yytable[] = @@ -286,9 +286,10 @@ static const short yytable[] = 63, 76, 77, 79, 80, 3, 39, 40, 4, 39, 40, 6, 7, 9, 19, 10, 21, 20, 22, 23, 45, 24, 28, 29, 30, 31, 46, 53, 64, 0, - 48, 49, 102, 103, 0, 50, 51, 81, 52, 82, - 83, 0, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100 + 48, 49, 0, 105, 106, 50, 51, 81, 52, 82, + 83, 0, 84, 85, 86, 87, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103 }; static const short yycheck[] = @@ -298,9 +299,10 @@ static const short yycheck[] = 22, 27, 28, 49, 50, 3, 31, 32, 29, 31, 32, 4, 9, 30, 28, 11, 28, 30, 28, 28, 31, 29, 28, 26, 26, 26, 31, 31, 47, -1, - 30, 30, 0, 0, -1, 30, 30, 28, 30, 28, + 30, 30, -1, 0, 0, 30, 30, 28, 30, 28, 30, -1, 30, 30, 30, 30, 30, 30, 30, 30, - 28, 28, 28, 28, 28, 28, 28, 28, 28 + 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" @@ -1176,38 +1178,43 @@ case 43: { } break; -case 44: -#line 265 "imap_csim.y" +case 45: +#line 266 "imap_csim.y" +{ + } + break; +case 46: +#line 271 "imap_csim.y" { object_set_comment(current_object, yyvsp[0].id); } break; -case 45: -#line 271 "imap_csim.y" +case 47: +#line 277 "imap_csim.y" { object_set_target(current_object, yyvsp[0].id); } break; -case 46: -#line 277 "imap_csim.y" +case 48: +#line 283 "imap_csim.y" { object_set_mouse_over(current_object, yyvsp[0].id); } break; -case 47: -#line 283 "imap_csim.y" +case 49: +#line 289 "imap_csim.y" { object_set_mouse_out(current_object, yyvsp[0].id); } break; -case 48: -#line 289 "imap_csim.y" +case 50: +#line 295 "imap_csim.y" { object_set_focus(current_object, yyvsp[0].id); } break; -case 49: -#line 295 "imap_csim.y" +case 51: +#line 301 "imap_csim.y" { object_set_blur(current_object, yyvsp[0].id); } @@ -1445,7 +1452,7 @@ yyreturn: #endif return yyresult; } -#line 303 "imap_csim.y" +#line 309 "imap_csim.y" static void diff --git a/plug-ins/script-fu/scripts/old-photo.scm b/plug-ins/script-fu/scripts/old-photo.scm index b09f314a7a..e627ebb1be 100644 --- a/plug-ins/script-fu/scripts/old-photo.scm +++ b/plug-ins/script-fu/scripts/old-photo.scm @@ -25,58 +25,60 @@ ; Define the function: (define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy) - (gimp-selection-all inImage) - (set! theImage (if (= inCopy TRUE) - (car (gimp-image-duplicate inImage)) - inImage) + (gimp-undo-push-group-start inImage) + (gimp-selection-all inImage) + (set! theImage (if (= inCopy TRUE) + (car (gimp-image-duplicate inImage)) + inImage) ) - - (set! theLayer (car(gimp-image-flatten theImage))) - (if (= inDefocus TRUE) - (plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE) - () - ) - (if (> inBorderSize 0) - (script-fu-fuzzy-border theImage inLayer '(255 255 255) - inBorderSize TRUE 8 FALSE 100 FALSE TRUE ) - () - ) - (set! theLayer (car(gimp-image-flatten theImage))) - - (if (= inSepia TRUE) - (begin (gimp-desaturate theLayer) - (gimp-brightness-contrast theLayer -20 -40) - (gimp-color-balance theLayer 0 TRUE 30 0 -30) - ) - () - ) - (set! theWidth (car (gimp-image-width theImage))) - (set! theHeight (car (gimp-image-height theImage))) - (if (= inMottle TRUE) - (begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Mottle" 100 DARKEN-ONLY))) - - (gimp-image-add-layer theImage mLayer 0) - (gimp-selection-all theImage) - (gimp-edit-clear mLayer) - (gimp-selection-none theImage) - (plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5) - (plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE) - (set! theLayer (car(gimp-image-flatten theImage))) - ) - () - ) - - - - (if (= inCopy TRUE) - (begin (gimp-image-clean-all theImage) - (gimp-display-new theImage) - ) - () - ) - (gimp-selection-none inImage) - (gimp-displays-flush theImage) -) + + (set! theLayer (car(gimp-image-flatten theImage))) + (if (= inDefocus TRUE) + (plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE) + () + ) + (if (> inBorderSize 0) + (script-fu-fuzzy-border theImage inLayer '(255 255 255) + inBorderSize TRUE 8 FALSE 100 FALSE TRUE ) + () + ) + (set! theLayer (car(gimp-image-flatten theImage))) + + (if (= inSepia TRUE) + (begin (gimp-desaturate theLayer) + (gimp-brightness-contrast theLayer -20 -40) + (gimp-color-balance theLayer 0 TRUE 30 0 -30) + ) + () + ) + (set! theWidth (car (gimp-image-width theImage))) + (set! theHeight (car (gimp-image-height theImage))) + (if (= inMottle TRUE) + (begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Mottle" 100 DARKEN-ONLY))) + + (gimp-image-add-layer theImage mLayer 0) + (gimp-selection-all theImage) + (gimp-edit-clear mLayer) + (gimp-selection-none theImage) + (plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5) + (plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE) + (set! theLayer (car(gimp-image-flatten theImage))) + ) + () + ) + + + + (if (= inCopy TRUE) + (begin (gimp-image-clean-all theImage) + (gimp-display-new theImage) + ) + () + ) + (gimp-selection-none inImage) + (gimp-undo-push-group-end inImage) + (gimp-displays-flush theImage) + ) ; Register the function with the GIMP: