Commit bc28e6fa authored by Manish Singh's avatar Manish Singh
Browse files

fill dummy gimage->base_type as well

* app/color_area.[ch]: fill dummy gimage->base_type as well

* app/gdisplay_color.[ch]: add attach_clone, configure, and configure_cancel
functions.

* app/gdisplay.[ch]: remove notify hacks, don't need them anymore. Add cd_ui
field for cdisplay ui.

* app/commands.c: make display filter dialog per display instead of global

* libgimp/color_display.h: ok/cancel notification callbacks

* modules/cdisplay_gamma.c
* app/gdisplay_color_ui.[ch]: changes for above, enabled configuration dialog
and color_area dummy handling

* app/color_balance.c
* app/paint_funcs.c: #include "libgimp/gimpcolorspace.h"

* plug-ins/webbrowser/web-browser.scm: updated urls

-Yosh
parent 3fc4eb84
Sun Jan 2 23:29:05 PST 2000 Manish Singh <yosh@gimp.org>
* app/color_area.[ch]: fill dummy gimage->base_type as well
* app/gdisplay_color.[ch]: add attach_clone, configure, and
configure_cancel functions.
* app/gdisplay.[ch]: remove notify hacks, don't need them anymore.
Add cd_ui field for cdisplay ui.
* app/commands.c: make display filter dialog per display instead of
global
* libgimp/color_display.h: ok/cancel notification callbacks
* modules/cdisplay_gamma.c
* app/gdisplay_color_ui.[ch]: changes for above, enabled configuration
dialog and color_area dummy handling
* app/color_balance.c
* app/paint_funcs.c: #include "libgimp/gimpcolorspace.h"
* plug-ins/webbrowser/web-browser.scm: updated urls
Mon Jan 3 02:49:37 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/gimpcolorspace.c
......
......@@ -1212,7 +1212,19 @@ void
dialogs_display_filters_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gdisplay_color_ui (gdisplay_active ());
GDisplay * gdisp;
gdisp = gdisplay_active ();
if (!gdisp)
gdisp = color_area_gdisp;
if (!gdisp->cd_ui)
gdisplay_color_ui_new (gdisp);
if (!GTK_WIDGET_VISIBLE (gdisp->cd_ui))
gtk_widget_show (gdisp->cd_ui);
else
gdk_window_raise (gdisp->cd_ui->window);
}
void
......
......@@ -25,6 +25,7 @@
#include "gdisplay_color.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimpimageP.h"
typedef enum
{
......@@ -46,7 +47,7 @@ static void color_area_color_changed (GimpContext *,
/* Global variables */
gint active_color = FOREGROUND;
GDisplay color_area_gdisp;
GDisplay *color_area_gdisp = NULL;
/* Static variables */
static GdkGC *color_area_gc = NULL;
......@@ -136,7 +137,7 @@ color_area_draw_rect (GdkDrawable *drawable,
bp = color_area_rgb_buf;
list = color_area_gdisp.cd_list;
list = color_area_gdisp->cd_list;
while (list)
{
ColorDisplayNode *node = (ColorDisplayNode *) list->data;
......@@ -443,7 +444,11 @@ color_area_create (gint width,
color_area);
/* display filter dummy gdisplay */
color_area_gdisp.cd_list = NULL;
color_area_gdisp = g_new (GDisplay, 1);
color_area_gdisp->cd_list = NULL;
color_area_gdisp->cd_ui = NULL;
color_area_gdisp->gimage = g_new (GimpImage, 1);
color_area_gdisp->gimage->base_type = RGB;
return color_area;
}
......
......@@ -28,8 +28,8 @@
/*
* Global variables
*/
extern gint active_color; /* foreground (= 0) or background (= 1) */
extern GDisplay color_area_gdisp; /* hack for color displays */
extern gint active_color; /* foreground (= 0) or background (= 1) */
extern GDisplay *color_area_gdisp; /* hack for color displays */
/*
* Functions
......
......@@ -1212,7 +1212,19 @@ void
dialogs_display_filters_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gdisplay_color_ui (gdisplay_active ());
GDisplay * gdisp;
gdisp = gdisplay_active ();
if (!gdisp)
gdisp = color_area_gdisp;
if (!gdisp->cd_ui)
gdisplay_color_ui_new (gdisp);
if (!GTK_WIDGET_VISIBLE (gdisp->cd_ui))
gtk_widget_show (gdisp->cd_ui);
else
gdk_window_raise (gdisp->cd_ui->window);
}
void
......
......@@ -80,11 +80,7 @@ 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;
/* FIXME: GDisplays really need to be GtkObjects */
GDisplay*
gdisplay_new (GimpImage *gimage,
......@@ -134,6 +130,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->idle_render.active = FALSE;
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
......@@ -176,9 +173,6 @@ 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;
}
......@@ -379,9 +373,6 @@ gdisplay_delete (GDisplay *gdisp)
gtk_widget_unref (gdisp->shell);
if (notify_remove_func)
notify_remove_func (gdisp, notify_remove_user_data);
g_free (gdisp);
}
......@@ -2279,17 +2270,3 @@ 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,7 +18,7 @@
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__
#include <glib.h>
#include <gtk/gtk.h>
#include "gimage.h"
#include "info_dialog.h"
......@@ -156,6 +156,7 @@ struct _GDisplay
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */
GList *cd_list; /* color display conversion stuff */
GtkWidget *cd_ui; /* color display filter dialog */
};
......@@ -217,7 +218,5 @@ 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,11 +80,7 @@ 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;
/* FIXME: GDisplays really need to be GtkObjects */
GDisplay*
gdisplay_new (GimpImage *gimage,
......@@ -134,6 +130,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->idle_render.active = FALSE;
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
......@@ -176,9 +173,6 @@ 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;
}
......@@ -379,9 +373,6 @@ gdisplay_delete (GDisplay *gdisp)
gtk_widget_unref (gdisp->shell);
if (notify_remove_func)
notify_remove_func (gdisp, notify_remove_user_data);
g_free (gdisp);
}
......@@ -2279,17 +2270,3 @@ 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,7 +18,7 @@
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__
#include <glib.h>
#include <gtk/gtk.h>
#include "gimage.h"
#include "info_dialog.h"
......@@ -156,6 +156,7 @@ struct _GDisplay
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */
GList *cd_list; /* color display conversion stuff */
GtkWidget *cd_ui; /* color display filter dialog */
};
......@@ -217,7 +218,5 @@ 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__ */
......@@ -29,25 +29,22 @@ typedef struct _ColorDisplayDialog ColorDisplayDialog;
struct _ColorDisplayDialog
{
GDisplay *gdisp;
GtkWidget *shell;
GtkWidget *src;
GtkWidget *dest;
/* GtkWidget *target_menu; */
gint src_row;
gint dest_row;
gboolean modified;
GList *old_nodes;
GDisplay *gdisp;
GList *conf_nodes;
};
static ColorDisplayDialog cdd = { NULL, NULL, NULL, -1, -1, FALSE, NULL, NULL };
typedef void (*ButtonCallback) (GtkWidget *, gpointer);
typedef struct _ButtonInfo ButtonInfo;
......@@ -58,6 +55,8 @@ struct _ButtonInfo
ButtonCallback callback;
};
static void make_dialog (ColorDisplayDialog *cdd);
static void color_display_ok_callback (GtkWidget *widget,
gpointer data);
static void color_display_cancel_callback (GtkWidget *widget,
......@@ -75,7 +74,8 @@ static void color_display_configure_callback (GtkWidget *widget,
static void src_list_populate (const char *name,
gpointer data);
static void dest_list_populate (GList *node_list);
static void dest_list_populate (GList *node_list,
GtkWidget *dest);
static void select_src (GtkWidget *widget,
gint row,
......@@ -91,8 +91,16 @@ static void select_dest (GtkWidget *widget,
#define LIST_WIDTH 180
#define LIST_HEIGHT 180
#define UPDATE_DISPLAY(gdisp) G_STMT_START { \
if (gdisp != color_area_gdisp) \
{ \
gdisplay_expose_full (gdisp); \
gdisplay_flush (gdisp); \
} \
} G_STMT_END
static void
make_dialog (void)
make_dialog (ColorDisplayDialog *cdd)
{
GtkWidget *hbox;
GtkWidget *scrolled_win;
......@@ -109,21 +117,21 @@ make_dialog (void)
{ N_("Configure"), color_display_configure_callback }
};
cdd.shell = gimp_dialog_new (_("Color Display Filters"), "display_color",
gimp_standard_help_func,
"dialogs/display_filters/display_filters.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
cdd->shell = gimp_dialog_new (_("Color Display Filters"), "display_color",
gimp_standard_help_func,
"dialogs/display_filters/display_filters.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), color_display_ok_callback,
NULL, NULL, TRUE, FALSE,
_("Cancel"), color_display_cancel_callback,
NULL, NULL, FALSE, TRUE,
_("OK"), color_display_ok_callback,
cdd, NULL, TRUE, FALSE,
_("Cancel"), color_display_cancel_callback,
cdd, NULL, FALSE, TRUE,
NULL);
NULL);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd.shell)->vbox), hbox,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
TRUE, TRUE, 4);
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
......@@ -135,15 +143,15 @@ make_dialog (void)
titles[0] = _("Available Filters");
titles[1] = NULL;
cdd.src = gtk_clist_new_with_titles (1, titles);
gtk_widget_set_usize (cdd.src, LIST_WIDTH, LIST_HEIGHT);
gtk_clist_column_titles_passive (GTK_CLIST (cdd.src));
gtk_clist_set_auto_sort (GTK_CLIST (cdd.src), TRUE);
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd.src);
cdd->src = gtk_clist_new_with_titles (1, titles);
gtk_widget_set_usize (cdd->src, LIST_WIDTH, LIST_HEIGHT);
gtk_clist_column_titles_passive (GTK_CLIST (cdd->src));
gtk_clist_set_auto_sort (GTK_CLIST (cdd->src), TRUE);
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd->src);
gtk_signal_connect (GTK_OBJECT (cdd.src), "select_row",
gtk_signal_connect (GTK_OBJECT (cdd->src), "select_row",
GTK_SIGNAL_FUNC (select_src),
NULL);
cdd);
vbbox = gtk_vbutton_box_new ();
gtk_vbutton_box_set_layout_default (GTK_BUTTONBOX_START);
......@@ -158,19 +166,14 @@ make_dialog (void)
titles[0] = _("Active Filters");
titles[1] = NULL;
cdd.dest = gtk_clist_new_with_titles (1, titles);
gtk_widget_set_usize (cdd.dest, LIST_WIDTH, LIST_HEIGHT);
gtk_clist_column_titles_passive (GTK_CLIST (cdd.dest));
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd.dest);
cdd->dest = gtk_clist_new_with_titles (1, titles);
gtk_widget_set_usize (cdd->dest, LIST_WIDTH, LIST_HEIGHT);
gtk_clist_column_titles_passive (GTK_CLIST (cdd->dest));
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd->dest);
gtk_signal_connect (GTK_OBJECT (cdd.src), "select_row",
gtk_signal_connect (GTK_OBJECT (cdd->dest), "select_row",
GTK_SIGNAL_FUNC (select_dest),
NULL);
/*
cdd.target_menu = gtk_option_menu_new ();
target_menu = create_target_menu ();
*/
cdd);
for (i = 0; i < 5; i++)
{
......@@ -181,41 +184,38 @@ make_dialog (void)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (buttons[i].callback),
cdd.shell);
cdd);
}
gtk_widget_show_all (hbox);
}
static void
create_target_menu (void)
{
}
static void
color_display_ok_callback (GtkWidget *widget,
gpointer data)
{
ColorDisplayDialog *cdd = data;
GDisplay *gdisp = cdd->gdisp;
GList *list;
gtk_widget_hide (GTK_WIDGET (data));
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
gdisp->cd_ui = NULL;
if (cdd.modified && cdd.gdisp != NULL)
if (cdd->modified)
{
list = cdd.old_nodes;
list = cdd->old_nodes;
while (list)
{
if (!g_list_find (cdd.gdisp->cd_list, list->data))
gdisplay_color_detach_destroy (cdd.gdisp, list->data);
if (!g_list_find (gdisp->cd_list, list->data))
gdisplay_color_detach_destroy (gdisp, list->data);
list = list->next;
}
g_list_free (cdd.old_nodes);
g_list_free (cdd->old_nodes);
gdisplay_expose_full (cdd.gdisp);
gdisplay_flush (cdd.gdisp);
UPDATE_DISPLAY (gdisp);
}
}
......@@ -223,28 +223,30 @@ static void
color_display_cancel_callback (GtkWidget *widget,
gpointer data)
{
ColorDisplayDialog *cdd = data;
GDisplay *gdisp = cdd->gdisp;
GList *list;
GList *next;
gtk_widget_hide (GTK_WIDGET (data));
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
gdisp->cd_ui = NULL;
if (cdd.modified && cdd.gdisp != NULL)
if (cdd->modified)
{
list = cdd.gdisp->cd_list;
cdd.gdisp->cd_list = cdd.old_nodes;
list = gdisp->cd_list;
gdisp->cd_list = cdd->old_nodes;
while (list)
{
next = list->next;
if (!g_list_find (cdd.old_nodes, list->data))
gdisplay_color_detach_destroy (cdd.gdisp, list->data);
if (!g_list_find (cdd->old_nodes, list->data))
gdisplay_color_detach_destroy (gdisp, list->data);
list = next;
}
gdisplay_expose_full (cdd.gdisp);
gdisplay_flush (cdd.gdisp);
UPDATE_DISPLAY (gdisp);
}
}
......@@ -252,128 +254,141 @@ static void
color_display_add_callback (GtkWidget *widget,
gpointer data)
{
ColorDisplayDialog *cdd = data;
GDisplay *gdisp = cdd->gdisp;
gchar *name = NULL;
ColorDisplayNode *node;
gint row;
if (cdd.src_row < 0 || cdd.gdisp == NULL)
if (cdd->src_row < 0)
return;
gtk_clist_get_text (GTK_CLIST (cdd.src), cdd.src_row, 0, &name);
gtk_clist_get_text (GTK_CLIST (cdd->src), cdd->src_row, 0, &name);
if (!name)
return;
cdd.modified = TRUE;
cdd->modified = TRUE;
node = gdisplay_color_attach (cdd.gdisp, name);
node = gdisplay_color_attach (gdisp, name);
row = gtk_clist_append (GTK_CLIST (cdd.dest), &name);
gtk_clist_set_row_data (GTK_CLIST (cdd.dest), row, node);
row = gtk_clist_append (GTK_CLIST (cdd->dest), &name);
gtk_clist_set_row_data (GTK_CLIST (cdd->dest), row, node);
gdisplay_expose_full (cdd.gdisp);
gdisplay_flush (cdd.gdisp);
UPDATE_DISPLAY (gdisp);
}
static void
color_display_remove_callback (GtkWidget *widget,
gpointer data)
{
ColorDisplayDialog *cdd = data;
GDisplay *gdisp = cdd->gdisp;
ColorDisplayNode *node;
if (cdd.dest_row < 0 || cdd.gdisp == NULL)
if (cdd->dest_row < 0)
return;
node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest),
cdd.dest_row);
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
gtk_clist_remove (GTK_CLIST (cdd->dest), cdd->dest_row);
gtk_clist_remove (GTK_CLIST (cdd.dest), cdd.dest_row);
cdd->modified = TRUE;
cdd.modified = TRUE;
if (g_list_find (cdd.old_nodes, node))
gdisplay_color_detach (cdd.gdisp, node);
if (g_list_find (cdd->old_nodes, node))
gdisplay_color_detach (gdisp, node);
else
gdisplay_color_detach_destroy (cdd.gdisp, node);
gdisplay_color_detach_destroy (gdisp, node);
gdisplay_expose_full (cdd.gdisp);
gdisplay_flush (cdd.gdisp);
UPDATE_DISPLAY (gdisp);
}
static void
color_display_up_callback (GtkWidget *widget,
gpointer data)
{
ColorDisplayDialog *cdd = data;
GDisplay *gdisp = cdd->gdisp;
ColorDisplayNode *node;
if (cdd.dest_row < 0 || cdd.gdisp == NULL)
if (cdd->dest_row < 0)
return;
node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest),
cdd.dest_row);
gtk_clist_row_move (GTK_CLIST (cdd.dest), cdd.dest_row, cdd.dest_row - 1);
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
gtk_clist_row_move (GTK_CLIST (cdd->dest), cdd->dest_row, cdd->dest_row - 1);