1999-08-31 11:41:55 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1999 Manish Singh
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2000-02-01 07:59:05 +08:00
|
|
|
#include "config.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning GTK_DISABLE_DEPRECATED
|
|
|
|
#endif
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
2000-05-05 21:29:46 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "display-types.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
#include "widgets/gimpeditor.h"
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "gimpdisplay.h"
|
|
|
|
#include "gimpdisplayshell.h"
|
|
|
|
#include "gimpdisplayshell-filter.h"
|
|
|
|
#include "gimpdisplayshell-filter-dialog.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
#define LIST_WIDTH 150
|
|
|
|
#define LIST_HEIGHT 100
|
|
|
|
|
|
|
|
#define UPDATE_DISPLAY(shell) G_STMT_START \
|
|
|
|
{ \
|
|
|
|
gimp_display_shell_expose_full (shell); \
|
|
|
|
gimp_display_shell_flush (shell); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
typedef struct _ColorDisplayDialog ColorDisplayDialog;
|
|
|
|
|
|
|
|
struct _ColorDisplayDialog
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
GimpDisplayShell *shell;
|
2000-01-03 15:49:19 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
GtkWidget *dialog;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
GtkWidget *src;
|
|
|
|
GtkWidget *dest;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
gint src_row;
|
|
|
|
gint dest_row;
|
|
|
|
|
|
|
|
gboolean modified;
|
|
|
|
|
|
|
|
GList *old_nodes;
|
2000-01-03 15:49:19 +08:00
|
|
|
GList *conf_nodes;
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
GtkWidget *add_button;
|
|
|
|
GtkWidget *remove_button;
|
|
|
|
GtkWidget *up_button;
|
|
|
|
GtkWidget *down_button;
|
|
|
|
GtkWidget *configure_button;
|
2000-11-26 20:13:23 +08:00
|
|
|
};
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
static void make_dialog (ColorDisplayDialog *cdd);
|
|
|
|
|
|
|
|
static void color_display_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_cancel_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_add_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_remove_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_up_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_down_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void color_display_configure_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
static void src_list_populate (const char *name,
|
|
|
|
gpointer data);
|
|
|
|
static void dest_list_populate (GList *node_list,
|
|
|
|
GtkWidget *dest);
|
|
|
|
|
|
|
|
static void select_src (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
|
|
|
static void unselect_src (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
|
|
|
static void select_dest (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
|
|
|
static void unselect_dest (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
static void color_display_update_up_and_down (ColorDisplayDialog *cdd);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
static void
|
2000-01-03 15:49:19 +08:00
|
|
|
make_dialog (ColorDisplayDialog *cdd)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
2002-03-15 23:09:58 +08:00
|
|
|
GtkWidget *editor;
|
1999-09-01 01:53:26 +08:00
|
|
|
GtkWidget *scrolled_win;
|
2002-03-15 23:09:58 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *image;
|
2002-03-15 06:42:50 +08:00
|
|
|
gchar *titles[2];
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
cdd->dialog = gimp_dialog_new (_("Color Display Filters"), "display_filters",
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/display_filters/display_filters.html",
|
|
|
|
GTK_WIN_POS_NONE,
|
|
|
|
FALSE, TRUE, FALSE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
GTK_STOCK_CANCEL, color_display_cancel_callback,
|
|
|
|
cdd, NULL, NULL, FALSE, TRUE,
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
GTK_STOCK_OK, color_display_ok_callback,
|
|
|
|
cdd, NULL, NULL, TRUE, FALSE,
|
2001-11-24 07:04:49 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
NULL);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
2002-03-15 06:42:50 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->dialog)->vbox), hbox,
|
2002-03-15 23:09:58 +08:00
|
|
|
TRUE, TRUE, 0);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (scrolled_win);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
titles[0] = _("Available Filters");
|
|
|
|
titles[1] = NULL;
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->src = gtk_clist_new_with_titles (1, titles);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_size_request (cdd->src, LIST_WIDTH, LIST_HEIGHT);
|
2000-01-03 15:49:19 +08:00
|
|
|
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);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (cdd->src);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
g_signal_connect (G_OBJECT (cdd->src), "select_row",
|
|
|
|
G_CALLBACK (select_src),
|
|
|
|
cdd);
|
|
|
|
g_signal_connect (G_OBJECT (cdd->src), "unselect_row",
|
|
|
|
G_CALLBACK (unselect_src),
|
|
|
|
cdd);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
cdd->add_button = gtk_button_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), cdd->add_button, FALSE, FALSE, 16);
|
|
|
|
gtk_widget_set_sensitive (cdd->add_button, FALSE);
|
|
|
|
gtk_widget_show (cdd->add_button);
|
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_container_add (GTK_CONTAINER (cdd->add_button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (cdd->add_button,
|
|
|
|
_("Add the selected filter to the list of "
|
|
|
|
"active filters."), NULL);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (cdd->add_button), "clicked",
|
|
|
|
G_CALLBACK (color_display_add_callback),
|
|
|
|
cdd);
|
|
|
|
|
|
|
|
cdd->remove_button = gtk_button_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), cdd->remove_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_set_sensitive (cdd->remove_button, FALSE);
|
|
|
|
gtk_widget_show (cdd->remove_button);
|
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_container_add (GTK_CONTAINER (cdd->remove_button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (cdd->remove_button,
|
|
|
|
_("Remove the selected filter from the list of "
|
|
|
|
"active filters."), NULL);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (cdd->remove_button), "clicked",
|
|
|
|
G_CALLBACK (color_display_remove_callback),
|
|
|
|
cdd);
|
|
|
|
|
|
|
|
editor = gimp_editor_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), editor, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (editor);
|
|
|
|
|
|
|
|
cdd->up_button =
|
|
|
|
gimp_editor_add_button (GIMP_EDITOR (editor),
|
|
|
|
GTK_STOCK_GO_UP,
|
|
|
|
_("Move the selected filter up"),
|
|
|
|
NULL,
|
|
|
|
G_CALLBACK (color_display_up_callback),
|
|
|
|
NULL,
|
|
|
|
cdd);
|
|
|
|
|
|
|
|
cdd->down_button =
|
|
|
|
gimp_editor_add_button (GIMP_EDITOR (editor),
|
|
|
|
GTK_STOCK_GO_DOWN,
|
|
|
|
_("Move the selected filter down"),
|
|
|
|
NULL,
|
|
|
|
G_CALLBACK (color_display_down_callback),
|
|
|
|
NULL,
|
|
|
|
cdd);
|
|
|
|
|
|
|
|
cdd->configure_button =
|
|
|
|
gimp_editor_add_button (GIMP_EDITOR (editor),
|
|
|
|
GIMP_STOCK_EDIT,
|
|
|
|
_("Configure the selected filter"),
|
|
|
|
NULL,
|
|
|
|
G_CALLBACK (color_display_configure_callback),
|
|
|
|
NULL,
|
|
|
|
cdd);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (cdd->up_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (cdd->down_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (cdd->configure_button, FALSE);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (editor), scrolled_win);
|
|
|
|
gtk_widget_show (scrolled_win);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
titles[0] = _("Active Filters");
|
|
|
|
titles[1] = NULL;
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->dest = gtk_clist_new_with_titles (1, titles);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_size_request (cdd->dest, LIST_WIDTH, LIST_HEIGHT);
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_clist_column_titles_passive (GTK_CLIST (cdd->dest));
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd->dest);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (cdd->dest);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
g_signal_connect (G_OBJECT (cdd->dest), "select_row",
|
|
|
|
G_CALLBACK (select_dest),
|
|
|
|
cdd);
|
|
|
|
g_signal_connect (G_OBJECT (cdd->dest), "unselect_row",
|
|
|
|
G_CALLBACK (unselect_dest),
|
|
|
|
cdd);
|
2000-01-02 08:16:47 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (hbox);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
|
|
|
GList *list;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (cdd->dialog));
|
2002-03-15 23:09:58 +08:00
|
|
|
shell->filters_dialog = NULL;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (cdd->modified)
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
for (list = cdd->old_nodes; list; list = g_list_next (list))
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
2002-03-15 23:09:58 +08:00
|
|
|
if (! g_list_find (shell->filters, list->data))
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_detach_destroy (shell, list->data);
|
1999-10-05 03:26:07 +08:00
|
|
|
}
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
g_list_free (cdd->old_nodes);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-12-23 21:33:43 +08:00
|
|
|
}
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_cancel_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
1999-10-05 03:26:07 +08:00
|
|
|
GList *list;
|
1999-11-06 11:03:26 +08:00
|
|
|
GList *next;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (cdd->dialog));
|
2002-03-15 23:09:58 +08:00
|
|
|
shell->filters_dialog = NULL;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (cdd->modified)
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
2002-03-15 23:09:58 +08:00
|
|
|
list = shell->filters;
|
|
|
|
shell->filters = cdd->old_nodes;
|
1999-09-01 01:53:26 +08:00
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
while (list)
|
|
|
|
{
|
1999-11-06 11:03:26 +08:00
|
|
|
next = list->next;
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
if (! g_list_find (cdd->old_nodes, list->data))
|
|
|
|
gimp_display_shell_filter_detach_destroy (shell, list->data);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
1999-11-06 11:03:26 +08:00
|
|
|
list = next;
|
1999-10-05 03:26:07 +08:00
|
|
|
}
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-12-23 21:33:43 +08:00
|
|
|
}
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
static void
|
|
|
|
color_display_update_up_and_down (ColorDisplayDialog *cdd)
|
|
|
|
{
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->up_button, cdd->dest_row > 0);
|
|
|
|
gtk_widget_set_sensitive (cdd->down_button,
|
|
|
|
cdd->dest_row >= 0 &&
|
|
|
|
cdd->dest_row < GTK_CLIST (cdd->dest)->rows - 1);
|
2000-11-26 20:13:23 +08:00
|
|
|
}
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
static void
|
|
|
|
color_display_add_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
|
|
|
gchar *name = NULL;
|
2000-11-22 04:54:53 +08:00
|
|
|
ColorDisplayNode *node;
|
2002-03-15 06:42:50 +08:00
|
|
|
gint row;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (cdd->src_row < 0)
|
1999-10-05 10:16:59 +08:00
|
|
|
return;
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_clist_get_text (GTK_CLIST (cdd->src), cdd->src_row, 0, &name);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
1999-10-05 10:16:59 +08:00
|
|
|
if (!name)
|
|
|
|
return;
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->modified = TRUE;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
node = gimp_display_shell_filter_attach (shell, name);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
row = gtk_clist_append (GTK_CLIST (cdd->dest), &name);
|
|
|
|
gtk_clist_set_row_data (GTK_CLIST (cdd->dest), row, node);
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
color_display_update_up_and_down (cdd);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_remove_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
2000-11-22 04:54:53 +08:00
|
|
|
ColorDisplayNode *node;
|
1999-10-05 10:16:59 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (cdd->dest_row < 0)
|
1999-10-05 10:16:59 +08:00
|
|
|
return;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
|
|
|
gtk_clist_remove (GTK_CLIST (cdd->dest), cdd->dest_row);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->modified = TRUE;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (g_list_find (cdd->old_nodes, node))
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_detach (shell, node);
|
1999-10-05 03:26:07 +08:00
|
|
|
else
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_detach_destroy (shell, node);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-11-22 04:54:53 +08:00
|
|
|
cdd->dest_row = -1;
|
2000-11-26 20:13:23 +08:00
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_up_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
2000-11-22 04:54:53 +08:00
|
|
|
ColorDisplayNode *node;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
if (cdd->dest_row < 1)
|
1999-10-05 10:16:59 +08:00
|
|
|
return;
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
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);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_reorder_up (shell, node);
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->modified = TRUE;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->dest_row--;
|
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_down_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
2000-11-22 04:54:53 +08:00
|
|
|
ColorDisplayNode *node;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (cdd->dest_row < 0)
|
1999-10-05 10:16:59 +08:00
|
|
|
return;
|
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
if (cdd->dest_row >= GTK_CLIST (cdd->dest)->rows -1)
|
|
|
|
return;
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
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);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_reorder_down (shell, node);
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->modified = TRUE;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->dest_row++;
|
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
UPDATE_DISPLAY (shell);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_configure_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2002-03-15 06:42:50 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
GimpDisplayShell *shell = cdd->shell;
|
2000-11-22 04:54:53 +08:00
|
|
|
ColorDisplayNode *node;
|
2000-01-03 15:49:19 +08:00
|
|
|
|
|
|
|
if (cdd->dest_row < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
if (! g_list_find (cdd->conf_nodes, node))
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->conf_nodes = g_list_append (cdd->conf_nodes, node);
|
2002-03-15 06:42:50 +08:00
|
|
|
|
|
|
|
gimp_display_shell_filter_configure (node, NULL, NULL, NULL, NULL);
|
2000-11-22 04:54:53 +08:00
|
|
|
|
|
|
|
cdd->modified = TRUE;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
|
|
|
UPDATE_DISPLAY (shell);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
1999-08-31 11:41:55 +08:00
|
|
|
|
|
|
|
void
|
2002-03-15 06:42:50 +08:00
|
|
|
gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd;
|
|
|
|
|
|
|
|
cdd = g_new0 (ColorDisplayDialog, 1);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
make_dialog (cdd);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_clist_clear (GTK_CLIST (cdd->src));
|
|
|
|
gtk_clist_clear (GTK_CLIST (cdd->dest));
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
color_display_foreach (src_list_populate, cdd->src);
|
2000-01-02 08:16:47 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
cdd->old_nodes = shell->filters;
|
|
|
|
dest_list_populate (shell->filters, cdd->dest);
|
|
|
|
shell->filters = g_list_copy (cdd->old_nodes);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
cdd->shell = shell;
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->src_row = -1;
|
|
|
|
cdd->dest_row = -1;
|
1999-10-05 10:16:59 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
shell->filters_dialog = cdd->dialog;
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
src_list_populate (const char *name,
|
1999-10-05 03:26:07 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gtk_clist_append (GTK_CLIST (data), (gchar **) &name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-03 15:49:19 +08:00
|
|
|
dest_list_populate (GList *node_list,
|
|
|
|
GtkWidget *dest)
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
|
|
|
ColorDisplayNode *node;
|
2002-03-15 06:42:50 +08:00
|
|
|
int row;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
while (node_list)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
node = node_list->data;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
row = gtk_clist_append (GTK_CLIST (dest), &node->cd_name);
|
|
|
|
gtk_clist_set_row_data (GTK_CLIST (dest), row, node);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
node_list = node_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
select_src (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->src_row = row;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->add_button, TRUE);
|
2000-11-26 20:13:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unselect_src (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorDisplayDialog *cdd = data;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->src_row = -1;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->add_button, FALSE);
|
1999-10-05 03:26:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
select_dest (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
1999-08-31 11:41:55 +08:00
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-26 20:13:23 +08:00
|
|
|
|
|
|
|
cdd->dest_row = row;
|
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->remove_button, TRUE);
|
|
|
|
gtk_widget_set_sensitive (cdd->configure_button, TRUE);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unselect_dest (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
|
|
|
|
cdd->dest_row = -1;
|
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->remove_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (cdd->configure_button, FALSE);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
1999-08-31 11:41:55 +08:00
|
|
|
}
|
2000-11-26 20:13:23 +08:00
|
|
|
|