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
This commit is contained in:
Manish Singh 2000-01-02 00:16:47 +00:00
parent 6d2414707c
commit a5f9b334a0
31 changed files with 331 additions and 70 deletions

View File

@ -1,3 +1,22 @@
Sat Jan 1 16:10:32 PST 2000 Manish Singh <yosh@gimp.org>
* 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 <pcg@goof.com> Sat Jan 1 23:09:02 CET 2000 Marc Lehmann <pcg@goof.com>
* app/fileops.c: Use strtoul for hex constants, and cast it back, * app/fileops.c: Use strtoul for hex constants, and cast it back,

View File

@ -100,7 +100,7 @@ gimpdata_DATA = \
gimpdata_SCRIPTS = user_install gimpdata_SCRIPTS = user_install
man_MANS=gimp.1 gimptool.1 gimprc.5 man_MANS = gimp.1 gimptool.1 gimprc.5
m4datadir = $(datadir)/aclocal m4datadir = $(datadir)/aclocal
m4data_DATA = gimp.m4 m4data_DATA = gimp.m4

View File

@ -21,6 +21,8 @@
#include "color_area.h" #include "color_area.h"
#include "color_notebook.h" #include "color_notebook.h"
#include "colormaps.h" #include "colormaps.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdnd.h" #include "gimpdnd.h"
@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *,
/* Global variables */ /* Global variables */
gint active_color = FOREGROUND; gint active_color = FOREGROUND;
GDisplay color_area_gdisp;
/* Static variables */ /* Static variables */
static GdkGC *color_area_gc = NULL; static GdkGC *color_area_gc = NULL;
static GtkWidget *color_area = NULL; static GtkWidget *color_area = NULL;
@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable,
static gint rowstride; static gint rowstride;
gint xx, yy; gint xx, yy;
guchar *bp; guchar *bp;
GList *list;
rowstride = 3 * ((width + 3) & -4); rowstride = 3 * ((width + 3) & -4);
if (color_area_rgb_buf == NULL || if (color_area_rgb_buf == NULL ||
color_area_rgb_buf_size < height * rowstride) color_area_rgb_buf_size < height * rowstride)
{ {
@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable,
g_free (color_area_rgb_buf); g_free (color_area_rgb_buf);
color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height);
} }
bp = color_area_rgb_buf; bp = color_area_rgb_buf;
for (xx = 0; xx < width; xx++) for (xx = 0; xx < width; xx++)
{ {
@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable,
*bp++ = g; *bp++ = g;
*bp++ = b; *bp++ = b;
} }
bp = color_area_rgb_buf; 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++) for (yy = 1; yy < height; yy++)
{ {
bp += rowstride; bp += rowstride;
memcpy (bp, color_area_rgb_buf, rowstride); memcpy (bp, color_area_rgb_buf, rowstride);
} }
gdk_draw_rgb_image (drawable, gc, x, y, width, height, gdk_draw_rgb_image (drawable, gc, x, y, width, height,
GDK_RGB_DITHER_MAX, GDK_RGB_DITHER_MAX,
color_area_rgb_buf, color_area_rgb_buf,
@ -424,6 +442,9 @@ color_area_create (gint width,
GTK_SIGNAL_FUNC (color_area_color_changed), GTK_SIGNAL_FUNC (color_area_color_changed),
color_area); color_area);
/* display filter dummy gdisplay */
color_area_gdisp.cd_list = NULL;
return color_area; return color_area;
} }

View File

@ -18,13 +18,18 @@
#ifndef __COLOR_AREA_H__ #ifndef __COLOR_AREA_H__
#define __COLOR_AREA_H__ #define __COLOR_AREA_H__
#include <gtk/gtk.h>
#include "gdisplayF.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
/* /*
* Global variables * 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 * Functions

View File

@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *);
static GHashTable *display_ht = NULL; 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*
gdisplay_new (GimpImage *gimage, gdisplay_new (GimpImage *gimage,
@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
/* /*
* Set all GDisplay parameters... * Set all GDisplay parameters...
*/ */
gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); gdisp = g_new (GDisplay, 1);
gdisp->offset_x = gdisp->offset_y = 0; gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale; gdisp->scale = scale;
@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage,
gtk_signal_connect (GTK_OBJECT (gimage), "clean", gtk_signal_connect (GTK_OBJECT (gimage), "clean",
GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp);
if (notify_add_func)
notify_add_func (gdisp, notify_add_user_data);
return gdisp; return gdisp;
} }
@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp)
gtk_widget_unref (gdisp->shell); gtk_widget_unref (gdisp->shell);
if (notify_remove_func)
notify_remove_func (gdisp, notify_remove_user_data);
g_free (gdisp); g_free (gdisp);
} }
@ -2258,7 +2269,27 @@ static void
gdisplay_cleandirty_handler (GimpImage *gimage, gdisplay_cleandirty_handler (GimpImage *gimage,
void *data) 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;
} }

View File

@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__ #ifndef __GDISPLAY_H__
#define __GDISPLAY_H__ #define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "selection.h" #include "selection.h"
@ -212,9 +214,10 @@ int gdisplays_dirty (void);
void gdisplays_delete (void); void gdisplays_delete (void);
void gdisplays_flush (void); void gdisplays_flush (void);
void gdisplays_flush_now (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_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__ */ #endif /* __GDISPLAY_H__ */

View File

@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *);
static GHashTable *display_ht = NULL; 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*
gdisplay_new (GimpImage *gimage, gdisplay_new (GimpImage *gimage,
@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
/* /*
* Set all GDisplay parameters... * Set all GDisplay parameters...
*/ */
gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); gdisp = g_new (GDisplay, 1);
gdisp->offset_x = gdisp->offset_y = 0; gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale; gdisp->scale = scale;
@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage,
gtk_signal_connect (GTK_OBJECT (gimage), "clean", gtk_signal_connect (GTK_OBJECT (gimage), "clean",
GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp);
if (notify_add_func)
notify_add_func (gdisp, notify_add_user_data);
return gdisp; return gdisp;
} }
@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp)
gtk_widget_unref (gdisp->shell); gtk_widget_unref (gdisp->shell);
if (notify_remove_func)
notify_remove_func (gdisp, notify_remove_user_data);
g_free (gdisp); g_free (gdisp);
} }
@ -2258,7 +2269,27 @@ static void
gdisplay_cleandirty_handler (GimpImage *gimage, gdisplay_cleandirty_handler (GimpImage *gimage,
void *data) 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;
} }

View File

@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__ #ifndef __GDISPLAY_H__
#define __GDISPLAY_H__ #define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "selection.h" #include "selection.h"
@ -212,9 +214,10 @@ int gdisplays_dirty (void);
void gdisplays_delete (void); void gdisplays_delete (void);
void gdisplays_flush (void); void gdisplays_flush (void);
void gdisplays_flush_now (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_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__ */ #endif /* __GDISPLAY_H__ */

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "color_area.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_color.h" #include "gdisplay_color.h"
#include "gdisplay_color_ui.h" #include "gdisplay_color_ui.h"
@ -33,6 +34,8 @@ struct _ColorDisplayDialog
GtkWidget *src; GtkWidget *src;
GtkWidget *dest; GtkWidget *dest;
GtkWidget *target_menu;
gint src_row; gint src_row;
gint dest_row; gint dest_row;
@ -164,6 +167,11 @@ make_dialog (void)
GTK_SIGNAL_FUNC (select_dest), GTK_SIGNAL_FUNC (select_dest),
NULL); NULL);
/*
cdd.target_menu = gtk_option_menu_new ();
target_menu = create_target_menu ();
*/
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
GtkWidget *button; GtkWidget *button;
@ -179,6 +187,11 @@ make_dialog (void)
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
} }
static void
create_target_menu (void)
{
}
static void static void
color_display_ok_callback (GtkWidget *widget, color_display_ok_callback (GtkWidget *widget,
gpointer data) gpointer data)
@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp)
color_display_foreach (src_list_populate, cdd.src); color_display_foreach (src_list_populate, cdd.src);
if (gdisp) if (gdisp)
{ gdisp = &color_area_gdisp;
cdd.old_nodes = gdisp->cd_list;
dest_list_populate (gdisp->cd_list); cdd.old_nodes = gdisp->cd_list;
gdisp->cd_list = g_list_copy (cdd.old_nodes); dest_list_populate (gdisp->cd_list);
} gdisp->cd_list = g_list_copy (cdd.old_nodes);
cdd.gdisp = gdisp; cdd.gdisp = gdisp;

View File

@ -205,10 +205,12 @@ gdisplay_color_detach_destroy (GDisplay *gdisp,
void void
gdisplay_color_detach_all (GDisplay *gdisp) gdisplay_color_detach_all (GDisplay *gdisp)
{ {
GList *list = gdisp->cd_list; GList *list;
g_return_if_fail (gdisp != NULL); g_return_if_fail (gdisp != NULL);
list = gdisp->cd_list;
while (list) while (list)
{ {
gdisplay_color_detach_real (gdisp, list->data, TRUE); gdisplay_color_detach_real (gdisp, list->data, TRUE);

View File

@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void)
GSList *list=NULL; GSList *list=NULL;
GSList *listPtr=NULL; GSList *listPtr=NULL;
GimpImage *gimage ; GimpImage *gimage ;
GDisplay * gdisp; GDisplay * gdisp = NULL;
gimage_foreach (gimlist_cb, &list); gimage_foreach (gimlist_cb, &list);

View File

@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void)
GSList *list=NULL; GSList *list=NULL;
GSList *listPtr=NULL; GSList *listPtr=NULL;
GimpImage *gimage ; GimpImage *gimage ;
GDisplay * gdisp; GDisplay * gdisp = NULL;
gimage_foreach (gimlist_cb, &list); gimage_foreach (gimlist_cb, &list);

View File

@ -80,6 +80,11 @@ static void gdisplay_cleandirty_handler (GimpImage *, void *);
static GHashTable *display_ht = NULL; 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*
gdisplay_new (GimpImage *gimage, gdisplay_new (GimpImage *gimage,
@ -95,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
/* /*
* Set all GDisplay parameters... * Set all GDisplay parameters...
*/ */
gdisp = (GDisplay *) g_malloc (sizeof (GDisplay)); gdisp = g_new (GDisplay, 1);
gdisp->offset_x = gdisp->offset_y = 0; gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale; gdisp->scale = scale;
@ -171,6 +176,9 @@ gdisplay_new (GimpImage *gimage,
gtk_signal_connect (GTK_OBJECT (gimage), "clean", gtk_signal_connect (GTK_OBJECT (gimage), "clean",
GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp); GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp);
if (notify_add_func)
notify_add_func (gdisp, notify_add_user_data);
return gdisp; return gdisp;
} }
@ -371,6 +379,9 @@ gdisplay_delete (GDisplay *gdisp)
gtk_widget_unref (gdisp->shell); gtk_widget_unref (gdisp->shell);
if (notify_remove_func)
notify_remove_func (gdisp, notify_remove_user_data);
g_free (gdisp); g_free (gdisp);
} }
@ -2258,7 +2269,27 @@ static void
gdisplay_cleandirty_handler (GimpImage *gimage, gdisplay_cleandirty_handler (GimpImage *gimage,
void *data) 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;
} }

View File

@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__ #ifndef __GDISPLAY_H__
#define __GDISPLAY_H__ #define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "selection.h" #include "selection.h"
@ -212,9 +214,10 @@ int gdisplays_dirty (void);
void gdisplays_delete (void); void gdisplays_delete (void);
void gdisplays_flush (void); void gdisplays_flush (void);
void gdisplays_flush_now (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_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__ */ #endif /* __GDISPLAY_H__ */

View File

@ -205,10 +205,12 @@ gdisplay_color_detach_destroy (GDisplay *gdisp,
void void
gdisplay_color_detach_all (GDisplay *gdisp) gdisplay_color_detach_all (GDisplay *gdisp)
{ {
GList *list = gdisp->cd_list; GList *list;
g_return_if_fail (gdisp != NULL); g_return_if_fail (gdisp != NULL);
list = gdisp->cd_list;
while (list) while (list)
{ {
gdisplay_color_detach_real (gdisp, list->data, TRUE); gdisplay_color_detach_real (gdisp, list->data, TRUE);

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "color_area.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_color.h" #include "gdisplay_color.h"
#include "gdisplay_color_ui.h" #include "gdisplay_color_ui.h"
@ -33,6 +34,8 @@ struct _ColorDisplayDialog
GtkWidget *src; GtkWidget *src;
GtkWidget *dest; GtkWidget *dest;
GtkWidget *target_menu;
gint src_row; gint src_row;
gint dest_row; gint dest_row;
@ -164,6 +167,11 @@ make_dialog (void)
GTK_SIGNAL_FUNC (select_dest), GTK_SIGNAL_FUNC (select_dest),
NULL); NULL);
/*
cdd.target_menu = gtk_option_menu_new ();
target_menu = create_target_menu ();
*/
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
GtkWidget *button; GtkWidget *button;
@ -179,6 +187,11 @@ make_dialog (void)
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
} }
static void
create_target_menu (void)
{
}
static void static void
color_display_ok_callback (GtkWidget *widget, color_display_ok_callback (GtkWidget *widget,
gpointer data) gpointer data)
@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp)
color_display_foreach (src_list_populate, cdd.src); color_display_foreach (src_list_populate, cdd.src);
if (gdisp) if (gdisp)
{ gdisp = &color_area_gdisp;
cdd.old_nodes = gdisp->cd_list;
dest_list_populate (gdisp->cd_list); cdd.old_nodes = gdisp->cd_list;
gdisp->cd_list = g_list_copy (cdd.old_nodes); dest_list_populate (gdisp->cd_list);
} gdisp->cd_list = g_list_copy (cdd.old_nodes);
cdd.gdisp = gdisp; cdd.gdisp = gdisp;

View File

@ -1918,7 +1918,7 @@ image_undo_is_enabled_invoker (Argument *args)
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage;
gboolean enabled; gboolean enabled = FALSE;
gimage = pdb_id_to_image (args[0].value.pdb_int); gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL) if (gimage == NULL)

View File

@ -71,7 +71,7 @@ selection_bounds_invoker (Argument *args)
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage;
gboolean non_empty = 0; gboolean non_empty = FALSE;
gint32 x1; gint32 x1;
gint32 y1; gint32 y1;
gint32 x2; gint32 x2;

View File

@ -21,6 +21,8 @@
#include "color_area.h" #include "color_area.h"
#include "color_notebook.h" #include "color_notebook.h"
#include "colormaps.h" #include "colormaps.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdnd.h" #include "gimpdnd.h"
@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *,
/* Global variables */ /* Global variables */
gint active_color = FOREGROUND; gint active_color = FOREGROUND;
GDisplay color_area_gdisp;
/* Static variables */ /* Static variables */
static GdkGC *color_area_gc = NULL; static GdkGC *color_area_gc = NULL;
static GtkWidget *color_area = NULL; static GtkWidget *color_area = NULL;
@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable,
static gint rowstride; static gint rowstride;
gint xx, yy; gint xx, yy;
guchar *bp; guchar *bp;
GList *list;
rowstride = 3 * ((width + 3) & -4); rowstride = 3 * ((width + 3) & -4);
if (color_area_rgb_buf == NULL || if (color_area_rgb_buf == NULL ||
color_area_rgb_buf_size < height * rowstride) color_area_rgb_buf_size < height * rowstride)
{ {
@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable,
g_free (color_area_rgb_buf); g_free (color_area_rgb_buf);
color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height);
} }
bp = color_area_rgb_buf; bp = color_area_rgb_buf;
for (xx = 0; xx < width; xx++) for (xx = 0; xx < width; xx++)
{ {
@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable,
*bp++ = g; *bp++ = g;
*bp++ = b; *bp++ = b;
} }
bp = color_area_rgb_buf; 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++) for (yy = 1; yy < height; yy++)
{ {
bp += rowstride; bp += rowstride;
memcpy (bp, color_area_rgb_buf, rowstride); memcpy (bp, color_area_rgb_buf, rowstride);
} }
gdk_draw_rgb_image (drawable, gc, x, y, width, height, gdk_draw_rgb_image (drawable, gc, x, y, width, height,
GDK_RGB_DITHER_MAX, GDK_RGB_DITHER_MAX,
color_area_rgb_buf, color_area_rgb_buf,
@ -424,6 +442,9 @@ color_area_create (gint width,
GTK_SIGNAL_FUNC (color_area_color_changed), GTK_SIGNAL_FUNC (color_area_color_changed),
color_area); color_area);
/* display filter dummy gdisplay */
color_area_gdisp.cd_list = NULL;
return color_area; return color_area;
} }

View File

@ -18,13 +18,18 @@
#ifndef __COLOR_AREA_H__ #ifndef __COLOR_AREA_H__
#define __COLOR_AREA_H__ #define __COLOR_AREA_H__
#include <gtk/gtk.h>
#include "gdisplayF.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
/* /*
* Global variables * 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 * Functions

View File

@ -1490,7 +1490,7 @@ nav_window_get_gdisp (void)
GSList *list=NULL; GSList *list=NULL;
GSList *listPtr=NULL; GSList *listPtr=NULL;
GimpImage *gimage ; GimpImage *gimage ;
GDisplay * gdisp; GDisplay * gdisp = NULL;
gimage_foreach (gimlist_cb, &list); gimage_foreach (gimlist_cb, &list);

View File

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "color_area.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_color.h" #include "gdisplay_color.h"
#include "gdisplay_color_ui.h" #include "gdisplay_color_ui.h"
@ -33,6 +34,8 @@ struct _ColorDisplayDialog
GtkWidget *src; GtkWidget *src;
GtkWidget *dest; GtkWidget *dest;
GtkWidget *target_menu;
gint src_row; gint src_row;
gint dest_row; gint dest_row;
@ -164,6 +167,11 @@ make_dialog (void)
GTK_SIGNAL_FUNC (select_dest), GTK_SIGNAL_FUNC (select_dest),
NULL); NULL);
/*
cdd.target_menu = gtk_option_menu_new ();
target_menu = create_target_menu ();
*/
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
GtkWidget *button; GtkWidget *button;
@ -179,6 +187,11 @@ make_dialog (void)
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
} }
static void
create_target_menu (void)
{
}
static void static void
color_display_ok_callback (GtkWidget *widget, color_display_ok_callback (GtkWidget *widget,
gpointer data) gpointer data)
@ -346,11 +359,11 @@ gdisplay_color_ui (GDisplay *gdisp)
color_display_foreach (src_list_populate, cdd.src); color_display_foreach (src_list_populate, cdd.src);
if (gdisp) if (gdisp)
{ gdisp = &color_area_gdisp;
cdd.old_nodes = gdisp->cd_list;
dest_list_populate (gdisp->cd_list); cdd.old_nodes = gdisp->cd_list;
gdisp->cd_list = g_list_copy (cdd.old_nodes); dest_list_populate (gdisp->cd_list);
} gdisp->cd_list = g_list_copy (cdd.old_nodes);
cdd.gdisp = gdisp; cdd.gdisp = gdisp;

View File

@ -21,6 +21,8 @@
#include "color_area.h" #include "color_area.h"
#include "color_notebook.h" #include "color_notebook.h"
#include "colormaps.h" #include "colormaps.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdnd.h" #include "gimpdnd.h"
@ -44,6 +46,8 @@ static void color_area_color_changed (GimpContext *,
/* Global variables */ /* Global variables */
gint active_color = FOREGROUND; gint active_color = FOREGROUND;
GDisplay color_area_gdisp;
/* Static variables */ /* Static variables */
static GdkGC *color_area_gc = NULL; static GdkGC *color_area_gc = NULL;
static GtkWidget *color_area = NULL; static GtkWidget *color_area = NULL;
@ -110,8 +114,10 @@ color_area_draw_rect (GdkDrawable *drawable,
static gint rowstride; static gint rowstride;
gint xx, yy; gint xx, yy;
guchar *bp; guchar *bp;
GList *list;
rowstride = 3 * ((width + 3) & -4); rowstride = 3 * ((width + 3) & -4);
if (color_area_rgb_buf == NULL || if (color_area_rgb_buf == NULL ||
color_area_rgb_buf_size < height * rowstride) color_area_rgb_buf_size < height * rowstride)
{ {
@ -119,6 +125,7 @@ color_area_draw_rect (GdkDrawable *drawable,
g_free (color_area_rgb_buf); g_free (color_area_rgb_buf);
color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height); color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height);
} }
bp = color_area_rgb_buf; bp = color_area_rgb_buf;
for (xx = 0; xx < width; xx++) for (xx = 0; xx < width; xx++)
{ {
@ -126,12 +133,23 @@ color_area_draw_rect (GdkDrawable *drawable,
*bp++ = g; *bp++ = g;
*bp++ = b; *bp++ = b;
} }
bp = color_area_rgb_buf; 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++) for (yy = 1; yy < height; yy++)
{ {
bp += rowstride; bp += rowstride;
memcpy (bp, color_area_rgb_buf, rowstride); memcpy (bp, color_area_rgb_buf, rowstride);
} }
gdk_draw_rgb_image (drawable, gc, x, y, width, height, gdk_draw_rgb_image (drawable, gc, x, y, width, height,
GDK_RGB_DITHER_MAX, GDK_RGB_DITHER_MAX,
color_area_rgb_buf, color_area_rgb_buf,
@ -424,6 +442,9 @@ color_area_create (gint width,
GTK_SIGNAL_FUNC (color_area_color_changed), GTK_SIGNAL_FUNC (color_area_color_changed),
color_area); color_area);
/* display filter dummy gdisplay */
color_area_gdisp.cd_list = NULL;
return color_area; return color_area;
} }

View File

@ -18,13 +18,18 @@
#ifndef __COLOR_AREA_H__ #ifndef __COLOR_AREA_H__
#define __COLOR_AREA_H__ #define __COLOR_AREA_H__
#include <gtk/gtk.h>
#include "gdisplayF.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
/* /*
* Global variables * 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 * Functions

View File

@ -25,6 +25,7 @@
typedef void (*GimpColorDisplayInit) (void); typedef void (*GimpColorDisplayInit) (void);
typedef gpointer (*GimpColorDisplayNew) (int type); typedef gpointer (*GimpColorDisplayNew) (int type);
typedef gpointer (*GimpColorDisplayClone) (gpointer cd_ID);
typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, typedef void (*GimpColorDisplayConvert) (gpointer cd_ID,
guchar *buf, guchar *buf,
int width, int width,
@ -45,6 +46,7 @@ struct _GimpColorDisplayMethods
{ {
GimpColorDisplayInit init; GimpColorDisplayInit init;
GimpColorDisplayNew new; GimpColorDisplayNew new;
GimpColorDisplayClone clone;
GimpColorDisplayConvert convert; GimpColorDisplayConvert convert;
GimpColorDisplayDestroy destroy; GimpColorDisplayDestroy destroy;
GimpColorDisplayFinalize finalize; GimpColorDisplayFinalize finalize;

View File

@ -25,6 +25,7 @@
typedef void (*GimpColorDisplayInit) (void); typedef void (*GimpColorDisplayInit) (void);
typedef gpointer (*GimpColorDisplayNew) (int type); typedef gpointer (*GimpColorDisplayNew) (int type);
typedef gpointer (*GimpColorDisplayClone) (gpointer cd_ID);
typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, typedef void (*GimpColorDisplayConvert) (gpointer cd_ID,
guchar *buf, guchar *buf,
int width, int width,
@ -45,6 +46,7 @@ struct _GimpColorDisplayMethods
{ {
GimpColorDisplayInit init; GimpColorDisplayInit init;
GimpColorDisplayNew new; GimpColorDisplayNew new;
GimpColorDisplayClone clone;
GimpColorDisplayConvert convert; GimpColorDisplayConvert convert;
GimpColorDisplayDestroy destroy; GimpColorDisplayDestroy destroy;
GimpColorDisplayFinalize finalize; GimpColorDisplayFinalize finalize;

View File

@ -40,6 +40,7 @@ struct _GammaContext
}; };
static gpointer gamma_new (int type); static gpointer gamma_new (int type);
static gpointer gamma_clone (gpointer cd_ID);
static void gamma_create_lookup_table (GammaContext *context); static void gamma_create_lookup_table (GammaContext *context);
static void gamma_destroy (gpointer cd_ID); static void gamma_destroy (gpointer cd_ID);
static void gamma_convert (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 = { static GimpColorDisplayMethods methods = {
NULL, NULL,
gamma_new, gamma_new,
gamma_clone,
gamma_convert, gamma_convert,
gamma_destroy, gamma_destroy,
NULL, NULL,
@ -121,6 +123,20 @@ gamma_new (int type)
return context; 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 static void
gamma_create_lookup_table (GammaContext *context) gamma_create_lookup_table (GammaContext *context)
{ {

View File

@ -140,7 +140,11 @@ sub declare_args {
$result .= ' ' x 2 . $type . &arg_vname($_); $result .= ' ' x 2 . $type . &arg_vname($_);
if (!exists $_->{no_init} && exists $_->{init}) { 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"; $result .= ";\n";

View File

@ -33,9 +33,20 @@ sub generate {
my %out; my %out;
sub libtype { sub libtype {
my ($arg, $type) = @_; my $arg = shift;
$type =~ s/int32/int/ unless exists $arg->{keep_size}; my ($type, $name) = &arg_parse($arg->{type});
$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) { foreach $name (@procs) {
@ -70,11 +81,7 @@ sub generate {
if ($retarg) { if ($retarg) {
my ($type) = &arg_parse($retarg->{type}); my ($type) = &arg_parse($retarg->{type});
if ($type ne 'color') { if ($type ne 'color') {
my $arg = $arg_types{$type}; $rettype = &libtype($retarg);
$rettype = do {
if (exists $arg->{id_func}) { 'gint32 ' }
else { &libtype($_, $arg->{type}) }
};
chop $rettype unless $rettype =~ /\*$/; chop $rettype unless $rettype =~ /\*$/;
} }
else { else {
@ -100,11 +107,7 @@ sub generate {
$privatevars++; $privatevars++;
} }
elsif ($type ne 'color') { elsif ($type ne 'color') {
$arglist .= do { $arglist .= &libtype($_);
if ($id) { 'gint32 ' }
else { &libtype($_, $arg->{type}) }
};
$arglist .= $_->{name}; $arglist .= $_->{name};
$arglist .= '_ID' if $id; $arglist .= '_ID' if $id;
$arglist .= ', '; $arglist .= ', ';
@ -164,10 +167,7 @@ CODE
} }
elsif (exists $_->{retval} && $type ne 'color') { elsif (exists $_->{retval} && $type ne 'color') {
$return_args .= "\n" . ' ' x 2; $return_args .= "\n" . ' ' x 2;
$return_args .= do { $return_args .= &libtype($_);
if ($id) { 'gint32 ' }
else { &libtype($_, $arg->{type}) }
};
# The return value variable # The return value variable
$var = $_->{name}; $var = $_->{name};
@ -247,12 +247,7 @@ CODE
unless (exists $_->{retval}) { unless (exists $_->{retval}) {
$var .= '*'; $var .= '*';
$arglist .= &libtype($_);
$arglist .= do {
if ($id) { 'gint32 ' }
else { &libtype($_, $arg->{type}) }
};
$arglist .= "*$_->{name}"; $arglist .= "*$_->{name}";
$arglist .= '_ID' if $id; $arglist .= '_ID' if $id;
$arglist .= ', '; $arglist .= ', ';

View File

@ -835,7 +835,7 @@ HELP
@inargs = ( &std_image_arg ); @inargs = ( &std_image_arg );
@outargs = ( @outargs = (
{ name => 'enabled', type => 'boolean', { name => 'enabled', type => 'boolean', init => 1,
desc => 'True if undo is enabled for this image' } desc => 'True if undo is enabled for this image' }
); );

View File

@ -835,7 +835,7 @@ HELP
@inargs = ( &std_image_arg ); @inargs = ( &std_image_arg );
@outargs = ( @outargs = (
{ name => 'enabled', type => 'boolean', { name => 'enabled', type => 'boolean', init => 1,
desc => 'True if undo is enabled for this image' } desc => 'True if undo is enabled for this image' }
); );