Commit a5f9b334 authored by Manish Singh's avatar Manish Singh

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
parent 6d241470
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>
* app/fileops.c: Use strtoul for hex constants, and cast it back,
......
......@@ -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
......
......@@ -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;
}
......
......@@ -18,6 +18,10 @@
#ifndef __COLOR_AREA_H__
#define __COLOR_AREA_H__
#include <gtk/gtk.h>
#include "gdisplayF.h"
#define FOREGROUND 0
#define BACKGROUND 1
......@@ -25,6 +29,7 @@
* Global variables
*/
extern gint active_color; /* foreground (= 0) or background (= 1) */
extern GDisplay color_area_gdisp; /* hack for color displays */
/*
* Functions
......
......@@ -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);
}
......@@ -2262,3 +2273,23 @@ gdisplay_cleandirty_handler (GimpImage *gimage,
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;
}
......@@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h"
#include "info_dialog.h"
#include "selection.h"
......@@ -214,7 +216,8 @@ void gdisplays_flush (void);
void gdisplays_flush_now (void);
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__ */
......@@ -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);
}
......@@ -2262,3 +2273,23 @@ gdisplay_cleandirty_handler (GimpImage *gimage,
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;
}
......@@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h"
#include "info_dialog.h"
#include "selection.h"
......@@ -214,7 +216,8 @@ void gdisplays_flush (void);
void gdisplays_flush_now (void);
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__ */
......@@ -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)
{
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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......@@ -2262,3 +2273,23 @@ gdisplay_cleandirty_handler (GimpImage *gimage,
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;
}
......@@ -18,6 +18,8 @@
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__
#include <glib.h>
#include "gimage.h"
#include "info_dialog.h"
#include "selection.h"
......@@ -214,7 +216,8 @@ void gdisplays_flush (void);
void gdisplays_flush_now (void);
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__ */
......@@ -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);
......
......@@ -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)
{
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;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -18,6 +18,10 @@
#ifndef __COLOR_AREA_H__
#define __COLOR_AREA_H__
#include <gtk/gtk.h>
#include "gdisplayF.h"
#define FOREGROUND 0
#define BACKGROUND 1
......@@ -25,6 +29,7 @@
* Global variables
*/
extern gint active_color; /* foreground (= 0) or background (= 1) */
extern GDisplay color_area_gdisp; /* hack for color displays */
/*
* Functions
......
......@@ -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);
......
......@@ -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)
{
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;
......
......@@ -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