From 114d5567c5c475639f239c6512c542337a8fb159 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Thu, 24 Aug 2000 00:33:11 +0000 Subject: [PATCH] perl support for COMPAT_CRUFT * configure.in: perl support for COMPAT_CRUFT * plug-ins/gap/gap_decode_mpeg_main.c: removed COMPAT_CRUFT -Yosh --- ChangeLog | 6 ++ app/about_dialog.c | 86 ++++++++++++++++++++++++++++- app/dialogs/about-dialog.c | 86 ++++++++++++++++++++++++++++- app/gui/about-dialog.c | 86 ++++++++++++++++++++++++++++- configure.in | 1 + plug-ins/gap/gap_decode_mpeg_main.c | 2 +- plug-ins/perl/Changes | 1 + plug-ins/perl/config.pl.in | 1 + plug-ins/perl/configure.frag | 1 + plug-ins/perl/configure.in | 2 + 10 files changed, 265 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6160cb8cda..83cfb2785f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Aug 23 17:31:35 PDT 2000 Manish Singh + + * configure.in: perl support for COMPAT_CRUFT + + * plug-ins/gap/gap_decode_mpeg_main.c: removed COMPAT_CRUFT + 2000-08-24 Sven Neumann * plug-ins/gap/iter_ALT/*/*.inc: removed COMPAT_CRUFT diff --git a/app/about_dialog.c b/app/about_dialog.c index c9cfeea726..a6238020a1 100644 --- a/app/about_dialog.c +++ b/app/about_dialog.c @@ -24,6 +24,7 @@ #include #include +#include #include "about_dialog.h" #include "appenv.h" @@ -55,6 +56,9 @@ static gint about_dialog_logo_expose (GtkWidget *widget, static gint about_dialog_button (GtkWidget *widget, GdkEventButton *event, gpointer data); +static gint about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data); static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, gpointer data); @@ -77,6 +81,7 @@ static gint scroll_state = 0; static gint frame = 0; static gint offset = 0; static gint timer = 0; +static gint hadja_state = 0; static gchar **scroll_text = authors; static gint nscroll_texts = sizeof (authors) / sizeof (authors[0]); static gint scroll_text_widths[sizeof (authors) / sizeof (authors[0])]; @@ -99,6 +104,12 @@ static gchar *drop_text[] = "Resistance is futile." }; +static gchar *hadja_text[] = +{ + "Hadjaha!", + "Nej!", + "Tvärtom!" +}; void about_dialog_create (void) @@ -133,7 +144,10 @@ about_dialog_create (void) gtk_signal_connect (GTK_OBJECT (about_dialog), "button_press_event", GTK_SIGNAL_FUNC (about_dialog_button), NULL); - + gtk_signal_connect (GTK_OBJECT (about_dialog), "key_press_event", + GTK_SIGNAL_FUNC (about_dialog_key), + NULL); + /* dnd stuff */ gtk_drag_dest_set (about_dialog, GTK_DEST_DEFAULT_MOTION | @@ -222,6 +236,11 @@ about_dialog_create (void) max_width = MAX (max_width, gdk_string_width (aboutframe->style->font, drop_text[i])); } + for (i = 0; i < (sizeof (hadja_text) / sizeof (hadja_text[0])); i++) + { + max_width = MAX (max_width, + gdk_string_width (aboutframe->style->font, hadja_text[i])); + } scroll_area = gtk_drawing_area_new (); gtk_drawing_area_size (GTK_DRAWING_AREA (scroll_area), max_width + 10, @@ -281,7 +300,6 @@ about_dialog_create (void) } } - static gboolean about_dialog_load_logo (GtkWidget *window) { @@ -442,6 +460,70 @@ about_dialog_button (GtkWidget *widget, return FALSE; } +static gint +about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + gint i; + + switch (event->keyval) + { + case GDK_h: + case GDK_H: + if (hadja_state == 0 || hadja_state == 5) + hadja_state++; + else + hadja_state = 1; + break; + case GDK_a: + case GDK_A: + if (hadja_state == 1 || hadja_state == 4 || hadja_state == 6) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_d: + case GDK_D: + if (hadja_state == 2) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_j: + case GDK_J: + if (hadja_state == 3) + hadja_state++; + else + hadja_state = 0; + break; + default: + hadja_state = 0; + } + + if (hadja_state == 7) + { + scroll_text = hadja_text; + nscroll_texts = sizeof (hadja_text) / sizeof (hadja_text[0]); + + for (i = 0; i < nscroll_texts; i++) + { + shuffle_array[i] = i; + scroll_text_widths[i] = gdk_string_width (scroll_area->style->font, + scroll_text[i]); + } + + scroll_state = 0; + cur_scroll_index = 0; + cur_scroll_text = 0; + offset = 0; + + double_speed = TRUE; + } + + return FALSE; +} + static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c index c9cfeea726..a6238020a1 100644 --- a/app/dialogs/about-dialog.c +++ b/app/dialogs/about-dialog.c @@ -24,6 +24,7 @@ #include #include +#include #include "about_dialog.h" #include "appenv.h" @@ -55,6 +56,9 @@ static gint about_dialog_logo_expose (GtkWidget *widget, static gint about_dialog_button (GtkWidget *widget, GdkEventButton *event, gpointer data); +static gint about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data); static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, gpointer data); @@ -77,6 +81,7 @@ static gint scroll_state = 0; static gint frame = 0; static gint offset = 0; static gint timer = 0; +static gint hadja_state = 0; static gchar **scroll_text = authors; static gint nscroll_texts = sizeof (authors) / sizeof (authors[0]); static gint scroll_text_widths[sizeof (authors) / sizeof (authors[0])]; @@ -99,6 +104,12 @@ static gchar *drop_text[] = "Resistance is futile." }; +static gchar *hadja_text[] = +{ + "Hadjaha!", + "Nej!", + "Tvärtom!" +}; void about_dialog_create (void) @@ -133,7 +144,10 @@ about_dialog_create (void) gtk_signal_connect (GTK_OBJECT (about_dialog), "button_press_event", GTK_SIGNAL_FUNC (about_dialog_button), NULL); - + gtk_signal_connect (GTK_OBJECT (about_dialog), "key_press_event", + GTK_SIGNAL_FUNC (about_dialog_key), + NULL); + /* dnd stuff */ gtk_drag_dest_set (about_dialog, GTK_DEST_DEFAULT_MOTION | @@ -222,6 +236,11 @@ about_dialog_create (void) max_width = MAX (max_width, gdk_string_width (aboutframe->style->font, drop_text[i])); } + for (i = 0; i < (sizeof (hadja_text) / sizeof (hadja_text[0])); i++) + { + max_width = MAX (max_width, + gdk_string_width (aboutframe->style->font, hadja_text[i])); + } scroll_area = gtk_drawing_area_new (); gtk_drawing_area_size (GTK_DRAWING_AREA (scroll_area), max_width + 10, @@ -281,7 +300,6 @@ about_dialog_create (void) } } - static gboolean about_dialog_load_logo (GtkWidget *window) { @@ -442,6 +460,70 @@ about_dialog_button (GtkWidget *widget, return FALSE; } +static gint +about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + gint i; + + switch (event->keyval) + { + case GDK_h: + case GDK_H: + if (hadja_state == 0 || hadja_state == 5) + hadja_state++; + else + hadja_state = 1; + break; + case GDK_a: + case GDK_A: + if (hadja_state == 1 || hadja_state == 4 || hadja_state == 6) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_d: + case GDK_D: + if (hadja_state == 2) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_j: + case GDK_J: + if (hadja_state == 3) + hadja_state++; + else + hadja_state = 0; + break; + default: + hadja_state = 0; + } + + if (hadja_state == 7) + { + scroll_text = hadja_text; + nscroll_texts = sizeof (hadja_text) / sizeof (hadja_text[0]); + + for (i = 0; i < nscroll_texts; i++) + { + shuffle_array[i] = i; + scroll_text_widths[i] = gdk_string_width (scroll_area->style->font, + scroll_text[i]); + } + + scroll_state = 0; + cur_scroll_index = 0; + cur_scroll_text = 0; + offset = 0; + + double_speed = TRUE; + } + + return FALSE; +} + static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, diff --git a/app/gui/about-dialog.c b/app/gui/about-dialog.c index c9cfeea726..a6238020a1 100644 --- a/app/gui/about-dialog.c +++ b/app/gui/about-dialog.c @@ -24,6 +24,7 @@ #include #include +#include #include "about_dialog.h" #include "appenv.h" @@ -55,6 +56,9 @@ static gint about_dialog_logo_expose (GtkWidget *widget, static gint about_dialog_button (GtkWidget *widget, GdkEventButton *event, gpointer data); +static gint about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data); static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, gpointer data); @@ -77,6 +81,7 @@ static gint scroll_state = 0; static gint frame = 0; static gint offset = 0; static gint timer = 0; +static gint hadja_state = 0; static gchar **scroll_text = authors; static gint nscroll_texts = sizeof (authors) / sizeof (authors[0]); static gint scroll_text_widths[sizeof (authors) / sizeof (authors[0])]; @@ -99,6 +104,12 @@ static gchar *drop_text[] = "Resistance is futile." }; +static gchar *hadja_text[] = +{ + "Hadjaha!", + "Nej!", + "Tvärtom!" +}; void about_dialog_create (void) @@ -133,7 +144,10 @@ about_dialog_create (void) gtk_signal_connect (GTK_OBJECT (about_dialog), "button_press_event", GTK_SIGNAL_FUNC (about_dialog_button), NULL); - + gtk_signal_connect (GTK_OBJECT (about_dialog), "key_press_event", + GTK_SIGNAL_FUNC (about_dialog_key), + NULL); + /* dnd stuff */ gtk_drag_dest_set (about_dialog, GTK_DEST_DEFAULT_MOTION | @@ -222,6 +236,11 @@ about_dialog_create (void) max_width = MAX (max_width, gdk_string_width (aboutframe->style->font, drop_text[i])); } + for (i = 0; i < (sizeof (hadja_text) / sizeof (hadja_text[0])); i++) + { + max_width = MAX (max_width, + gdk_string_width (aboutframe->style->font, hadja_text[i])); + } scroll_area = gtk_drawing_area_new (); gtk_drawing_area_size (GTK_DRAWING_AREA (scroll_area), max_width + 10, @@ -281,7 +300,6 @@ about_dialog_create (void) } } - static gboolean about_dialog_load_logo (GtkWidget *window) { @@ -442,6 +460,70 @@ about_dialog_button (GtkWidget *widget, return FALSE; } +static gint +about_dialog_key (GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + gint i; + + switch (event->keyval) + { + case GDK_h: + case GDK_H: + if (hadja_state == 0 || hadja_state == 5) + hadja_state++; + else + hadja_state = 1; + break; + case GDK_a: + case GDK_A: + if (hadja_state == 1 || hadja_state == 4 || hadja_state == 6) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_d: + case GDK_D: + if (hadja_state == 2) + hadja_state++; + else + hadja_state = 0; + break; + case GDK_j: + case GDK_J: + if (hadja_state == 3) + hadja_state++; + else + hadja_state = 0; + break; + default: + hadja_state = 0; + } + + if (hadja_state == 7) + { + scroll_text = hadja_text; + nscroll_texts = sizeof (hadja_text) / sizeof (hadja_text[0]); + + for (i = 0; i < nscroll_texts; i++) + { + shuffle_array[i] = i; + scroll_text_widths[i] = gdk_string_width (scroll_area->style->font, + scroll_text[i]); + } + + scroll_state = 0; + cur_scroll_index = 0; + cur_scroll_text = 0; + offset = 0; + + double_speed = TRUE; + } + + return FALSE; +} + static void about_dialog_tool_drop (GtkWidget *widget, ToolType tool, diff --git a/configure.in b/configure.in index 9a2ac46dc0..739d12b903 100644 --- a/configure.in +++ b/configure.in @@ -617,6 +617,7 @@ if test "x$enable_perl" != xno; then GIMP_LIBS="$GIMP_LIBS_NOUI -lgimpui" GIMPTOOL="../../gimptool" IN_GIMP=1 + PERL_COMPAT_CRUFT="-DGIMP_ENABLE_COMPAT_CRUFT" EXTENSIVE_TESTS=0 dnl include the autoconf fragment from there diff --git a/plug-ins/gap/gap_decode_mpeg_main.c b/plug-ins/gap/gap_decode_mpeg_main.c index fb9fda0fed..67af612eff 100644 --- a/plug-ins/gap/gap_decode_mpeg_main.c +++ b/plug-ins/gap/gap_decode_mpeg_main.c @@ -520,7 +520,7 @@ load_image (char *filename, /* ignore frames before first_frame */ if (framenumber >= first_frame ) { - image_ID = gimp_image_new (wwidth, wheight, RGB); + image_ID = gimp_image_new (wwidth, wheight, GIMP_RGB); gimp_image_set_filename (image_ID, framename); if(framenumber == first_frame) diff --git a/plug-ins/perl/Changes b/plug-ins/perl/Changes index 82c4dd33c0..929dad34c2 100644 --- a/plug-ins/perl/Changes +++ b/plug-ins/perl/Changes @@ -16,6 +16,7 @@ Revision history for Gimp-Perl extension. buggy perl version that causes pxgettext to not work! - do yet another compile/link flags rotation. - replaced find -path by grep 'Cause -path seems to be a gnu extension. + - add -DGIMP_ENABLE_COMPAT_CRUFT to build with latest source (Yosh) 1.2 Thu May 11 18:55:13 CEST 2000 - image types updated to reflect gimp's reality. diff --git a/plug-ins/perl/config.pl.in b/plug-ins/perl/config.pl.in index e9cde87305..47b9a3f761 100644 --- a/plug-ins/perl/config.pl.in +++ b/plug-ins/perl/config.pl.in @@ -38,6 +38,7 @@ $^W=0; _EXTENSIVE_TESTS => q[@EXTENSIVE_TESTS@], IN_GIMP => q[@IN_GIMP@], + COMPAT_CRUFT => q[@PERL_COMPAT_CRUFT@], pdl_inc => '', pdl_typemaps => '', diff --git a/plug-ins/perl/configure.frag b/plug-ins/perl/configure.frag index 7f719375fc..2d497ca3ad 100644 --- a/plug-ins/perl/configure.frag +++ b/plug-ins/perl/configure.frag @@ -21,6 +21,7 @@ AC_SUBST(LDFLAGS) AC_SUBST(prefix) AC_SUBST(IN_GIMP) +AC_SUBST(PERL_COMPAT_CRUFT) AC_SUBST(GIMP_CFLAGS) AC_SUBST(GIMP_CFLAGS_NOUI) diff --git a/plug-ins/perl/configure.in b/plug-ins/perl/configure.in index 52a2fdefb6..e30b46d319 100644 --- a/plug-ins/perl/configure.in +++ b/plug-ins/perl/configure.in @@ -47,6 +47,8 @@ if test $gimptool_major_version -lt 2 && test $gimptool_minor_version -lt 1 ; th echo '** released 1.0.x versions of the gimp, many scripts will not, since they' echo '** already use the new API.' echo +else + PERL_COMPAT_CRUFT="-DGIMP_ENABLE_COMPAT_CRUFT" fi