From a5f9b334a0010529226c5c1794665710fb14b354 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Sun, 2 Jan 2000 00:16:47 +0000 Subject: [PATCH] cosmetic fix * Makefile.am: cosmetic fix * libgimp/color_display.h * modules/cdisplay_gamma.c: add clone method * app/color_area.[ch] * app/gdisplay.[ch] * app/gdisplay_color.c * app/gdisplay_color_ui.c: preliminary support for color_area filter (really just a sync to home machine) * app/nav_window.c: minor cleanup * tools/pdbgen/app.pl: initialize gbooleans to FALSE, not 0 * tools/pdbgen/lib.pl: some more arg work -Yosh --- ChangeLog | 19 +++++++++ Makefile.am | 2 +- app/color_area.c | 21 ++++++++++ app/color_area.h | 7 +++- app/core/gimpprojection.c | 37 ++++++++++++++++-- app/core/gimpprojection.h | 9 +++-- app/display/gimpdisplay.c | 37 ++++++++++++++++-- app/display/gimpdisplay.h | 9 +++-- app/display/gimpdisplayshell-filter-dialog.c | 23 ++++++++--- app/display/gimpdisplayshell-filter.c | 4 +- app/display/gimpnavigationeditor.c | 2 +- app/display/gimpnavigationview.c | 2 +- app/gdisplay.c | 37 ++++++++++++++++-- app/gdisplay.h | 9 +++-- app/gdisplay_color.c | 4 +- app/gdisplay_color_ui.c | 23 ++++++++--- app/gimage_cmds.c | 2 +- app/gimage_mask_cmds.c | 2 +- app/gui/color-area.c | 21 ++++++++++ app/gui/color-area.h | 7 +++- app/nav_window.c | 2 +- app/widgets/gimpcolordisplayeditor.c | 23 ++++++++--- app/widgets/gimptoolbox-color-area.c | 21 ++++++++++ app/widgets/gimptoolbox-color-area.h | 7 +++- libgimp/color_display.h | 2 + libgimp/gimpcolordisplay.h | 2 + modules/cdisplay_gamma.c | 16 ++++++++ tools/pdbgen/app.pl | 6 ++- tools/pdbgen/lib.pl | 41 +++++++++----------- tools/pdbgen/pdb/gimage.pdb | 2 +- tools/pdbgen/pdb/image.pdb | 2 +- 31 files changed, 331 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec5e61e071..ca6513c976 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Sat Jan 1 16:10:32 PST 2000 Manish Singh + + * Makefile.am: cosmetic fix + + * libgimp/color_display.h + * modules/cdisplay_gamma.c: add clone method + + * app/color_area.[ch] + * app/gdisplay.[ch] + * app/gdisplay_color.c + * app/gdisplay_color_ui.c: preliminary support for color_area filter + (really just a sync to home machine) + + * app/nav_window.c: minor cleanup + + * tools/pdbgen/app.pl: initialize gbooleans to FALSE, not 0 + + * tools/pdbgen/lib.pl: some more arg work + Sat Jan 1 23:09:02 CET 2000 Marc Lehmann * app/fileops.c: Use strtoul for hex constants, and cast it back, diff --git a/Makefile.am b/Makefile.am index ba0e706b13..eb7f17c4d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -100,7 +100,7 @@ gimpdata_DATA = \ gimpdata_SCRIPTS = user_install -man_MANS=gimp.1 gimptool.1 gimprc.5 +man_MANS = gimp.1 gimptool.1 gimprc.5 m4datadir = $(datadir)/aclocal m4data_DATA = gimp.m4 diff --git a/app/color_area.c b/app/color_area.c index 17066c5591..c29efde496 100644 --- a/app/color_area.c +++ b/app/color_area.c @@ -21,6 +21,8 @@ #include "color_area.h" #include "color_notebook.h" #include "colormaps.h" +#include "gdisplay.h" +#include "gdisplay_color.h" #include "gimpcontext.h" #include "gimpdnd.h" @@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *, /* Global variables */ gint active_color = FOREGROUND; +GDisplay color_area_gdisp; + /* Static variables */ static GdkGC *color_area_gc = NULL; static GtkWidget *color_area = NULL; @@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable, static gint rowstride; gint xx, yy; guchar *bp; + GList *list; rowstride = 3 * ((width + 3) & -4); + if (color_area_rgb_buf == NULL || color_area_rgb_buf_size < height * rowstride) { @@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable, g_free (color_area_rgb_buf); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); } + bp = color_area_rgb_buf; for (xx = 0; xx < width; xx++) { @@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable, *bp++ = g; *bp++ = b; } + bp = color_area_rgb_buf; + + list = color_area_gdisp.cd_list; + while (list) + { + ColorDisplayNode *node = (ColorDisplayNode *) list->data; + node->cd_convert (node->cd_ID, bp, width, 1, 3, rowstride); + list = list->next; + } + for (yy = 1; yy < height; yy++) { bp += rowstride; memcpy (bp, color_area_rgb_buf, rowstride); } + gdk_draw_rgb_image (drawable, gc, x, y, width, height, GDK_RGB_DITHER_MAX, color_area_rgb_buf, @@ -424,6 +442,9 @@ color_area_create (gint width, GTK_SIGNAL_FUNC (color_area_color_changed), color_area); + /* display filter dummy gdisplay */ + color_area_gdisp.cd_list = NULL; + return color_area; } diff --git a/app/color_area.h b/app/color_area.h index 7c1f4fb1fb..3bb4059f99 100644 --- a/app/color_area.h +++ b/app/color_area.h @@ -18,13 +18,18 @@ #ifndef __COLOR_AREA_H__ #define __COLOR_AREA_H__ +#include + +#include "gdisplayF.h" + #define FOREGROUND 0 #define BACKGROUND 1 /* * Global variables */ -extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern GDisplay color_area_gdisp; /* hack for color displays */ /* * Functions diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index c7566bff4b..3c6b47c8d1 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *); static GHashTable *display_ht = NULL; +/* FIXME: ick ick ick, GDisplays really need to be GtkObjects */ +GFunc notify_add_func = NULL; +gpointer notify_add_user_data = NULL; +GFunc notify_remove_func = NULL; +gpointer notify_remove_user_data = NULL; GDisplay* gdisplay_new (GimpImage *gimage, @@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage, /* * Set all GDisplay parameters... */ - gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); + gdisp = g_new (GDisplay, 1); gdisp->offset_x = gdisp->offset_y = 0; gdisp->scale = scale; @@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage, gtk_signal_connect (GTK_OBJECT (gimage), "clean", GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); + if (notify_add_func) + notify_add_func (gdisp, notify_add_user_data); + return gdisp; } @@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp) gtk_widget_unref (gdisp->shell); + if (notify_remove_func) + notify_remove_func (gdisp, notify_remove_user_data); + g_free (gdisp); } @@ -2258,7 +2269,27 @@ static void gdisplay_cleandirty_handler (GimpImage *gimage, void *data) { - GDisplay *gdisp = data; + GDisplay *gdisp = data; - gdisplay_update_title (gdisp); + gdisplay_update_title (gdisp); +} + +void +gdisplays_foreach (GFunc func, gpointer user_data) +{ + g_slist_foreach (display_list, func, user_data); +} + +void +gdisplays_notify_add (GFunc func, gpointer user_data) +{ + notify_add_func = func; + notify_add_user_data = user_data; +} + +void +gdisplays_notify_remove (GFunc func, gpointer user_data) +{ + notify_remove_func = func; + notify_remove_user_data = user_data; } diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index d64d5d02da..4b5e9a5ae2 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -18,6 +18,8 @@ #ifndef __GDISPLAY_H__ #define __GDISPLAY_H__ +#include + #include "gimage.h" #include "info_dialog.h" #include "selection.h" @@ -212,9 +214,10 @@ int gdisplays_dirty (void); void gdisplays_delete (void); void gdisplays_flush (void); void gdisplays_flush_now (void); -void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ +void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ void gdisplays_nav_preview_resized (void); - - +void gdisplays_foreach (GFunc func, gpointer user_data); +void gdisplays_notify_add (GFunc func, gpointer user_data); +void gdisplays_notify_remove (GFunc func, gpointer user_data); #endif /* __GDISPLAY_H__ */ diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index c7566bff4b..3c6b47c8d1 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *); static GHashTable *display_ht = NULL; +/* FIXME: ick ick ick, GDisplays really need to be GtkObjects */ +GFunc notify_add_func = NULL; +gpointer notify_add_user_data = NULL; +GFunc notify_remove_func = NULL; +gpointer notify_remove_user_data = NULL; GDisplay* gdisplay_new (GimpImage *gimage, @@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage, /* * Set all GDisplay parameters... */ - gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); + gdisp = g_new (GDisplay, 1); gdisp->offset_x = gdisp->offset_y = 0; gdisp->scale = scale; @@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage, gtk_signal_connect (GTK_OBJECT (gimage), "clean", GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); + if (notify_add_func) + notify_add_func (gdisp, notify_add_user_data); + return gdisp; } @@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp) gtk_widget_unref (gdisp->shell); + if (notify_remove_func) + notify_remove_func (gdisp, notify_remove_user_data); + g_free (gdisp); } @@ -2258,7 +2269,27 @@ static void gdisplay_cleandirty_handler (GimpImage *gimage, void *data) { - GDisplay *gdisp = data; + GDisplay *gdisp = data; - gdisplay_update_title (gdisp); + gdisplay_update_title (gdisp); +} + +void +gdisplays_foreach (GFunc func, gpointer user_data) +{ + g_slist_foreach (display_list, func, user_data); +} + +void +gdisplays_notify_add (GFunc func, gpointer user_data) +{ + notify_add_func = func; + notify_add_user_data = user_data; +} + +void +gdisplays_notify_remove (GFunc func, gpointer user_data) +{ + notify_remove_func = func; + notify_remove_user_data = user_data; } diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index d64d5d02da..4b5e9a5ae2 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -18,6 +18,8 @@ #ifndef __GDISPLAY_H__ #define __GDISPLAY_H__ +#include + #include "gimage.h" #include "info_dialog.h" #include "selection.h" @@ -212,9 +214,10 @@ int gdisplays_dirty (void); void gdisplays_delete (void); void gdisplays_flush (void); void gdisplays_flush_now (void); -void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ +void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ void gdisplays_nav_preview_resized (void); - - +void gdisplays_foreach (GFunc func, gpointer user_data); +void gdisplays_notify_add (GFunc func, gpointer user_data); +void gdisplays_notify_remove (GFunc func, gpointer user_data); #endif /* __GDISPLAY_H__ */ diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c index b633fce13d..f50d025de6 100644 --- a/app/display/gimpdisplayshell-filter-dialog.c +++ b/app/display/gimpdisplayshell-filter-dialog.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "color_area.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" @@ -33,6 +34,8 @@ struct _ColorDisplayDialog GtkWidget *src; GtkWidget *dest; + GtkWidget *target_menu; + gint src_row; gint dest_row; @@ -164,6 +167,11 @@ make_dialog (void) GTK_SIGNAL_FUNC (select_dest), NULL); + /* + cdd.target_menu = gtk_option_menu_new (); + target_menu = create_target_menu (); + */ + for (i = 0; i < 5; i++) { GtkWidget *button; @@ -179,6 +187,11 @@ make_dialog (void) gtk_widget_show_all (hbox); } +static void +create_target_menu (void) +{ +} + static void color_display_ok_callback (GtkWidget *widget, gpointer data) @@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp) color_display_foreach (src_list_populate, cdd.src); if (gdisp) - { - cdd.old_nodes = gdisp->cd_list; - dest_list_populate (gdisp->cd_list); - gdisp->cd_list = g_list_copy (cdd.old_nodes); - } + gdisp = &color_area_gdisp; + + cdd.old_nodes = gdisp->cd_list; + dest_list_populate (gdisp->cd_list); + gdisp->cd_list = g_list_copy (cdd.old_nodes); cdd.gdisp = gdisp; diff --git a/app/display/gimpdisplayshell-filter.c b/app/display/gimpdisplayshell-filter.c index 485931e7f8..8d29955213 100644 --- a/app/display/gimpdisplayshell-filter.c +++ b/app/display/gimpdisplayshell-filter.c @@ -205,10 +205,12 @@ gdisplay_color_detach_destroy (GDisplay *gdisp, void gdisplay_color_detach_all (GDisplay *gdisp) { - GList *list = gdisp->cd_list; + GList *list; g_return_if_fail (gdisp != NULL); + list = gdisp->cd_list; + while (list) { gdisplay_color_detach_real (gdisp, list->data, TRUE); diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c index c7fe45b3de..ca33e9bf1a 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void) GSList *list=NULL; GSList *listPtr=NULL; GimpImage *gimage ; - GDisplay * gdisp; + GDisplay * gdisp = NULL; gimage_foreach (gimlist_cb, &list); diff --git a/app/display/gimpnavigationview.c b/app/display/gimpnavigationview.c index c7fe45b3de..ca33e9bf1a 100644 --- a/app/display/gimpnavigationview.c +++ b/app/display/gimpnavigationview.c @@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void) GSList *list=NULL; GSList *listPtr=NULL; GimpImage *gimage ; - GDisplay * gdisp; + GDisplay * gdisp = NULL; gimage_foreach (gimlist_cb, &list); diff --git a/app/gdisplay.c b/app/gdisplay.c index c7566bff4b..3c6b47c8d1 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *); static GHashTable *display_ht = NULL; +/* FIXME: ick ick ick, GDisplays really need to be GtkObjects */ +GFunc notify_add_func = NULL; +gpointer notify_add_user_data = NULL; +GFunc notify_remove_func = NULL; +gpointer notify_remove_user_data = NULL; GDisplay* gdisplay_new (GimpImage *gimage, @@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage, /* * Set all GDisplay parameters... */ - gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); + gdisp = g_new (GDisplay, 1); gdisp->offset_x = gdisp->offset_y = 0; gdisp->scale = scale; @@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage, gtk_signal_connect (GTK_OBJECT (gimage), "clean", GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); + if (notify_add_func) + notify_add_func (gdisp, notify_add_user_data); + return gdisp; } @@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp) gtk_widget_unref (gdisp->shell); + if (notify_remove_func) + notify_remove_func (gdisp, notify_remove_user_data); + g_free (gdisp); } @@ -2258,7 +2269,27 @@ static void gdisplay_cleandirty_handler (GimpImage *gimage, void *data) { - GDisplay *gdisp = data; + GDisplay *gdisp = data; - gdisplay_update_title (gdisp); + gdisplay_update_title (gdisp); +} + +void +gdisplays_foreach (GFunc func, gpointer user_data) +{ + g_slist_foreach (display_list, func, user_data); +} + +void +gdisplays_notify_add (GFunc func, gpointer user_data) +{ + notify_add_func = func; + notify_add_user_data = user_data; +} + +void +gdisplays_notify_remove (GFunc func, gpointer user_data) +{ + notify_remove_func = func; + notify_remove_user_data = user_data; } diff --git a/app/gdisplay.h b/app/gdisplay.h index d64d5d02da..4b5e9a5ae2 100644 --- a/app/gdisplay.h +++ b/app/gdisplay.h @@ -18,6 +18,8 @@ #ifndef __GDISPLAY_H__ #define __GDISPLAY_H__ +#include + #include "gimage.h" #include "info_dialog.h" #include "selection.h" @@ -212,9 +214,10 @@ int gdisplays_dirty (void); void gdisplays_delete (void); void gdisplays_flush (void); void gdisplays_flush_now (void); -void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ +void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */ void gdisplays_nav_preview_resized (void); - - +void gdisplays_foreach (GFunc func, gpointer user_data); +void gdisplays_notify_add (GFunc func, gpointer user_data); +void gdisplays_notify_remove (GFunc func, gpointer user_data); #endif /* __GDISPLAY_H__ */ diff --git a/app/gdisplay_color.c b/app/gdisplay_color.c index 485931e7f8..8d29955213 100644 --- a/app/gdisplay_color.c +++ b/app/gdisplay_color.c @@ -205,10 +205,12 @@ gdisplay_color_detach_destroy (GDisplay *gdisp, void gdisplay_color_detach_all (GDisplay *gdisp) { - GList *list = gdisp->cd_list; + GList *list; g_return_if_fail (gdisp != NULL); + list = gdisp->cd_list; + while (list) { gdisplay_color_detach_real (gdisp, list->data, TRUE); diff --git a/app/gdisplay_color_ui.c b/app/gdisplay_color_ui.c index b633fce13d..f50d025de6 100644 --- a/app/gdisplay_color_ui.c +++ b/app/gdisplay_color_ui.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "color_area.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" @@ -33,6 +34,8 @@ struct _ColorDisplayDialog GtkWidget *src; GtkWidget *dest; + GtkWidget *target_menu; + gint src_row; gint dest_row; @@ -164,6 +167,11 @@ make_dialog (void) GTK_SIGNAL_FUNC (select_dest), NULL); + /* + cdd.target_menu = gtk_option_menu_new (); + target_menu = create_target_menu (); + */ + for (i = 0; i < 5; i++) { GtkWidget *button; @@ -179,6 +187,11 @@ make_dialog (void) gtk_widget_show_all (hbox); } +static void +create_target_menu (void) +{ +} + static void color_display_ok_callback (GtkWidget *widget, gpointer data) @@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp) color_display_foreach (src_list_populate, cdd.src); if (gdisp) - { - cdd.old_nodes = gdisp->cd_list; - dest_list_populate (gdisp->cd_list); - gdisp->cd_list = g_list_copy (cdd.old_nodes); - } + gdisp = &color_area_gdisp; + + cdd.old_nodes = gdisp->cd_list; + dest_list_populate (gdisp->cd_list); + gdisp->cd_list = g_list_copy (cdd.old_nodes); cdd.gdisp = gdisp; diff --git a/app/gimage_cmds.c b/app/gimage_cmds.c index 91b12796a2..8bec5de8d6 100644 --- a/app/gimage_cmds.c +++ b/app/gimage_cmds.c @@ -1918,7 +1918,7 @@ image_undo_is_enabled_invoker (Argument *args) gboolean success = TRUE; Argument *return_args; GimpImage *gimage; - gboolean enabled; + gboolean enabled = FALSE; gimage = pdb_id_to_image (args[0].value.pdb_int); if (gimage == NULL) diff --git a/app/gimage_mask_cmds.c b/app/gimage_mask_cmds.c index e19e0e89a5..54bb1cfc1e 100644 --- a/app/gimage_mask_cmds.c +++ b/app/gimage_mask_cmds.c @@ -71,7 +71,7 @@ selection_bounds_invoker (Argument *args) gboolean success = TRUE; Argument *return_args; GimpImage *gimage; - gboolean non_empty = 0; + gboolean non_empty = FALSE; gint32 x1; gint32 y1; gint32 x2; diff --git a/app/gui/color-area.c b/app/gui/color-area.c index 17066c5591..c29efde496 100644 --- a/app/gui/color-area.c +++ b/app/gui/color-area.c @@ -21,6 +21,8 @@ #include "color_area.h" #include "color_notebook.h" #include "colormaps.h" +#include "gdisplay.h" +#include "gdisplay_color.h" #include "gimpcontext.h" #include "gimpdnd.h" @@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *, /* Global variables */ gint active_color = FOREGROUND; +GDisplay color_area_gdisp; + /* Static variables */ static GdkGC *color_area_gc = NULL; static GtkWidget *color_area = NULL; @@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable, static gint rowstride; gint xx, yy; guchar *bp; + GList *list; rowstride = 3 * ((width + 3) & -4); + if (color_area_rgb_buf == NULL || color_area_rgb_buf_size < height * rowstride) { @@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable, g_free (color_area_rgb_buf); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); } + bp = color_area_rgb_buf; for (xx = 0; xx < width; xx++) { @@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable, *bp++ = g; *bp++ = b; } + bp = color_area_rgb_buf; + + list = color_area_gdisp.cd_list; + while (list) + { + ColorDisplayNode *node = (ColorDisplayNode *) list->data; + node->cd_convert (node->cd_ID, bp, width, 1, 3, rowstride); + list = list->next; + } + for (yy = 1; yy < height; yy++) { bp += rowstride; memcpy (bp, color_area_rgb_buf, rowstride); } + gdk_draw_rgb_image (drawable, gc, x, y, width, height, GDK_RGB_DITHER_MAX, color_area_rgb_buf, @@ -424,6 +442,9 @@ color_area_create (gint width, GTK_SIGNAL_FUNC (color_area_color_changed), color_area); + /* display filter dummy gdisplay */ + color_area_gdisp.cd_list = NULL; + return color_area; } diff --git a/app/gui/color-area.h b/app/gui/color-area.h index 7c1f4fb1fb..3bb4059f99 100644 --- a/app/gui/color-area.h +++ b/app/gui/color-area.h @@ -18,13 +18,18 @@ #ifndef __COLOR_AREA_H__ #define __COLOR_AREA_H__ +#include + +#include "gdisplayF.h" + #define FOREGROUND 0 #define BACKGROUND 1 /* * Global variables */ -extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern GDisplay color_area_gdisp; /* hack for color displays */ /* * Functions diff --git a/app/nav_window.c b/app/nav_window.c index c7fe45b3de..ca33e9bf1a 100644 --- a/app/nav_window.c +++ b/app/nav_window.c @@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void) GSList *list=NULL; GSList *listPtr=NULL; GimpImage *gimage ; - GDisplay * gdisp; + GDisplay * gdisp = NULL; gimage_foreach (gimlist_cb, &list); diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c index b633fce13d..f50d025de6 100644 --- a/app/widgets/gimpcolordisplayeditor.c +++ b/app/widgets/gimpcolordisplayeditor.c @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "color_area.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" @@ -33,6 +34,8 @@ struct _ColorDisplayDialog GtkWidget *src; GtkWidget *dest; + GtkWidget *target_menu; + gint src_row; gint dest_row; @@ -164,6 +167,11 @@ make_dialog (void) GTK_SIGNAL_FUNC (select_dest), NULL); + /* + cdd.target_menu = gtk_option_menu_new (); + target_menu = create_target_menu (); + */ + for (i = 0; i < 5; i++) { GtkWidget *button; @@ -179,6 +187,11 @@ make_dialog (void) gtk_widget_show_all (hbox); } +static void +create_target_menu (void) +{ +} + static void color_display_ok_callback (GtkWidget *widget, gpointer data) @@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp) color_display_foreach (src_list_populate, cdd.src); if (gdisp) - { - cdd.old_nodes = gdisp->cd_list; - dest_list_populate (gdisp->cd_list); - gdisp->cd_list = g_list_copy (cdd.old_nodes); - } + gdisp = &color_area_gdisp; + + cdd.old_nodes = gdisp->cd_list; + dest_list_populate (gdisp->cd_list); + gdisp->cd_list = g_list_copy (cdd.old_nodes); cdd.gdisp = gdisp; diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index 17066c5591..c29efde496 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -21,6 +21,8 @@ #include "color_area.h" #include "color_notebook.h" #include "colormaps.h" +#include "gdisplay.h" +#include "gdisplay_color.h" #include "gimpcontext.h" #include "gimpdnd.h" @@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *, /* Global variables */ gint active_color = FOREGROUND; +GDisplay color_area_gdisp; + /* Static variables */ static GdkGC *color_area_gc = NULL; static GtkWidget *color_area = NULL; @@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable, static gint rowstride; gint xx, yy; guchar *bp; + GList *list; rowstride = 3 * ((width + 3) & -4); + if (color_area_rgb_buf == NULL || color_area_rgb_buf_size < height * rowstride) { @@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable, g_free (color_area_rgb_buf); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); } + bp = color_area_rgb_buf; for (xx = 0; xx < width; xx++) { @@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable, *bp++ = g; *bp++ = b; } + bp = color_area_rgb_buf; + + list = color_area_gdisp.cd_list; + while (list) + { + ColorDisplayNode *node = (ColorDisplayNode *) list->data; + node->cd_convert (node->cd_ID, bp, width, 1, 3, rowstride); + list = list->next; + } + for (yy = 1; yy < height; yy++) { bp += rowstride; memcpy (bp, color_area_rgb_buf, rowstride); } + gdk_draw_rgb_image (drawable, gc, x, y, width, height, GDK_RGB_DITHER_MAX, color_area_rgb_buf, @@ -424,6 +442,9 @@ color_area_create (gint width, GTK_SIGNAL_FUNC (color_area_color_changed), color_area); + /* display filter dummy gdisplay */ + color_area_gdisp.cd_list = NULL; + return color_area; } diff --git a/app/widgets/gimptoolbox-color-area.h b/app/widgets/gimptoolbox-color-area.h index 7c1f4fb1fb..3bb4059f99 100644 --- a/app/widgets/gimptoolbox-color-area.h +++ b/app/widgets/gimptoolbox-color-area.h @@ -18,13 +18,18 @@ #ifndef __COLOR_AREA_H__ #define __COLOR_AREA_H__ +#include + +#include "gdisplayF.h" + #define FOREGROUND 0 #define BACKGROUND 1 /* * Global variables */ -extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern gint active_color; /* foreground (= 0) or background (= 1) */ +extern GDisplay color_area_gdisp; /* hack for color displays */ /* * Functions diff --git a/libgimp/color_display.h b/libgimp/color_display.h index cfa22ebc62..fd12c92176 100644 --- a/libgimp/color_display.h +++ b/libgimp/color_display.h @@ -25,6 +25,7 @@ typedef void (*GimpColorDisplayInit) (void); typedef gpointer (*GimpColorDisplayNew) (int type); +typedef gpointer (*GimpColorDisplayClone) (gpointer cd_ID); typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, guchar *buf, int width, @@ -45,6 +46,7 @@ struct _GimpColorDisplayMethods { GimpColorDisplayInit init; GimpColorDisplayNew new; + GimpColorDisplayClone clone; GimpColorDisplayConvert convert; GimpColorDisplayDestroy destroy; GimpColorDisplayFinalize finalize; diff --git a/libgimp/gimpcolordisplay.h b/libgimp/gimpcolordisplay.h index cfa22ebc62..fd12c92176 100644 --- a/libgimp/gimpcolordisplay.h +++ b/libgimp/gimpcolordisplay.h @@ -25,6 +25,7 @@ typedef void (*GimpColorDisplayInit) (void); typedef gpointer (*GimpColorDisplayNew) (int type); +typedef gpointer (*GimpColorDisplayClone) (gpointer cd_ID); typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, guchar *buf, int width, @@ -45,6 +46,7 @@ struct _GimpColorDisplayMethods { GimpColorDisplayInit init; GimpColorDisplayNew new; + GimpColorDisplayClone clone; GimpColorDisplayConvert convert; GimpColorDisplayDestroy destroy; GimpColorDisplayFinalize finalize; diff --git a/modules/cdisplay_gamma.c b/modules/cdisplay_gamma.c index 62d5cc6829..d2b033e845 100644 --- a/modules/cdisplay_gamma.c +++ b/modules/cdisplay_gamma.c @@ -40,6 +40,7 @@ struct _GammaContext }; static gpointer gamma_new (int type); +static gpointer gamma_clone (gpointer cd_ID); static void gamma_create_lookup_table (GammaContext *context); static void gamma_destroy (gpointer cd_ID); static void gamma_convert (gpointer cd_ID, @@ -64,6 +65,7 @@ static void gamma_configure_cancel (gpointer cd_ID); static GimpColorDisplayMethods methods = { NULL, gamma_new, + gamma_clone, gamma_convert, gamma_destroy, NULL, @@ -121,6 +123,20 @@ gamma_new (int type) return context; } +static gpointer +gamma_clone (gpointer cd_ID) +{ + GammaContext *context = NULL; + GammaContext *src_context = (GammaContext *) cd_ID; + + context = gamma_new (0); + context->gamma = src_context->gamma; + + memcpy (context->lookup, src_context->lookup, sizeof(guchar) * 256); + + return context; +} + static void gamma_create_lookup_table (GammaContext *context) { diff --git a/tools/pdbgen/app.pl b/tools/pdbgen/app.pl index 8ace241c9a..61b25d1163 100644 --- a/tools/pdbgen/app.pl +++ b/tools/pdbgen/app.pl @@ -140,7 +140,11 @@ sub declare_args { $result .= ' ' x 2 . $type . &arg_vname($_); if (!exists $_->{no_init} && exists $_->{init}) { - $result .= $arg->{type} =~ /\*$/ ? ' = NULL' : ' = 0' + for ($arg->{type}) { + /\*$/ && do { $result .= ' = NULL'; last }; + /boolean/ && do { $result .= ' = FALSE'; last }; + $result .= ' = 0'; + } } $result .= ";\n"; diff --git a/tools/pdbgen/lib.pl b/tools/pdbgen/lib.pl index 38f03717a7..2c136f58c5 100644 --- a/tools/pdbgen/lib.pl +++ b/tools/pdbgen/lib.pl @@ -33,9 +33,20 @@ sub generate { my %out; sub libtype { - my ($arg, $type) = @_; - $type =~ s/int32/int/ unless exists $arg->{keep_size}; - $type; + my $arg = shift; + my ($type, $name) = &arg_parse($arg->{type}); + my $argtype = $arg_types{$type}; + + return 'gint32 ' if exists $argtype->{id_func}; + + if ($type eq 'enum') { + $name = "Gimp$name" if $name !~ /^Gimp/; + return "$name "; + } + + my $rettype = $argtype->{type}; + $rettype =~ s/int32/int/ unless exists $arg->{keep_size}; + return $rettype; } foreach $name (@procs) { @@ -70,11 +81,7 @@ sub generate { if ($retarg) { my ($type) = &arg_parse($retarg->{type}); if ($type ne 'color') { - my $arg = $arg_types{$type}; - $rettype = do { - if (exists $arg->{id_func}) { 'gint32 ' } - else { &libtype($_, $arg->{type}) } - }; + $rettype = &libtype($retarg); chop $rettype unless $rettype =~ /\*$/; } else { @@ -100,11 +107,7 @@ sub generate { $privatevars++; } elsif ($type ne 'color') { - $arglist .= do { - if ($id) { 'gint32 ' } - else { &libtype($_, $arg->{type}) } - }; - + $arglist .= &libtype($_); $arglist .= $_->{name}; $arglist .= '_ID' if $id; $arglist .= ', '; @@ -164,10 +167,7 @@ CODE } elsif (exists $_->{retval} && $type ne 'color') { $return_args .= "\n" . ' ' x 2; - $return_args .= do { - if ($id) { 'gint32 ' } - else { &libtype($_, $arg->{type}) } - }; + $return_args .= &libtype($_); # The return value variable $var = $_->{name}; @@ -247,12 +247,7 @@ CODE unless (exists $_->{retval}) { $var .= '*'; - - $arglist .= do { - if ($id) { 'gint32 ' } - else { &libtype($_, $arg->{type}) } - }; - + $arglist .= &libtype($_); $arglist .= "*$_->{name}"; $arglist .= '_ID' if $id; $arglist .= ', '; diff --git a/tools/pdbgen/pdb/gimage.pdb b/tools/pdbgen/pdb/gimage.pdb index fd93d5b978..cd12ee2e86 100644 --- a/tools/pdbgen/pdb/gimage.pdb +++ b/tools/pdbgen/pdb/gimage.pdb @@ -835,7 +835,7 @@ HELP @inargs = ( &std_image_arg ); @outargs = ( - { name => 'enabled', type => 'boolean', + { name => 'enabled', type => 'boolean', init => 1, desc => 'True if undo is enabled for this image' } ); diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index fd93d5b978..cd12ee2e86 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -835,7 +835,7 @@ HELP @inargs = ( &std_image_arg ); @outargs = ( - { name => 'enabled', type => 'boolean', + { name => 'enabled', type => 'boolean', init => 1, desc => 'True if undo is enabled for this image' } );