From 5e17408c8476fc84ff621b706812dafc23196de2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 14 Mar 2002 22:42:50 +0000 Subject: [PATCH] Re-enabled the display filters. They work exactly the same way as before 2002-03-14 Michael Natterer Re-enabled the display filters. They work exactly the same way as before except for the color_area pseudo-display. More stuff to come... * app/display/Makefile.am: build them again. * app/display/gimpdisplayshell-filter-dialog.[ch] * app/display/gimpdisplayshell-filter.[ch]: changed to the new namespace, work on GimpDisplayShell instead of GimpDisplay. * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell.[ch]: changed accordingly. * app/gui/dialogs-constructors.c: enabled the dialog constructor. * app/gui/gui.c: call the init() function. * app/gui/menus.c: enabled the menu entry, but moved it to /View. Moved "Undo History..." to /Image. * modules/Makefile.am: build and install the modules. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c: made them compile with minimal changes. Unrelated: * app/undo_history.c: connect to the image's "disconnect", not "destroy" signal. * app/tools/gimpselectiontool.c: mask out the irrelevant parts of the "state" passed to the modifier_key() func, so tool_options button toggling works with other modifiers (e.g. num_lock) pressed. --- ChangeLog | 38 +++++ app/dialogs/dialogs-constructors.c | 26 +-- app/display/Makefile.am | 4 + app/display/gimpdisplayshell-draw.c | 12 +- app/display/gimpdisplayshell-draw.h | 2 - app/display/gimpdisplayshell-filter-dialog.c | 161 +++++++++---------- app/display/gimpdisplayshell-filter-dialog.h | 8 +- app/display/gimpdisplayshell-filter.c | 158 +++++++++--------- app/display/gimpdisplayshell-filter.h | 49 +++--- app/display/gimpdisplayshell-render.c | 8 +- app/display/gimpdisplayshell.c | 12 +- app/display/gimpdisplayshell.h | 2 - app/gui/dialogs-constructors.c | 26 +-- app/gui/gui.c | 3 +- app/gui/menus.c | 27 ++-- app/menus/menus.c | 27 ++-- app/tools/gimpselectiontool.c | 8 +- app/undo_history.c | 2 +- app/widgets/gimpcolordisplayeditor.c | 161 +++++++++---------- modules/Makefile.am | 15 +- modules/cdisplay_gamma.c | 24 ++- modules/cdisplay_highcontrast.c | 23 ++- 22 files changed, 419 insertions(+), 377 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85756fcb88..b12ec9af15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2002-03-14 Michael Natterer + + Re-enabled the display filters. They work exactly the same way + as before except for the color_area pseudo-display. More stuff + to come... + + * app/display/Makefile.am: build them again. + + * app/display/gimpdisplayshell-filter-dialog.[ch] + * app/display/gimpdisplayshell-filter.[ch]: changed to the new + namespace, work on GimpDisplayShell instead of GimpDisplay. + + * app/display/gimpdisplayshell-render.c + * app/display/gimpdisplayshell.[ch]: changed accordingly. + + * app/gui/dialogs-constructors.c: enabled the dialog constructor. + + * app/gui/gui.c: call the init() function. + + * app/gui/menus.c: enabled the menu entry, but moved it to + /View. Moved "Undo History..." to /Image. + + * modules/Makefile.am: build and install the modules. + + * modules/cdisplay_gamma.c + * modules/cdisplay_highcontrast.c: made them compile with minimal + changes. + + Unrelated: + + * app/undo_history.c: connect to the image's "disconnect", not + "destroy" signal. + + * app/tools/gimpselectiontool.c: mask out the irrelevant parts of + the "state" passed to the modifier_key() func, so tool_options + button toggling works with other modifiers (e.g. num_lock) + pressed. + 2002-03-14 Michael Natterer * app/tools/gimpcolorpickertool.c: oops, including removed files diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c index 145d63d979..196f7e8846 100644 --- a/app/dialogs/dialogs-constructors.c +++ b/app/dialogs/dialogs-constructors.c @@ -60,6 +60,10 @@ #include "widgets/gimptoolbox-color-area.h" #include "widgets/gimpvectorslistview.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" +#include "display/gimpdisplayshell-filter-dialog.h" + #include "about-dialog.h" #include "brushes-commands.h" #include "buffers-commands.h" @@ -85,10 +89,6 @@ #include "gimprc.h" #include "undo_history.h" -#ifdef DISPLAY_FILTERS -#include "gdisplay_color_ui.h" -#endif /* DISPLAY_FILTERS */ - #include "libgimp/gimpintl.h" @@ -202,21 +202,23 @@ dialogs_display_filters_get (GimpDialogFactory *factory, GimpContext *context, gint preview_size) { -#ifdef DISPLAY_FILTERS GimpDisplay *gdisp; gdisp = gimp_context_get_display (context); - if (! gdisp) - gdisp = color_area_gdisp; + if (gdisp) + { + GimpDisplayShell *shell; - if (! gdisp->cd_ui) - gdisplay_color_ui_new (gdisp); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + + if (! shell->cd_ui) + gimp_display_shell_filter_dialog_new (shell); + + return shell->cd_ui; + } - return gdisp->cd_ui; -#else return NULL; -#endif /* DISPLAY_FILTERS */ } GtkWidget * diff --git a/app/display/Makefile.am b/app/display/Makefile.am index a3ba37c868..e43611ec3e 100644 --- a/app/display/Makefile.am +++ b/app/display/Makefile.am @@ -34,6 +34,10 @@ libappdisplay_a_sources = @STRIP_BEGIN@ \ gimpdisplayshell-dnd.h \ gimpdisplayshell-handlers.c \ gimpdisplayshell-handlers.h \ + gimpdisplayshell-filter.c \ + gimpdisplayshell-filter.h \ + gimpdisplayshell-filter-dialog.c \ + gimpdisplayshell-filter-dialog.h \ gimpdisplayshell-layer-select.c \ gimpdisplayshell-layer-select.h \ gimpdisplayshell-marching-ants.h \ diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 6a0a2c08c1..22ea94ff79 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -59,6 +59,7 @@ #include "gimpdisplayshell.h" #include "gimpdisplayshell-callbacks.h" #include "gimpdisplayshell-dnd.h" +#include "gimpdisplayshell-filter.h" #include "gimpdisplayshell-handlers.h" #include "gimpdisplayshell-render.h" #include "gimpdisplayshell-selection.h" @@ -68,10 +69,6 @@ #include "nav_window.h" #include "undo.h" -#ifdef DISPLAY_FILTERS -#include "gdisplay_color.h" -#endif /* DISPLAY_FILTERS */ - #include "libgimp/gimpintl.h" @@ -236,10 +233,8 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->nav_dialog = NULL; shell->nav_popup = NULL; -#ifdef DISPLAY_FILTERS shell->cd_list = NULL; shell->cd_ui = NULL; -#endif /* DISPLAY_FILTERS */ gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp"); gtk_window_set_resizable (GTK_WINDOW (shell), TRUE); @@ -311,10 +306,7 @@ gimp_display_shell_destroy (GtkObject *object) shell->display_areas = gimp_display_area_list_free (shell->display_areas); -#ifdef DISPLAY_FILTERS - /* detach any color displays */ - gdisplay_color_detach_all (gdisp); -#endif /* DISPLAY_FILTERS */ + gimp_display_shell_filter_detach_all (shell); if (shell->render_buf) { diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h index 8636f750f1..8d078f70dd 100644 --- a/app/display/gimpdisplayshell-draw.h +++ b/app/display/gimpdisplayshell-draw.h @@ -102,10 +102,8 @@ struct _GimpDisplayShell NavigationDialog *nav_dialog; /* image navigation dialog */ NavigationDialog *nav_popup; /* navigation popup */ -#ifdef DISPLAY_FILTERS GList *cd_list; /* color display conversion stuff */ GtkWidget *cd_ui; /* color display filter dialog */ -#endif /* DISPLAY_FILTERS */ }; struct _GimpDisplayShellClass diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c index a7c67bc567..d164cfcccd 100644 --- a/app/display/gimpdisplayshell-filter-dialog.c +++ b/app/display/gimpdisplayshell-filter-dialog.c @@ -18,19 +18,23 @@ #include "config.h" +#ifdef __GNUC__ +#warning GTK_DISABLE_DEPRECATED +#endif +#undef GTK_DISABLE_DEPRECATED #include -#include "libgimpbase/gimpbsse.h" +#include "libgimpbase/gimpbase.h" +#include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "display-types.h" -#include "color_area.h" -#include "dialog_handler.h" -#include "gdisplay.h" -#include "gdisplay_color.h" -#include "gdisplay_color_ui.h" -#include "gimpimageP.h" -#include "gimpui.h" +#include "core/gimpimage.h" + +#include "gimpdisplay.h" +#include "gimpdisplayshell.h" +#include "gimpdisplayshell-filter.h" +#include "gimpdisplayshell-filter-dialog.h" #include "libgimp/gimpintl.h" @@ -39,9 +43,9 @@ typedef struct _ColorDisplayDialog ColorDisplayDialog; struct _ColorDisplayDialog { - GimpDisplay *gdisp; + GimpDisplayShell *shell; - GtkWidget *shell; + GtkWidget *dialog; GtkWidget *src; GtkWidget *dest; @@ -124,12 +128,10 @@ static void color_display_update_up_and_down(ColorDisplayDialog *cdd); #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); \ - } \ +#define UPDATE_DISPLAY(shell) G_STMT_START \ +{ \ + gimp_display_shell_expose_full (shell); \ + gimp_display_shell_flush (shell); \ } G_STMT_END static void @@ -138,8 +140,8 @@ make_dialog (ColorDisplayDialog *cdd) GtkWidget *hbox; GtkWidget *scrolled_win; GtkWidget *vbbox; - gchar *titles[2]; - gint i; + gchar *titles[2]; + gint i; static ButtonInfo buttons[] = { @@ -150,7 +152,7 @@ make_dialog (ColorDisplayDialog *cdd) { N_("Configure"), color_display_configure_callback } }; - cdd->shell = gimp_dialog_new (_("Color Display Filters"), "display_color", + cdd->dialog = gimp_dialog_new (_("Color Display Filters"), "display_color", gimp_standard_help_func, "dialogs/display_filters/display_filters.html", GTK_WIN_POS_NONE, @@ -164,10 +166,8 @@ make_dialog (ColorDisplayDialog *cdd) NULL); - dialog_register (cdd->shell); - 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->dialog)->vbox), hbox, TRUE, TRUE, 4); scrolled_win = gtk_scrolled_window_new (NULL, NULL); @@ -236,29 +236,24 @@ static void color_display_ok_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; - GList *list; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; + GList *list; - dialog_unregister(cdd->shell); - gtk_widget_destroy (GTK_WIDGET (cdd->shell)); - gdisp->cd_ui = NULL; + gtk_widget_destroy (GTK_WIDGET (cdd->dialog)); + shell->cd_ui = NULL; if (cdd->modified) { - list = cdd->old_nodes; - - while (list) + for (list = cdd->old_nodes; list; list = g_list_next (list)) { - if (!g_list_find (gdisp->cd_list, list->data)) - gdisplay_color_detach_destroy (gdisp, list->data); - - list = list->next; + if (! g_list_find (shell->cd_list, list->data)) + gimp_display_shell_filter_detach_destroy (shell, list->data); } g_list_free (cdd->old_nodes); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } } @@ -266,38 +261,37 @@ static void color_display_cancel_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; GList *list; GList *next; - dialog_unregister(cdd->shell); - gtk_widget_destroy (GTK_WIDGET (cdd->shell)); - gdisp->cd_ui = NULL; + gtk_widget_destroy (GTK_WIDGET (cdd->dialog)); + shell->cd_ui = NULL; if (cdd->modified) { - list = gdisp->cd_list; - gdisp->cd_list = cdd->old_nodes; + list = shell->cd_list; + shell->cd_list = cdd->old_nodes; while (list) { next = list->next; - if (!g_list_find (cdd->old_nodes, list->data)) - gdisplay_color_detach_destroy (gdisp, list->data); + if (! g_list_find (cdd->old_nodes, list->data)) + gimp_display_shell_filter_detach_destroy (shell, list->data); list = next; } - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } } static void color_display_update_up_and_down (ColorDisplayDialog *cdd) { - gtk_widget_set_sensitive (cdd->buttons[BUTTON_UP], cdd->dest_row > 0); + gtk_widget_set_sensitive (cdd->buttons[BUTTON_UP], cdd->dest_row > 0); gtk_widget_set_sensitive (cdd->buttons[BUTTON_DOWN], cdd->dest_row >= 0 && cdd->dest_row < GTK_CLIST (cdd->dest)->rows - 1); } @@ -306,11 +300,11 @@ static void color_display_add_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; - gchar *name = NULL; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; + gchar *name = NULL; ColorDisplayNode *node; - gint row; + gint row; if (cdd->src_row < 0) return; @@ -322,22 +316,22 @@ color_display_add_callback (GtkWidget *widget, cdd->modified = TRUE; - node = gdisplay_color_attach (gdisp, name); + node = gimp_display_shell_filter_attach (shell, name); row = gtk_clist_append (GTK_CLIST (cdd->dest), &name); gtk_clist_set_row_data (GTK_CLIST (cdd->dest), row, node); - + color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_remove_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -349,23 +343,23 @@ color_display_remove_callback (GtkWidget *widget, cdd->modified = TRUE; if (g_list_find (cdd->old_nodes, node)) - gdisplay_color_detach (gdisp, node); + gimp_display_shell_filter_detach (shell, node); else - gdisplay_color_detach_destroy (gdisp, node); + gimp_display_shell_filter_detach_destroy (shell, node); cdd->dest_row = -1; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_up_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 1) @@ -374,22 +368,22 @@ color_display_up_callback (GtkWidget *widget, 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); - gdisplay_color_reorder_up (gdisp, node); + gimp_display_shell_filter_reorder_up (shell, node); cdd->modified = TRUE; cdd->dest_row--; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_down_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -401,22 +395,22 @@ color_display_down_callback (GtkWidget *widget, 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); - gdisplay_color_reorder_down (gdisp, node); + gimp_display_shell_filter_reorder_down (shell, node); cdd->modified = TRUE; cdd->dest_row++; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_configure_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -424,17 +418,18 @@ color_display_configure_callback (GtkWidget *widget, node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row); - if (!g_list_find (cdd->conf_nodes, node)) + if (! g_list_find (cdd->conf_nodes, node)) cdd->conf_nodes = g_list_append (cdd->conf_nodes, node); - - gdisplay_color_configure (node, NULL, NULL, NULL, NULL); + + gimp_display_shell_filter_configure (node, NULL, NULL, NULL, NULL); cdd->modified = TRUE; - UPDATE_DISPLAY (gdisp); + + UPDATE_DISPLAY (shell); } void -gdisplay_color_ui_new (GimpDisplay *gdisp) +gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell) { ColorDisplayDialog *cdd; @@ -447,16 +442,16 @@ gdisplay_color_ui_new (GimpDisplay *gdisp) color_display_foreach (src_list_populate, cdd->src); - cdd->old_nodes = gdisp->cd_list; - dest_list_populate (gdisp->cd_list, cdd->dest); - gdisp->cd_list = g_list_copy (cdd->old_nodes); + cdd->old_nodes = shell->cd_list; + dest_list_populate (shell->cd_list, cdd->dest); + shell->cd_list = g_list_copy (cdd->old_nodes); - cdd->gdisp = gdisp; + cdd->shell = shell; cdd->src_row = -1; cdd->dest_row = -1; - gdisp->cd_ui = cdd->shell; + shell->cd_ui = cdd->dialog; } static void @@ -471,7 +466,7 @@ dest_list_populate (GList *node_list, GtkWidget *dest) { ColorDisplayNode *node; - int row; + int row; while (node_list) { @@ -492,7 +487,9 @@ select_src (GtkWidget *widget, gpointer data) { ColorDisplayDialog *cdd = data; + cdd->src_row = row; + gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], TRUE); } @@ -504,7 +501,9 @@ unselect_src (GtkWidget *widget, gpointer data) { ColorDisplayDialog *cdd = data; + cdd->src_row = -1; + gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], FALSE); } diff --git a/app/display/gimpdisplayshell-filter-dialog.h b/app/display/gimpdisplayshell-filter-dialog.h index 3fdc38c77e..509e118f14 100644 --- a/app/display/gimpdisplayshell-filter-dialog.h +++ b/app/display/gimpdisplayshell-filter-dialog.h @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __GDISPLAY_COLOR_UI_H__ -#define __GDISPLAY_COLOR_UI_H__ +#ifndef __GIMP_DISPLAY_SHELL_FILTER_DIALOG_H__ +#define __GIMP_DISPLAY_SHELL_FILTER_DIALOG_H__ -void gdisplay_color_ui_new (GimpDisplay *gdisp); +void gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell); -#endif /* __GDISPLAY_COLOR_UI_H__ */ +#endif /* __GIMP_DISPLAY_SHELL_FILTER_DIALOG_H__ */ diff --git a/app/display/gimpdisplayshell-filter.c b/app/display/gimpdisplayshell-filter.c index 8d2c5c8849..1f007b2800 100644 --- a/app/display/gimpdisplayshell-filter.c +++ b/app/display/gimpdisplayshell-filter.c @@ -21,16 +21,18 @@ #include #include +#include #include "libgimpbase/gimpbase.h" -#include "apptypes.h" -#include "gdisplay_color.h" -#include "gdisplay.h" -#include "gimpimageP.h" -#include "gimpui.h" +#include "display-types.h" + +#include "core/gimpimage.h" + +#include "gimpdisplay.h" +#include "gimpdisplayshell.h" +#include "gimpdisplayshell-filter.h" -#include typedef struct _ColorDisplayInfo ColorDisplayInfo; @@ -41,16 +43,19 @@ struct _ColorDisplayInfo GSList *refs; }; + +static void color_display_foreach_real (gpointer key, + gpointer value, + gpointer user_data); +static void gimp_display_shell_filter_detach_real (GimpDisplayShell *shell, + ColorDisplayNode *node, + gboolean unref); +static gint node_name_compare (ColorDisplayNode *node, + const gchar *name); + + static GHashTable *color_display_table = NULL; -static void color_display_foreach_real (gpointer key, - gpointer value, - gpointer user_data); -static void gdisplay_color_detach_real (GimpDisplay *gdisp, - ColorDisplayNode *node, - gboolean unref); -static gint node_name_compare (ColorDisplayNode *node, - const gchar *name); void color_display_init (void) @@ -87,26 +92,24 @@ G_MODULE_EXPORT gboolean gimp_color_display_unregister (const gchar *name) { ColorDisplayInfo *info; - GimpDisplay *gdisp; - GList *node; + GimpDisplayShell *shell; + GList *node; if ((info = g_hash_table_lookup (color_display_table, name))) { - GSList *refs = info->refs; + GSList *refs; - while (refs) + for (refs = info->refs; refs; refs = g_slist_next (refs)) { - gdisp = (GimpDisplay *) refs->data; + shell = GIMP_DISPLAY_SHELL (refs->data); - node = g_list_find_custom (gdisp->cd_list, (gpointer) name, + node = g_list_find_custom (shell->cd_list, (gpointer) name, (GCompareFunc) node_name_compare); - gdisp->cd_list = g_list_remove_link (gdisp->cd_list, node); + shell->cd_list = g_list_remove_link (shell->cd_list, node); - gdisplay_color_detach_real (gdisp, node->data, FALSE); + gimp_display_shell_filter_detach_real (shell, node->data, FALSE); g_list_free_1 (node); - - refs = refs->next; } g_slist_free (info->refs); @@ -145,18 +148,21 @@ color_display_foreach_real (gpointer key, gpointer value, gpointer user_data) { - DisplayForeachData *data = (DisplayForeachData *) user_data; + DisplayForeachData *data; + + data = (DisplayForeachData *) user_data; + data->func (key, data->user_data); } ColorDisplayNode * -gdisplay_color_attach (GimpDisplay *gdisp, - const gchar *name) +gimp_display_shell_filter_attach (GimpDisplayShell *shell, + const gchar *name) { ColorDisplayInfo *info; ColorDisplayNode *node; - g_return_val_if_fail (gdisp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL); if ((info = g_hash_table_lookup (color_display_table, name))) { @@ -168,14 +174,14 @@ gdisplay_color_attach (GimpDisplay *gdisp, if (!info->refs && info->methods.init) info->methods.init (); - info->refs = g_slist_append (info->refs, gdisp); + info->refs = g_slist_append (info->refs, shell); if (info->methods.new) - node->cd_ID = info->methods.new (gdisp->gimage->base_type); + node->cd_ID = info->methods.new (shell->gdisp->gimage->base_type); node->cd_convert = info->methods.convert; - gdisp->cd_list = g_list_append (gdisp->cd_list, node); + shell->cd_list = g_list_append (shell->cd_list, node); return node; } @@ -186,13 +192,13 @@ gdisplay_color_attach (GimpDisplay *gdisp, } ColorDisplayNode * -gdisplay_color_attach_clone (GimpDisplay *gdisp, - ColorDisplayNode *node) +gimp_display_shell_filter_attach_clone (GimpDisplayShell *shell, + ColorDisplayNode *node) { ColorDisplayInfo *info; ColorDisplayNode *clone; - g_return_val_if_fail (gdisp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL); g_return_val_if_fail (node != NULL, NULL); if ((info = g_hash_table_lookup (color_display_table, node->cd_name))) @@ -200,16 +206,16 @@ gdisplay_color_attach_clone (GimpDisplay *gdisp, clone = g_new (ColorDisplayNode, 1); clone->cd_name = g_strdup (node->cd_name); - clone->cd_ID = NULL; + clone->cd_ID = NULL; - info->refs = g_slist_append (info->refs, gdisp); + info->refs = g_slist_append (info->refs, shell); if (info->methods.clone) node->cd_ID = info->methods.clone (node->cd_ID); node->cd_convert = info->methods.convert; - gdisp->cd_list = g_list_append (gdisp->cd_list, node); + shell->cd_list = g_list_append (shell->cd_list, node); return node; } @@ -220,51 +226,49 @@ gdisplay_color_attach_clone (GimpDisplay *gdisp, } void -gdisplay_color_detach (GimpDisplay *gdisp, - ColorDisplayNode *node) +gimp_display_shell_filter_detach (GimpDisplayShell *shell, + ColorDisplayNode *node) { - g_return_if_fail (gdisp != NULL); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - gdisp->cd_list = g_list_remove (gdisp->cd_list, node); + shell->cd_list = g_list_remove (shell->cd_list, node); } void -gdisplay_color_detach_destroy (GimpDisplay *gdisp, - ColorDisplayNode *node) +gimp_display_shell_filter_detach_destroy (GimpDisplayShell *shell, + ColorDisplayNode *node) { - g_return_if_fail (gdisp != NULL); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - gdisplay_color_detach_real (gdisp, node, TRUE); - gdisp->cd_list = g_list_remove (gdisp->cd_list, node); + gimp_display_shell_filter_detach_real (shell, node, TRUE); + + shell->cd_list = g_list_remove (shell->cd_list, node); } void -gdisplay_color_detach_all (GimpDisplay *gdisp) +gimp_display_shell_filter_detach_all (GimpDisplayShell *shell) { GList *list; - g_return_if_fail (gdisp != NULL); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - list = gdisp->cd_list; - - while (list) + for (list = shell->cd_list; list; list = g_list_next (list)) { - gdisplay_color_detach_real (gdisp, list->data, TRUE); - list = list->next; + gimp_display_shell_filter_detach_real (shell, list->data, TRUE); } - g_list_free (gdisp->cd_list); - gdisp->cd_list = NULL; + g_list_free (shell->cd_list); + shell->cd_list = NULL; } static void -gdisplay_color_detach_real (GimpDisplay *gdisp, - ColorDisplayNode *node, - gboolean unref) +gimp_display_shell_filter_detach_real (GimpDisplayShell *shell, + ColorDisplayNode *node, + gboolean unref) { ColorDisplayInfo *info; - g_return_if_fail (gdisp != NULL); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (node != NULL); if ((info = g_hash_table_lookup (color_display_table, node->cd_name))) @@ -273,23 +277,26 @@ gdisplay_color_detach_real (GimpDisplay *gdisp, info->methods.destroy (node->cd_ID); if (unref) - info->refs = g_slist_remove (info->refs, gdisp); - + info->refs = g_slist_remove (info->refs, shell); + if (!info->refs && info->methods.finalize) info->methods.finalize (); } g_free (node->cd_name); g_free (node); -} +} void -gdisplay_color_reorder_up (GimpDisplay *gdisp, - ColorDisplayNode *node) +gimp_display_shell_filter_reorder_up (GimpDisplayShell *shell, + ColorDisplayNode *node) { GList *node_list; - node_list = g_list_find (gdisp->cd_list, node); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + g_return_if_fail (node != NULL); + + node_list = g_list_find (shell->cd_list, node); if (node_list->prev) { @@ -299,14 +306,15 @@ gdisplay_color_reorder_up (GimpDisplay *gdisp, } void -gdisplay_color_reorder_down (GimpDisplay *gdisp, - ColorDisplayNode *node) +gimp_display_shell_filter_reorder_down (GimpDisplayShell *shell, + ColorDisplayNode *node) { GList *node_list; - g_return_if_fail (gdisp != NULL); + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + g_return_if_fail (node != NULL); - node_list = g_list_find (gdisp->cd_list, node); + node_list = g_list_find (shell->cd_list, node); if (node_list->next) { @@ -323,11 +331,11 @@ node_name_compare (ColorDisplayNode *node, } void -gdisplay_color_configure (ColorDisplayNode *node, - GFunc ok_func, - gpointer ok_data, - GFunc cancel_func, - gpointer cancel_data) +gimp_display_shell_filter_configure (ColorDisplayNode *node, + GFunc ok_func, + gpointer ok_data, + GFunc cancel_func, + gpointer cancel_data) { ColorDisplayInfo *info; @@ -347,7 +355,7 @@ gdisplay_color_configure (ColorDisplayNode *node, } void -gdisplay_color_configure_cancel (ColorDisplayNode *node) +gimp_display_shell_filter_configure_cancel (ColorDisplayNode *node) { ColorDisplayInfo *info; diff --git a/app/display/gimpdisplayshell-filter.h b/app/display/gimpdisplayshell-filter.h index a579916557..8e24acf22d 100644 --- a/app/display/gimpdisplayshell-filter.h +++ b/app/display/gimpdisplayshell-filter.h @@ -15,8 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __GDISPLAY_COLOR_H__ -#define __GDISPLAY_COLOR_H__ + +#ifndef __GIMP_DISPLAY_SHELL_FILTER_H__ +#define __GIMP_DISPLAY_SHELL_FILTER_H__ + #include "libgimp/gimpcolordisplay.h" @@ -36,25 +38,28 @@ void color_display_init (void); void color_display_foreach (GimpCDFunc func, gpointer user_data); -ColorDisplayNode * gdisplay_color_attach (GimpDisplay *gdisp, - const gchar *name); -ColorDisplayNode * gdisplay_color_attach_clone (GimpDisplay *gdisp, - ColorDisplayNode *node); -void gdisplay_color_detach (GimpDisplay *gdisp, - ColorDisplayNode *node); -void gdisplay_color_detach_destroy (GimpDisplay *gdisp, - ColorDisplayNode *node); -void gdisplay_color_detach_all (GimpDisplay *gdisp); -void gdisplay_color_reorder_up (GimpDisplay *gdisp, - ColorDisplayNode *node); -void gdisplay_color_reorder_down (GimpDisplay *gdisp, - ColorDisplayNode *node); +ColorDisplayNode * + gimp_display_shell_filter_attach (GimpDisplayShell *shell, + const gchar *name); +ColorDisplayNode * + gimp_display_shell_filter_attach_clone (GimpDisplayShell *shell, + ColorDisplayNode *node); +void gimp_display_shell_filter_detach (GimpDisplayShell *shell, + ColorDisplayNode *node); +void gimp_display_shell_filter_detach_destroy (GimpDisplayShell *shell, + ColorDisplayNode *node); +void gimp_display_shell_filter_detach_all (GimpDisplayShell *shell); +void gimp_display_shell_filter_reorder_up (GimpDisplayShell *shell, + ColorDisplayNode *node); +void gimp_display_shell_filter_reorder_down (GimpDisplayShell *shell, + ColorDisplayNode *node); -void gdisplay_color_configure (ColorDisplayNode *node, - GFunc ok_func, - gpointer ok_data, - GFunc cancel_func, - gpointer cancel_data); -void gdisplay_color_configure_cancel (ColorDisplayNode *node); +void gimp_display_shell_filter_configure (ColorDisplayNode *node, + GFunc ok_func, + gpointer ok_data, + GFunc cancel_func, + gpointer cancel_data); +void gimp_display_shell_filter_configure_cancel (ColorDisplayNode *node); -#endif /* __GDISPLAY_COLOR_H__ */ + +#endif /* __GIMP_DISPLAY_SHELL_FILTER_H__ */ diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index a995d2d31b..1f779447be 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -33,6 +33,7 @@ #include "gimpdisplay.h" #include "gimpdisplayshell.h" +#include "gimpdisplayshell-filter.h" #include "gimpdisplayshell-render.h" #include "gimprc.h" @@ -233,10 +234,7 @@ gimp_display_shell_render (GimpDisplayShell *shell, { RenderInfo info; gint image_type; - -#ifdef DISPLAY_FILTERS GList *list; -#endif render_image_init_info (&info, shell, x, y, w, h); @@ -263,8 +261,6 @@ gimp_display_shell_render (GimpDisplayShell *shell, (* render_funcs[image_type]) (&info); -#if 0 -#ifdef DISPLAY_FILTERS /* apply filters to the rendered projection */ for (list = shell->cd_list; list; list = g_list_next (list)) { @@ -276,8 +272,6 @@ gimp_display_shell_render (GimpDisplayShell *shell, 3, 3 * GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH); } -#endif /* DISPLAY_FILTERS */ -#endif /* put it to the screen */ gdk_draw_rgb_image_dithalign (shell->canvas->window, diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 6a0a2c08c1..22ea94ff79 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -59,6 +59,7 @@ #include "gimpdisplayshell.h" #include "gimpdisplayshell-callbacks.h" #include "gimpdisplayshell-dnd.h" +#include "gimpdisplayshell-filter.h" #include "gimpdisplayshell-handlers.h" #include "gimpdisplayshell-render.h" #include "gimpdisplayshell-selection.h" @@ -68,10 +69,6 @@ #include "nav_window.h" #include "undo.h" -#ifdef DISPLAY_FILTERS -#include "gdisplay_color.h" -#endif /* DISPLAY_FILTERS */ - #include "libgimp/gimpintl.h" @@ -236,10 +233,8 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->nav_dialog = NULL; shell->nav_popup = NULL; -#ifdef DISPLAY_FILTERS shell->cd_list = NULL; shell->cd_ui = NULL; -#endif /* DISPLAY_FILTERS */ gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp"); gtk_window_set_resizable (GTK_WINDOW (shell), TRUE); @@ -311,10 +306,7 @@ gimp_display_shell_destroy (GtkObject *object) shell->display_areas = gimp_display_area_list_free (shell->display_areas); -#ifdef DISPLAY_FILTERS - /* detach any color displays */ - gdisplay_color_detach_all (gdisp); -#endif /* DISPLAY_FILTERS */ + gimp_display_shell_filter_detach_all (shell); if (shell->render_buf) { diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index 8636f750f1..8d078f70dd 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -102,10 +102,8 @@ struct _GimpDisplayShell NavigationDialog *nav_dialog; /* image navigation dialog */ NavigationDialog *nav_popup; /* navigation popup */ -#ifdef DISPLAY_FILTERS GList *cd_list; /* color display conversion stuff */ GtkWidget *cd_ui; /* color display filter dialog */ -#endif /* DISPLAY_FILTERS */ }; struct _GimpDisplayShellClass diff --git a/app/gui/dialogs-constructors.c b/app/gui/dialogs-constructors.c index 145d63d979..196f7e8846 100644 --- a/app/gui/dialogs-constructors.c +++ b/app/gui/dialogs-constructors.c @@ -60,6 +60,10 @@ #include "widgets/gimptoolbox-color-area.h" #include "widgets/gimpvectorslistview.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" +#include "display/gimpdisplayshell-filter-dialog.h" + #include "about-dialog.h" #include "brushes-commands.h" #include "buffers-commands.h" @@ -85,10 +89,6 @@ #include "gimprc.h" #include "undo_history.h" -#ifdef DISPLAY_FILTERS -#include "gdisplay_color_ui.h" -#endif /* DISPLAY_FILTERS */ - #include "libgimp/gimpintl.h" @@ -202,21 +202,23 @@ dialogs_display_filters_get (GimpDialogFactory *factory, GimpContext *context, gint preview_size) { -#ifdef DISPLAY_FILTERS GimpDisplay *gdisp; gdisp = gimp_context_get_display (context); - if (! gdisp) - gdisp = color_area_gdisp; + if (gdisp) + { + GimpDisplayShell *shell; - if (! gdisp->cd_ui) - gdisplay_color_ui_new (gdisp); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + + if (! shell->cd_ui) + gimp_display_shell_filter_dialog_new (shell); + + return shell->cd_ui; + } - return gdisp->cd_ui; -#else return NULL; -#endif /* DISPLAY_FILTERS */ } GtkWidget * diff --git a/app/gui/gui.c b/app/gui/gui.c index 9694ea18e8..61c753040e 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -37,6 +37,7 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplay-foreach.h" #include "display/gimpdisplayshell.h" +#include "display/gimpdisplayshell-filter.h" #include "display/gimpdisplayshell-render.h" #include "widgets/gimpdevices.h" @@ -225,9 +226,7 @@ gui_init (Gimp *gimp) menus_init (gimp); -#ifdef DISPLAY_FILTERS color_display_init (); -#endif /* DISPLAY_FILTERS */ render_setup (gimprc.transparency_type, gimprc.transparency_size); diff --git a/app/gui/menus.c b/app/gui/menus.c index 4df734edaf..9a20c41a8f 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -215,12 +215,6 @@ static GimpItemFactoryEntry toolbox_entries[] = dialogs_create_dockable_cmd_callback, 0 }, "gimp:error-console", "file/dialogs/error_console.html", NULL }, -#ifdef DISPLAY_FILTERS - { { N_("/File/Dialogs/Display Filters..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:display-filters-dialog", - "file/dialogs/display_filters/display_filters.html", NULL }, -#endif /* DISPLAY_FILTERS */ SEPARATOR ("/File/---"), @@ -551,6 +545,10 @@ static GimpItemFactoryEntry image_entries[] = "", GIMP_STOCK_TOOL_MOVE }, NULL, "view/dialogs/navigation_window.html", NULL }, + { { N_("/View/Display Filters..."), NULL, + dialogs_create_toplevel_cmd_callback, 0 }, + "gimp:display-filters-dialog", + "dialogs/display_filters/display_filters.html", NULL }, SEPARATOR ("/View/---"), @@ -650,7 +648,12 @@ static GimpItemFactoryEntry image_entries[] = SEPARATOR ("/Image/---"), - /* /Layer */ + { { N_("/Image/Undo History..."), NULL, + dialogs_create_toplevel_cmd_callback, 0 }, + "gimp:undo-history-dialog", + "dialogs/undo_history.html", NULL }, + + /* /Layer */ /* /Layer/Stack */ @@ -880,16 +883,6 @@ static GimpItemFactoryEntry image_entries[] = dialogs_create_dockable_cmd_callback, 0 }, "gimp:error-console", "dialogs/error_console.html", NULL }, -#ifdef DISPLAY_FILTERS - { { N_("/Dialogs/Display Filters..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:display-filters-dialogs", - "dialogs/display_filters/display_filters.html", NULL }, -#endif /* DISPLAY_FILTERS */ - { { N_("/Dialogs/Undo History..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:undo-history-dialog", - "dialogs/undo_history.html", NULL }, SEPARATOR ("/---"), diff --git a/app/menus/menus.c b/app/menus/menus.c index 4df734edaf..9a20c41a8f 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -215,12 +215,6 @@ static GimpItemFactoryEntry toolbox_entries[] = dialogs_create_dockable_cmd_callback, 0 }, "gimp:error-console", "file/dialogs/error_console.html", NULL }, -#ifdef DISPLAY_FILTERS - { { N_("/File/Dialogs/Display Filters..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:display-filters-dialog", - "file/dialogs/display_filters/display_filters.html", NULL }, -#endif /* DISPLAY_FILTERS */ SEPARATOR ("/File/---"), @@ -551,6 +545,10 @@ static GimpItemFactoryEntry image_entries[] = "", GIMP_STOCK_TOOL_MOVE }, NULL, "view/dialogs/navigation_window.html", NULL }, + { { N_("/View/Display Filters..."), NULL, + dialogs_create_toplevel_cmd_callback, 0 }, + "gimp:display-filters-dialog", + "dialogs/display_filters/display_filters.html", NULL }, SEPARATOR ("/View/---"), @@ -650,7 +648,12 @@ static GimpItemFactoryEntry image_entries[] = SEPARATOR ("/Image/---"), - /* /Layer */ + { { N_("/Image/Undo History..."), NULL, + dialogs_create_toplevel_cmd_callback, 0 }, + "gimp:undo-history-dialog", + "dialogs/undo_history.html", NULL }, + + /* /Layer */ /* /Layer/Stack */ @@ -880,16 +883,6 @@ static GimpItemFactoryEntry image_entries[] = dialogs_create_dockable_cmd_callback, 0 }, "gimp:error-console", "dialogs/error_console.html", NULL }, -#ifdef DISPLAY_FILTERS - { { N_("/Dialogs/Display Filters..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:display-filters-dialogs", - "dialogs/display_filters/display_filters.html", NULL }, -#endif /* DISPLAY_FILTERS */ - { { N_("/Dialogs/Undo History..."), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp:undo-history-dialog", - "dialogs/undo_history.html", NULL }, SEPARATOR ("/---"), diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index 8ed64c0f9d..d826c26549 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -133,15 +133,19 @@ gimp_selection_tool_modifier_key (GimpTool *tool, { if (press) { - if (key == state) /* first modifier pressed */ + if (key == (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))) { + /* first modifier pressed */ + selection_tool->saved_op = sel_options->op; } } else { - if (! state) /* last modifier released */ + if (! (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))) { + /* last modifier released */ + button_op = selection_tool->saved_op; } } diff --git a/app/undo_history.c b/app/undo_history.c index 5ccdc7d055..aa0a9164ba 100644 --- a/app/undo_history.c +++ b/app/undo_history.c @@ -810,7 +810,7 @@ undo_history_new (GimpImage *gimage) g_signal_connect (G_OBJECT (gimage), "name_changed", G_CALLBACK (undo_history_gimage_rename_callback), st); - g_signal_connect (G_OBJECT (gimage), "destroy", + g_signal_connect (G_OBJECT (gimage), "disconnect", G_CALLBACK (undo_history_gimage_destroy_callback), st); g_signal_connect (G_OBJECT (gimage), "clean", diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c index a7c67bc567..d164cfcccd 100644 --- a/app/widgets/gimpcolordisplayeditor.c +++ b/app/widgets/gimpcolordisplayeditor.c @@ -18,19 +18,23 @@ #include "config.h" +#ifdef __GNUC__ +#warning GTK_DISABLE_DEPRECATED +#endif +#undef GTK_DISABLE_DEPRECATED #include -#include "libgimpbase/gimpbsse.h" +#include "libgimpbase/gimpbase.h" +#include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "display-types.h" -#include "color_area.h" -#include "dialog_handler.h" -#include "gdisplay.h" -#include "gdisplay_color.h" -#include "gdisplay_color_ui.h" -#include "gimpimageP.h" -#include "gimpui.h" +#include "core/gimpimage.h" + +#include "gimpdisplay.h" +#include "gimpdisplayshell.h" +#include "gimpdisplayshell-filter.h" +#include "gimpdisplayshell-filter-dialog.h" #include "libgimp/gimpintl.h" @@ -39,9 +43,9 @@ typedef struct _ColorDisplayDialog ColorDisplayDialog; struct _ColorDisplayDialog { - GimpDisplay *gdisp; + GimpDisplayShell *shell; - GtkWidget *shell; + GtkWidget *dialog; GtkWidget *src; GtkWidget *dest; @@ -124,12 +128,10 @@ static void color_display_update_up_and_down(ColorDisplayDialog *cdd); #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); \ - } \ +#define UPDATE_DISPLAY(shell) G_STMT_START \ +{ \ + gimp_display_shell_expose_full (shell); \ + gimp_display_shell_flush (shell); \ } G_STMT_END static void @@ -138,8 +140,8 @@ make_dialog (ColorDisplayDialog *cdd) GtkWidget *hbox; GtkWidget *scrolled_win; GtkWidget *vbbox; - gchar *titles[2]; - gint i; + gchar *titles[2]; + gint i; static ButtonInfo buttons[] = { @@ -150,7 +152,7 @@ make_dialog (ColorDisplayDialog *cdd) { N_("Configure"), color_display_configure_callback } }; - cdd->shell = gimp_dialog_new (_("Color Display Filters"), "display_color", + cdd->dialog = gimp_dialog_new (_("Color Display Filters"), "display_color", gimp_standard_help_func, "dialogs/display_filters/display_filters.html", GTK_WIN_POS_NONE, @@ -164,10 +166,8 @@ make_dialog (ColorDisplayDialog *cdd) NULL); - dialog_register (cdd->shell); - 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->dialog)->vbox), hbox, TRUE, TRUE, 4); scrolled_win = gtk_scrolled_window_new (NULL, NULL); @@ -236,29 +236,24 @@ static void color_display_ok_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; - GList *list; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; + GList *list; - dialog_unregister(cdd->shell); - gtk_widget_destroy (GTK_WIDGET (cdd->shell)); - gdisp->cd_ui = NULL; + gtk_widget_destroy (GTK_WIDGET (cdd->dialog)); + shell->cd_ui = NULL; if (cdd->modified) { - list = cdd->old_nodes; - - while (list) + for (list = cdd->old_nodes; list; list = g_list_next (list)) { - if (!g_list_find (gdisp->cd_list, list->data)) - gdisplay_color_detach_destroy (gdisp, list->data); - - list = list->next; + if (! g_list_find (shell->cd_list, list->data)) + gimp_display_shell_filter_detach_destroy (shell, list->data); } g_list_free (cdd->old_nodes); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } } @@ -266,38 +261,37 @@ static void color_display_cancel_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; GList *list; GList *next; - dialog_unregister(cdd->shell); - gtk_widget_destroy (GTK_WIDGET (cdd->shell)); - gdisp->cd_ui = NULL; + gtk_widget_destroy (GTK_WIDGET (cdd->dialog)); + shell->cd_ui = NULL; if (cdd->modified) { - list = gdisp->cd_list; - gdisp->cd_list = cdd->old_nodes; + list = shell->cd_list; + shell->cd_list = cdd->old_nodes; while (list) { next = list->next; - if (!g_list_find (cdd->old_nodes, list->data)) - gdisplay_color_detach_destroy (gdisp, list->data); + if (! g_list_find (cdd->old_nodes, list->data)) + gimp_display_shell_filter_detach_destroy (shell, list->data); list = next; } - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } } static void color_display_update_up_and_down (ColorDisplayDialog *cdd) { - gtk_widget_set_sensitive (cdd->buttons[BUTTON_UP], cdd->dest_row > 0); + gtk_widget_set_sensitive (cdd->buttons[BUTTON_UP], cdd->dest_row > 0); gtk_widget_set_sensitive (cdd->buttons[BUTTON_DOWN], cdd->dest_row >= 0 && cdd->dest_row < GTK_CLIST (cdd->dest)->rows - 1); } @@ -306,11 +300,11 @@ static void color_display_add_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; - gchar *name = NULL; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; + gchar *name = NULL; ColorDisplayNode *node; - gint row; + gint row; if (cdd->src_row < 0) return; @@ -322,22 +316,22 @@ color_display_add_callback (GtkWidget *widget, cdd->modified = TRUE; - node = gdisplay_color_attach (gdisp, name); + node = gimp_display_shell_filter_attach (shell, name); row = gtk_clist_append (GTK_CLIST (cdd->dest), &name); gtk_clist_set_row_data (GTK_CLIST (cdd->dest), row, node); - + color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_remove_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -349,23 +343,23 @@ color_display_remove_callback (GtkWidget *widget, cdd->modified = TRUE; if (g_list_find (cdd->old_nodes, node)) - gdisplay_color_detach (gdisp, node); + gimp_display_shell_filter_detach (shell, node); else - gdisplay_color_detach_destroy (gdisp, node); + gimp_display_shell_filter_detach_destroy (shell, node); cdd->dest_row = -1; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_up_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 1) @@ -374,22 +368,22 @@ color_display_up_callback (GtkWidget *widget, 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); - gdisplay_color_reorder_up (gdisp, node); + gimp_display_shell_filter_reorder_up (shell, node); cdd->modified = TRUE; cdd->dest_row--; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_down_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -401,22 +395,22 @@ color_display_down_callback (GtkWidget *widget, 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); - gdisplay_color_reorder_down (gdisp, node); + gimp_display_shell_filter_reorder_down (shell, node); cdd->modified = TRUE; cdd->dest_row++; color_display_update_up_and_down (cdd); - UPDATE_DISPLAY (gdisp); + UPDATE_DISPLAY (shell); } static void color_display_configure_callback (GtkWidget *widget, gpointer data) { - ColorDisplayDialog *cdd = data; - GimpDisplay *gdisp = cdd->gdisp; + ColorDisplayDialog *cdd = data; + GimpDisplayShell *shell = cdd->shell; ColorDisplayNode *node; if (cdd->dest_row < 0) @@ -424,17 +418,18 @@ color_display_configure_callback (GtkWidget *widget, node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row); - if (!g_list_find (cdd->conf_nodes, node)) + if (! g_list_find (cdd->conf_nodes, node)) cdd->conf_nodes = g_list_append (cdd->conf_nodes, node); - - gdisplay_color_configure (node, NULL, NULL, NULL, NULL); + + gimp_display_shell_filter_configure (node, NULL, NULL, NULL, NULL); cdd->modified = TRUE; - UPDATE_DISPLAY (gdisp); + + UPDATE_DISPLAY (shell); } void -gdisplay_color_ui_new (GimpDisplay *gdisp) +gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell) { ColorDisplayDialog *cdd; @@ -447,16 +442,16 @@ gdisplay_color_ui_new (GimpDisplay *gdisp) color_display_foreach (src_list_populate, cdd->src); - cdd->old_nodes = gdisp->cd_list; - dest_list_populate (gdisp->cd_list, cdd->dest); - gdisp->cd_list = g_list_copy (cdd->old_nodes); + cdd->old_nodes = shell->cd_list; + dest_list_populate (shell->cd_list, cdd->dest); + shell->cd_list = g_list_copy (cdd->old_nodes); - cdd->gdisp = gdisp; + cdd->shell = shell; cdd->src_row = -1; cdd->dest_row = -1; - gdisp->cd_ui = cdd->shell; + shell->cd_ui = cdd->dialog; } static void @@ -471,7 +466,7 @@ dest_list_populate (GList *node_list, GtkWidget *dest) { ColorDisplayNode *node; - int row; + int row; while (node_list) { @@ -492,7 +487,9 @@ select_src (GtkWidget *widget, gpointer data) { ColorDisplayDialog *cdd = data; + cdd->src_row = row; + gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], TRUE); } @@ -504,7 +501,9 @@ unselect_src (GtkWidget *widget, gpointer data) { ColorDisplayDialog *cdd = data; + cdd->src_row = -1; + gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], FALSE); } diff --git a/modules/Makefile.am b/modules/Makefile.am index fa6cd0edf8..d1935d16fc 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -24,7 +24,10 @@ EXTRA_DIST = \ libexec_LTLIBRARIES = @STRIP_BEGIN@ \ libcolorsel_triangle.la \ + libcdisplay_gamma.la \ + libcdisplay_highcontrast.la \ @STRIP_END@ + ## libcolorsel_gtk.la \ ## libcolorsel_water.la \ @@ -42,10 +45,10 @@ libcolorsel_triangle_la_LIBADD = $(GTK_LIBS) ## libcolorsel_water_la_LDFLAGS = -avoid-version -module ## libcolorsel_water_la_LIBADD = $(GTK_LIBS) -## libcdisplay_gamma_la_SOURCES = cdisplay_gamma.c -## libcdisplay_gamma_la_LDFLAGS = -avoid-version -module -## libcdisplay_gamma_la_LIBADD = $(GTK_LIBS) +libcdisplay_gamma_la_SOURCES = cdisplay_gamma.c +libcdisplay_gamma_la_LDFLAGS = -avoid-version -module +libcdisplay_gamma_la_LIBADD = $(GTK_LIBS) -## libcdisplay_highcontrast_la_SOURCES = cdisplay_highcontrast.c -## libcdisplay_highcontrast_la_LDFLAGS = -avoid-version -module -## libcdisplay_highcontrast_la_LIBADD = $(GTK_LIBS) +libcdisplay_highcontrast_la_SOURCES = cdisplay_highcontrast.c +libcdisplay_highcontrast_la_LDFLAGS = -avoid-version -module +libcdisplay_highcontrast_la_LIBADD = $(GTK_LIBS) diff --git a/modules/cdisplay_gamma.c b/modules/cdisplay_gamma.c index 8331811f7f..6a1bec32bd 100644 --- a/modules/cdisplay_gamma.c +++ b/modules/cdisplay_gamma.c @@ -21,16 +21,14 @@ #include -#include "app/dialog_handler.h" +#include "libgimpbase/gimpbase.h" +#include "libgimpmath/gimpmath.h" +#include "libgimp/gimpmodule.h" +#include "libgimp/gimpcolordisplay.h" +#include "libgimpwidgets/gimpwidgets.h" #include "gimpmodregister.h" -#include -#include -#include -#include -#include - #include "libgimp/gimpintl.h" @@ -185,7 +183,9 @@ gamma_destroy (gpointer cd_ID) if (context->shell) { +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (context->shell); } @@ -280,7 +280,10 @@ gamma_configure_ok_callback (GtkWidget *widget, gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner)); gamma_create_lookup_table (context); +#if 0 dialog_unregister (context->shell); +#endif + gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -294,7 +297,10 @@ gamma_configure_cancel_callback (GtkWidget *widget, { GammaContext *context = data; +#if 0 dialog_unregister (context->shell); +#endif + gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -335,7 +341,9 @@ gamma_configure (gpointer cd_ID, NULL); +#if 0 dialog_register (context->shell); +#endif hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); @@ -363,7 +371,9 @@ gamma_configure_cancel (gpointer cd_ID) if (context->shell) { +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (context->shell); context->shell = NULL; } diff --git a/modules/cdisplay_highcontrast.c b/modules/cdisplay_highcontrast.c index 581a13a7d6..d59e948ae2 100644 --- a/modules/cdisplay_highcontrast.c +++ b/modules/cdisplay_highcontrast.c @@ -15,22 +15,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include "config.h" #include #include -#include "app/dialog_handler.h" +#include "libgimpbase/gimpbase.h" +#include "libgimpmath/gimpmath.h" +#include "libgimp/gimpmodule.h" +#include "libgimp/gimpcolordisplay.h" +#include "libgimpwidgets/gimpwidgets.h" #include "gimpmodregister.h" -#include -#include -#include -#include -#include - #include "libgimp/gimpintl.h" @@ -179,7 +178,9 @@ contrast_destroy (gpointer cd_ID) if (context->shell) { +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (context->shell); } @@ -273,7 +274,9 @@ contrast_configure_ok_callback (GtkWidget *widget, context->contrast = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner)); contrast_create_lookup_table (context); +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -287,7 +290,9 @@ contrast_configure_cancel_callback (GtkWidget *widget, { ContrastContext *context = data; +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -328,7 +333,9 @@ contrast_configure (gpointer cd_ID, NULL); +#if 0 dialog_register (context->shell); +#endif hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); @@ -356,7 +363,9 @@ contrast_configure_cancel (gpointer cd_ID) if (context->shell) { +#if 0 dialog_unregister (context->shell); +#endif gtk_widget_destroy (context->shell); context->shell = NULL; }