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
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "apptypes.h"
|
2000-01-02 08:16:47 +08:00
|
|
|
#include "color_area.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
#include "dialog_handler.h"
|
1999-09-01 01:53:26 +08:00
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gdisplay_color.h"
|
|
|
|
#include "gdisplay_color_ui.h"
|
|
|
|
#include "gimpimageP.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimpui.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
|
2000-05-27 09:30:21 +08:00
|
|
|
#include "libgimp/gimpparasite.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
|
|
|
|
|
|
|
typedef struct _ColorDisplayDialog ColorDisplayDialog;
|
|
|
|
|
|
|
|
struct _ColorDisplayDialog
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
GDisplay *gdisp;
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
GtkWidget *shell;
|
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
|
|
|
|
|
|
|
GtkWidget *buttons[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
BUTTON_ADD,
|
|
|
|
BUTTON_REMOVE,
|
|
|
|
BUTTON_UP,
|
|
|
|
BUTTON_DOWN,
|
|
|
|
BUTTON_CONFIGURE
|
1999-09-01 01:53:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*ButtonCallback) (GtkWidget *, gpointer);
|
|
|
|
|
|
|
|
typedef struct _ButtonInfo ButtonInfo;
|
|
|
|
|
|
|
|
struct _ButtonInfo
|
|
|
|
{
|
|
|
|
const gchar *label;
|
|
|
|
ButtonCallback callback;
|
|
|
|
};
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
static void make_dialog (ColorDisplayDialog *cdd);
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
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);
|
2000-01-03 15:49:19 +08:00
|
|
|
static void dest_list_populate (GList *node_list,
|
|
|
|
GtkWidget *dest);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
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-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
#define LIST_WIDTH 180
|
|
|
|
#define LIST_HEIGHT 180
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
#define UPDATE_DISPLAY(gdisp) G_STMT_START { \
|
|
|
|
if (gdisp != color_area_gdisp) \
|
|
|
|
{ \
|
|
|
|
gdisplay_expose_full (gdisp); \
|
|
|
|
gdisplay_flush (gdisp); \
|
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
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;
|
|
|
|
GtkWidget *scrolled_win;
|
|
|
|
GtkWidget *vbbox;
|
2000-05-05 21:29:46 +08:00
|
|
|
gchar *titles[2];
|
|
|
|
gint i;
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
static ButtonInfo buttons[] =
|
|
|
|
{
|
1999-12-23 21:33:43 +08:00
|
|
|
{ N_("Add"), color_display_add_callback },
|
|
|
|
{ N_("Remove"), color_display_remove_callback },
|
|
|
|
{ N_("Up"), color_display_up_callback },
|
|
|
|
{ N_("Down"), color_display_down_callback },
|
1999-09-01 01:53:26 +08:00
|
|
|
{ N_("Configure"), color_display_configure_callback }
|
|
|
|
};
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
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,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
_("OK"), color_display_ok_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
cdd, NULL, NULL, TRUE, FALSE,
|
2000-01-03 15:49:19 +08:00
|
|
|
_("Cancel"), color_display_cancel_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
cdd, NULL, NULL, FALSE, TRUE,
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
NULL);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-05-05 21:29:46 +08:00
|
|
|
dialog_register (cdd->shell);
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
|
1999-09-01 01:53:26 +08:00
|
|
|
TRUE, TRUE, 4);
|
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
|
|
|
|
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);
|
|
|
|
|
|
|
|
titles[0] = _("Available Filters");
|
|
|
|
titles[1] = NULL;
|
2000-01-03 15:49:19 +08:00
|
|
|
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);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cdd->src), "select_row",
|
1999-10-05 03:26:07 +08:00
|
|
|
GTK_SIGNAL_FUNC (select_src),
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd);
|
2000-11-26 20:13:23 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cdd->src), "unselect_row",
|
|
|
|
GTK_SIGNAL_FUNC (unselect_src),
|
|
|
|
cdd);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
vbbox = gtk_vbutton_box_new ();
|
|
|
|
gtk_vbutton_box_set_layout_default (GTK_BUTTONBOX_START);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbbox, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
|
|
|
|
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);
|
|
|
|
|
|
|
|
titles[0] = _("Active Filters");
|
|
|
|
titles[1] = NULL;
|
2000-01-03 15:49:19 +08:00
|
|
|
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);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cdd->dest), "select_row",
|
1999-10-05 03:26:07 +08:00
|
|
|
GTK_SIGNAL_FUNC (select_dest),
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd);
|
2000-11-26 20:13:23 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cdd->dest), "unselect_row",
|
|
|
|
GTK_SIGNAL_FUNC (unselect_dest),
|
|
|
|
cdd);
|
2000-01-02 08:16:47 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->buttons[i] =
|
|
|
|
gtk_button_new_with_label (gettext (buttons[i].label));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbbox), cdd->buttons[i], FALSE, FALSE, 0);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cdd->buttons[i]), "clicked",
|
1999-09-01 01:53:26 +08:00
|
|
|
GTK_SIGNAL_FUNC (buttons[i].callback),
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd);
|
2000-11-26 20:13:23 +08:00
|
|
|
gtk_widget_set_sensitive (cdd->buttons[i], FALSE);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show_all (hbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
1999-10-05 03:26:07 +08:00
|
|
|
GList *list;
|
|
|
|
|
2000-09-15 18:04:35 +08:00
|
|
|
dialog_unregister(cdd->shell);
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
|
|
|
|
gdisp->cd_ui = 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
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
list = cdd->old_nodes;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
while (list)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
if (!g_list_find (gdisp->cd_list, list->data))
|
|
|
|
gdisplay_color_detach_destroy (gdisp, list->data);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
g_list_free (cdd->old_nodes);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
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)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
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
|
|
|
|
2000-09-15 18:04:35 +08:00
|
|
|
dialog_unregister(cdd->shell);
|
2000-01-03 15:49:19 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
|
|
|
|
gdisp->cd_ui = 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
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
list = gdisp->cd_list;
|
|
|
|
gdisp->cd_list = 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;
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
if (!g_list_find (cdd->old_nodes, list->data))
|
|
|
|
gdisplay_color_detach_destroy (gdisp, 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
|
|
|
}
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
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)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
static void
|
|
|
|
color_display_add_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
|
|
|
gchar *name = NULL;
|
|
|
|
ColorDisplayNode *node;
|
1999-10-05 03:26:07 +08:00
|
|
|
gint row;
|
|
|
|
|
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
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
node = gdisplay_color_attach (gdisp, 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);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_remove_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
|
|
|
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))
|
|
|
|
gdisplay_color_detach (gdisp, node);
|
1999-10-05 03:26:07 +08:00
|
|
|
else
|
2000-01-03 15:49:19 +08:00
|
|
|
gdisplay_color_detach_destroy (gdisp, 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);
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_up_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
|
|
|
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
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gdisplay_color_reorder_up (gdisp, node);
|
|
|
|
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);
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_down_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
|
|
|
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
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gdisplay_color_reorder_down (gdisp, node);
|
|
|
|
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);
|
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
UPDATE_DISPLAY (gdisp);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_display_configure_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-01-03 15:49:19 +08:00
|
|
|
ColorDisplayDialog *cdd = data;
|
2000-11-22 04:54:53 +08:00
|
|
|
GDisplay *gdisp = cdd->gdisp;
|
|
|
|
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);
|
|
|
|
|
2000-11-26 20:13:23 +08:00
|
|
|
if (!g_list_find (cdd->conf_nodes, node))
|
|
|
|
cdd->conf_nodes = g_list_append (cdd->conf_nodes, node);
|
2000-01-03 15:49:19 +08:00
|
|
|
|
|
|
|
gdisplay_color_configure (node, NULL, NULL, NULL, NULL);
|
2000-11-22 04:54:53 +08:00
|
|
|
|
|
|
|
cdd->modified = TRUE;
|
|
|
|
UPDATE_DISPLAY (gdisp);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
1999-08-31 11:41:55 +08:00
|
|
|
|
|
|
|
void
|
2000-01-03 15:49:19 +08:00
|
|
|
gdisplay_color_ui_new (GDisplay *gdisp)
|
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
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->old_nodes = gdisp->cd_list;
|
|
|
|
dest_list_populate (gdisp->cd_list, cdd->dest);
|
|
|
|
gdisp->cd_list = g_list_copy (cdd->old_nodes);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
cdd->gdisp = gdisp;
|
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
|
|
|
|
2000-01-03 15:49:19 +08:00
|
|
|
gdisp->cd_ui = cdd->shell;
|
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;
|
|
|
|
int row;
|
|
|
|
|
|
|
|
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;
|
2000-11-26 20:13:23 +08:00
|
|
|
cdd->src_row = row;
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unselect_src (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorDisplayDialog *cdd = data;
|
|
|
|
cdd->src_row = -1;
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], 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;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_REMOVE], TRUE);
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_CONFIGURE], TRUE);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_REMOVE], FALSE);
|
|
|
|
gtk_widget_set_sensitive (cdd->buttons[BUTTON_CONFIGURE], FALSE);
|
|
|
|
|
|
|
|
color_display_update_up_and_down (cdd);
|
1999-08-31 11:41:55 +08:00
|
|
|
}
|
2000-11-26 20:13:23 +08:00
|
|
|
|