1999-08-31 11:41:55 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
2003-11-22 23:54:12 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpcolordisplayeditor.c
|
|
|
|
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
1999-08-31 11:41:55 +08:00
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
#include "widgets-types.h"
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
#include "gimpcolordisplayeditor.h"
|
2005-05-04 05:38:07 +08:00
|
|
|
#include "gimpeditor.h"
|
2000-05-05 21:29:46 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.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
|
|
|
|
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
enum
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
SRC_COLUMN_NAME,
|
|
|
|
SRC_COLUMN_TYPE,
|
|
|
|
N_SRC_COLUMNS
|
|
|
|
};
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
enum
|
|
|
|
{
|
2003-11-23 07:53:48 +08:00
|
|
|
DEST_COLUMN_ENABLED,
|
2003-11-22 23:54:12 +08:00
|
|
|
DEST_COLUMN_NAME,
|
|
|
|
DEST_COLUMN_FILTER,
|
|
|
|
N_DEST_COLUMNS
|
2000-11-26 20:13:23 +08:00
|
|
|
};
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_class_init (GimpColorDisplayEditorClass *klass);
|
|
|
|
static void gimp_color_display_editor_init (GimpColorDisplayEditor *editor);
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_destroy (GtkObject *object);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_add_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_remove_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_up_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_down_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_reset_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_src_changed (GtkTreeSelection *sel,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
|
|
|
GimpColorDisplayEditor *editor);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_added (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
gint position,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_removed (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_reordered (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
gint position,
|
|
|
|
GimpColorDisplayEditor *editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-23 20:08:21 +08:00
|
|
|
static void gimp_color_display_editor_enabled (GimpColorDisplay *display,
|
2003-11-23 21:08:56 +08:00
|
|
|
GParamSpec *pspec,
|
2003-11-23 07:53:48 +08:00
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
static void gimp_color_display_editor_enable_toggled (GtkCellRendererToggle *toggle,
|
|
|
|
const gchar *path,
|
|
|
|
GimpColorDisplayEditor *editor);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static GtkVBoxClass *parent_class = NULL;
|
2000-01-03 15:49:19 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
GType
|
|
|
|
gimp_color_display_editor_get_type (void)
|
2003-11-22 06:52:36 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
static GType type = 0;
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (! type)
|
2003-11-22 06:52:36 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
static const GTypeInfo editor_info =
|
|
|
|
{
|
|
|
|
sizeof (GimpColorDisplayEditorClass),
|
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gimp_color_display_editor_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_tool */
|
|
|
|
sizeof (GimpColorDisplayEditor),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_color_display_editor_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GTK_TYPE_VBOX,
|
|
|
|
"GimpColorDisplayEditor",
|
|
|
|
&editor_info, 0);
|
2003-11-22 06:52:36 +08:00
|
|
|
}
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
return type;
|
|
|
|
}
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void
|
|
|
|
gimp_color_display_editor_class_init (GimpColorDisplayEditorClass *klass)
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2003-11-22 06:52:36 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
object_class->destroy = gimp_color_display_editor_destroy;
|
|
|
|
}
|
2003-11-22 06:52:36 +08:00
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_init (GimpColorDisplayEditor *editor)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2005-06-25 08:11:59 +08:00
|
|
|
GtkWidget *paned;
|
2003-11-23 07:53:48 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *ed;
|
|
|
|
GtkWidget *scrolled_win;
|
|
|
|
GtkWidget *tv;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *image;
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
GtkCellRenderer *rend;
|
|
|
|
|
2005-06-25 08:11:59 +08:00
|
|
|
paned = gtk_vpaned_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor), paned, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (paned);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
2005-06-25 08:11:59 +08:00
|
|
|
gtk_paned_pack1 (GTK_PANED (paned), hbox, FALSE, FALSE);
|
2002-10-23 22:55:07 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
1999-09-01 01:53:26 +08:00
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
2002-03-16 23:02:23 +08:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_SHADOW_IN);
|
1999-09-01 01:53:26 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
2003-08-24 21:52:51 +08:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
1999-09-01 01:53:26 +08:00
|
|
|
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
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->src = gtk_list_store_new (N_SRC_COLUMNS,
|
2003-11-23 07:53:48 +08:00
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_POINTER);
|
2003-11-22 23:54:12 +08:00
|
|
|
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->src));
|
|
|
|
g_object_unref (editor->src);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
|
|
|
gtk_widget_set_size_request (tv, LIST_WIDTH, LIST_HEIGHT);
|
|
|
|
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (tv), FALSE);
|
|
|
|
|
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
|
|
|
|
0, _("Available Filters"),
|
|
|
|
gtk_cell_renderer_text_new (),
|
2003-11-23 07:53:48 +08:00
|
|
|
"text", SRC_COLUMN_NAME,
|
|
|
|
NULL);
|
2002-03-16 23:02:23 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
|
|
|
gtk_widget_show (tv);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->src_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_connect (editor->src_sel, "changed",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_src_changed),
|
|
|
|
editor);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2005-06-25 08:11:59 +08:00
|
|
|
vbox = gtk_vbox_new (TRUE, 6);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->add_button = gtk_button_new ();
|
2004-05-27 00:33:14 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), editor->add_button, TRUE, FALSE, 0);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_set_sensitive (editor->add_button, FALSE);
|
|
|
|
gtk_widget_show (editor->add_button);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (editor->add_button), image);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (image);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_help_set_help_data (editor->add_button,
|
2002-03-15 23:09:58 +08:00
|
|
|
_("Add the selected filter to the list of "
|
|
|
|
"active filters."), NULL);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_connect (editor->add_button, "clicked",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_add_clicked),
|
|
|
|
editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->remove_button = gtk_button_new ();
|
2004-05-27 00:33:14 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), editor->remove_button, TRUE, FALSE, 0);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_set_sensitive (editor->remove_button, FALSE);
|
|
|
|
gtk_widget_show (editor->remove_button);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (editor->remove_button), image);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (image);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_help_set_help_data (editor->remove_button,
|
2002-03-15 23:09:58 +08:00
|
|
|
_("Remove the selected filter from the list of "
|
|
|
|
"active filters."), NULL);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_connect (editor->remove_button, "clicked",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_remove_clicked),
|
|
|
|
editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
ed = gimp_editor_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), ed, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (ed);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->up_button =
|
|
|
|
gimp_editor_add_button (GIMP_EDITOR (ed),
|
2002-03-15 23:09:58 +08:00
|
|
|
GTK_STOCK_GO_UP,
|
|
|
|
_("Move the selected filter up"),
|
|
|
|
NULL,
|
2003-11-22 23:54:12 +08:00
|
|
|
G_CALLBACK (gimp_color_display_editor_up_clicked),
|
2002-03-15 23:09:58 +08:00
|
|
|
NULL,
|
2003-11-22 23:54:12 +08:00
|
|
|
editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->down_button =
|
|
|
|
gimp_editor_add_button (GIMP_EDITOR (ed),
|
2002-03-15 23:09:58 +08:00
|
|
|
GTK_STOCK_GO_DOWN,
|
|
|
|
_("Move the selected filter down"),
|
|
|
|
NULL,
|
2003-11-22 23:54:12 +08:00
|
|
|
G_CALLBACK (gimp_color_display_editor_down_clicked),
|
2002-03-15 23:09:58 +08:00
|
|
|
NULL,
|
2003-11-22 23:54:12 +08:00
|
|
|
editor);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_set_sensitive (editor->up_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (editor->down_button, FALSE);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
2002-03-16 23:02:23 +08:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_SHADOW_IN);
|
1999-09-01 01:53:26 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
2003-08-24 21:52:51 +08:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
1999-09-01 01:53:26 +08:00
|
|
|
GTK_POLICY_AUTOMATIC);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (ed), scrolled_win);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (scrolled_win);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->dest = gtk_list_store_new (N_DEST_COLUMNS,
|
2003-11-23 07:53:48 +08:00
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
GIMP_TYPE_COLOR_DISPLAY);
|
2003-11-22 23:54:12 +08:00
|
|
|
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->dest));
|
|
|
|
g_object_unref (editor->dest);
|
1999-09-01 01:53:26 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
gtk_widget_set_size_request (tv, LIST_WIDTH, LIST_HEIGHT);
|
|
|
|
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (tv), FALSE);
|
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
rend = gtk_cell_renderer_toggle_new ();
|
|
|
|
|
|
|
|
g_signal_connect (rend, "toggled",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_enable_toggled),
|
|
|
|
editor);
|
|
|
|
|
2003-11-23 09:56:59 +08:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (NULL, rend,
|
|
|
|
"active",
|
|
|
|
DEST_COLUMN_ENABLED,
|
|
|
|
NULL);
|
|
|
|
gtk_tree_view_insert_column (GTK_TREE_VIEW (tv), column, 0);
|
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GIMP_STOCK_VISIBLE, GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_tree_view_column_set_widget (column, image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
|
|
|
|
1, _("Active Filters"),
|
|
|
|
gtk_cell_renderer_text_new (),
|
|
|
|
"text", DEST_COLUMN_NAME,
|
|
|
|
NULL);
|
2003-11-23 07:53:48 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
|
|
|
gtk_widget_show (tv);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->dest_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_connect (editor->dest_sel, "changed",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_dest_changed),
|
|
|
|
editor);
|
2000-01-02 08:16:47 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
/* the config frame */
|
|
|
|
|
2004-05-26 21:39:23 +08:00
|
|
|
editor->config_frame = gimp_frame_new (NULL);
|
2005-06-25 08:11:59 +08:00
|
|
|
gtk_paned_pack2 (GTK_PANED (paned), editor->config_frame, TRUE, FALSE);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_show (editor->config_frame);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2004-05-26 21:39:23 +08:00
|
|
|
editor->config_box = gtk_vbox_new (FALSE, 6);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (editor->config_frame), editor->config_box);
|
|
|
|
gtk_widget_show (editor->config_box);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (editor->config_box), hbox, FALSE, FALSE, 0);
|
2002-03-15 23:09:58 +08:00
|
|
|
gtk_widget_show (hbox);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->reset_button = gtk_button_new_from_stock (GIMP_STOCK_RESET);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), editor->reset_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (editor->reset_button);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_help_set_help_data (editor->reset_button,
|
2002-10-23 22:55:07 +08:00
|
|
|
_("Reset the selected filter to default values"),
|
|
|
|
NULL);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_connect (editor->reset_button, "clicked",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_reset_clicked),
|
|
|
|
editor);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_dest_changed (editor->dest_sel, editor);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_destroy (GtkObject *object)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
GimpColorDisplayEditor *editor = GIMP_COLOR_DISPLAY_EDITOR (object);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->stack)
|
|
|
|
{
|
|
|
|
g_object_unref (editor->stack);
|
|
|
|
editor->stack = NULL;
|
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_color_display_editor_new (GimpColorDisplayStack *stack)
|
2000-11-26 20:13:23 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
GimpColorDisplayEditor *editor;
|
2003-11-23 07:53:48 +08:00
|
|
|
GType *display_types;
|
|
|
|
guint n_display_types;
|
2003-11-22 23:54:12 +08:00
|
|
|
gint i;
|
|
|
|
GList *list;
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor = g_object_new (GIMP_TYPE_COLOR_DISPLAY_EDITOR, NULL);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
editor->stack = g_object_ref (stack);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
display_types = g_type_children (GIMP_TYPE_COLOR_DISPLAY, &n_display_types);
|
2002-03-16 23:02:23 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
for (i = 0; i < n_display_types; i++)
|
2003-11-22 23:54:12 +08:00
|
|
|
{
|
2003-11-23 07:53:48 +08:00
|
|
|
GimpColorDisplayClass *display_class;
|
2003-11-22 23:54:12 +08:00
|
|
|
GtkTreeIter iter;
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
display_class = g_type_class_ref (display_types[i]);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_list_store_append (editor->src, &iter);
|
1999-10-05 10:16:59 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_list_store_set (editor->src, &iter,
|
2003-11-23 07:53:48 +08:00
|
|
|
SRC_COLUMN_NAME, display_class->name,
|
|
|
|
SRC_COLUMN_TYPE, display_types[i],
|
2003-11-22 23:54:12 +08:00
|
|
|
-1);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
g_type_class_unref (display_class);
|
2003-11-22 23:54:12 +08:00
|
|
|
}
|
1999-10-05 10:16:59 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
g_free (display_types);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
for (list = stack->filters; list; list = g_list_next (list))
|
|
|
|
{
|
2003-11-23 07:53:48 +08:00
|
|
|
GimpColorDisplay *display = list->data;
|
2003-11-22 23:54:12 +08:00
|
|
|
GtkTreeIter iter;
|
2003-11-23 07:53:48 +08:00
|
|
|
gboolean enabled;
|
2003-11-22 23:54:12 +08:00
|
|
|
const gchar *name;
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
enabled = gimp_color_display_get_enabled (display);
|
|
|
|
|
|
|
|
name = GIMP_COLOR_DISPLAY_GET_CLASS (display)->name;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_list_store_append (editor->dest, &iter);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_list_store_set (editor->dest, &iter,
|
2003-11-23 07:53:48 +08:00
|
|
|
DEST_COLUMN_ENABLED, enabled,
|
|
|
|
DEST_COLUMN_NAME, name,
|
|
|
|
DEST_COLUMN_FILTER, display,
|
2003-11-22 23:54:12 +08:00
|
|
|
-1);
|
2003-11-23 07:53:48 +08:00
|
|
|
|
2003-11-23 21:08:56 +08:00
|
|
|
g_signal_connect_object (display, "notify::enabled",
|
2003-11-23 20:08:21 +08:00
|
|
|
G_CALLBACK (gimp_color_display_editor_enabled),
|
2003-11-23 07:53:48 +08:00
|
|
|
G_OBJECT (editor), 0);
|
2002-03-16 23:02:23 +08:00
|
|
|
}
|
2003-11-22 23:54:12 +08:00
|
|
|
|
|
|
|
g_signal_connect_object (stack, "added",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_added),
|
|
|
|
G_OBJECT (editor), 0);
|
|
|
|
g_signal_connect_object (stack, "removed",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_removed),
|
|
|
|
G_OBJECT (editor), 0);
|
|
|
|
g_signal_connect_object (stack, "reordered",
|
|
|
|
G_CALLBACK (gimp_color_display_editor_reordered),
|
|
|
|
G_OBJECT (editor), 0);
|
|
|
|
|
|
|
|
return GTK_WIDGET (editor);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_add_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2002-03-16 23:02:23 +08:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
1999-10-05 10:16:59 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (gtk_tree_selection_get_selected (editor->src_sel, &model, &iter))
|
2002-03-16 23:02:23 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
GimpColorDisplay *display;
|
2002-03-16 23:02:23 +08:00
|
|
|
GValue val = { 0, };
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
gtk_tree_model_get_value (model, &iter, SRC_COLUMN_TYPE, &val);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
display = gimp_color_display_new ((GType) g_value_get_pointer (&val));
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
g_value_unset (&val);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (display)
|
|
|
|
{
|
|
|
|
gimp_color_display_stack_add (editor->stack, display);
|
|
|
|
g_object_unref (display);
|
|
|
|
}
|
2002-03-16 23:02:23 +08:00
|
|
|
}
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_remove_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->selected)
|
|
|
|
gimp_color_display_stack_remove (editor->stack, editor->selected);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_up_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->selected)
|
|
|
|
gimp_color_display_stack_reorder_up (editor->stack, editor->selected);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
1999-08-31 11:41:55 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_down_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-09-01 01:53:26 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->selected)
|
|
|
|
gimp_color_display_stack_reorder_down (editor->stack, editor->selected);
|
1999-09-01 01:53:26 +08:00
|
|
|
}
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_reset_clicked (GtkWidget *widget,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->selected)
|
|
|
|
gimp_color_display_configure_reset (editor->selected);
|
1999-10-05 03:26:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_src_changed (GtkTreeSelection *sel,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-10-05 03:26:07 +08:00
|
|
|
{
|
2002-03-16 23:02:23 +08:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
const gchar *name = NULL;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
|
|
{
|
|
|
|
GValue val = { 0, };
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_tree_model_get_value (model, &iter, SRC_COLUMN_NAME, &val);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
name = g_value_get_string (&val);
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
g_value_unset (&val);
|
|
|
|
}
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_set_sensitive (editor->add_button, name != NULL);
|
1999-10-05 03:26:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
|
|
|
GimpColorDisplayEditor *editor)
|
1999-08-31 11:41:55 +08:00
|
|
|
{
|
2002-03-16 23:02:23 +08:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2003-11-23 07:53:48 +08:00
|
|
|
GimpColorDisplay *display = NULL;
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->selected)
|
2002-10-23 22:55:07 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
g_object_remove_weak_pointer (G_OBJECT (editor->selected),
|
|
|
|
(gpointer) &editor->selected);
|
|
|
|
editor->selected = NULL;
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
|
|
{
|
|
|
|
GValue val = { 0, };
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
display = g_value_get_object (&val);
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2002-03-16 23:02:23 +08:00
|
|
|
g_value_unset (&val);
|
|
|
|
}
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
gtk_widget_set_sensitive (editor->remove_button, display != NULL);
|
|
|
|
gtk_widget_set_sensitive (editor->reset_button, display != NULL);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->config_widget)
|
|
|
|
gtk_container_remove (GTK_CONTAINER (editor->config_box),
|
|
|
|
editor->config_widget);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
if (display)
|
2002-10-23 22:55:07 +08:00
|
|
|
{
|
2003-11-23 07:53:48 +08:00
|
|
|
editor->selected = display;
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (display),
|
2003-11-22 23:54:12 +08:00
|
|
|
(gpointer) &editor->selected);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
editor->config_widget = gimp_color_display_configure (display);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2005-06-25 09:05:22 +08:00
|
|
|
gtk_frame_set_label (GTK_FRAME (editor->config_frame),
|
|
|
|
GIMP_COLOR_DISPLAY_GET_CLASS (display)->name);
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-06-25 09:05:22 +08:00
|
|
|
editor->config_widget = NULL;
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_frame_set_label (GTK_FRAME (editor->config_frame),
|
2005-06-25 09:05:22 +08:00
|
|
|
_("No filter selected"));
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
if (editor->config_widget)
|
2002-10-23 22:55:07 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor->config_box), editor->config_widget,
|
2002-10-23 22:55:07 +08:00
|
|
|
FALSE, FALSE, 0);
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_widget_show (editor->config_widget);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (editor->config_widget),
|
|
|
|
(gpointer) &editor->config_widget);
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|
2000-11-26 20:13:23 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_update_buttons (editor);
|
1999-08-31 11:41:55 +08:00
|
|
|
}
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
static void
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_added (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
gint position,
|
|
|
|
GimpColorDisplayEditor *editor)
|
2002-10-23 22:55:07 +08:00
|
|
|
{
|
2003-11-22 23:54:12 +08:00
|
|
|
GtkTreeIter iter;
|
2003-11-23 07:53:48 +08:00
|
|
|
gboolean enabled;
|
2003-11-22 23:54:12 +08:00
|
|
|
const gchar *name;
|
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
enabled = gimp_color_display_get_enabled (display);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
name = GIMP_COLOR_DISPLAY_GET_CLASS (display)->name;
|
|
|
|
|
|
|
|
gtk_list_store_insert (editor->dest, &iter, position);
|
|
|
|
|
|
|
|
gtk_list_store_set (editor->dest, &iter,
|
2003-11-23 07:53:48 +08:00
|
|
|
DEST_COLUMN_ENABLED, enabled,
|
|
|
|
DEST_COLUMN_NAME, name,
|
|
|
|
DEST_COLUMN_FILTER, display,
|
2003-11-22 23:54:12 +08:00
|
|
|
-1);
|
|
|
|
|
2003-11-23 21:08:56 +08:00
|
|
|
g_signal_connect_object (display, "notify::enabled",
|
2003-11-23 20:08:21 +08:00
|
|
|
G_CALLBACK (gimp_color_display_editor_enabled),
|
2003-11-23 07:53:48 +08:00
|
|
|
G_OBJECT (editor), 0);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gimp_color_display_editor_update_buttons (editor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_editor_removed (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
GimpColorDisplayEditor *editor)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean iter_valid;
|
|
|
|
|
|
|
|
for (iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter);
|
|
|
|
iter_valid;
|
|
|
|
iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter))
|
|
|
|
{
|
|
|
|
GimpColorDisplay *display2;
|
|
|
|
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (editor->dest), &iter,
|
|
|
|
DEST_COLUMN_FILTER, &display2,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
g_object_unref (display2);
|
|
|
|
|
|
|
|
if (display == display2)
|
|
|
|
{
|
2003-11-23 07:53:48 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (display,
|
2003-11-23 20:08:21 +08:00
|
|
|
gimp_color_display_editor_enabled,
|
2003-11-23 07:53:48 +08:00
|
|
|
editor);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
gtk_list_store_remove (editor->dest, &iter);
|
|
|
|
|
|
|
|
gimp_color_display_editor_update_buttons (editor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_editor_reordered (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display,
|
|
|
|
gint position,
|
|
|
|
GimpColorDisplayEditor *editor)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean iter_valid;
|
|
|
|
|
|
|
|
for (iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter);
|
|
|
|
iter_valid;
|
|
|
|
iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter))
|
|
|
|
{
|
|
|
|
GimpColorDisplay *display2;
|
|
|
|
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (editor->dest), &iter,
|
|
|
|
DEST_COLUMN_FILTER, &display2,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
g_object_unref (display2);
|
|
|
|
|
|
|
|
if (display == display2)
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
gint old_position;
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (editor->dest), &iter);
|
|
|
|
old_position = gtk_tree_path_get_indices (path)[0];
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
if (position == old_position)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (position == -1 || position == g_list_length (stack->filters) - 1)
|
|
|
|
{
|
|
|
|
gtk_list_store_move_before (editor->dest, &iter, NULL);
|
|
|
|
}
|
|
|
|
else if (position == 0)
|
|
|
|
{
|
|
|
|
gtk_list_store_move_after (editor->dest, &iter, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GtkTreeIter place_iter;
|
|
|
|
|
|
|
|
path = gtk_tree_path_new_from_indices (position, -1);
|
|
|
|
gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&place_iter, path);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
if (position > old_position)
|
|
|
|
gtk_list_store_move_after (editor->dest, &iter, &place_iter);
|
|
|
|
else
|
|
|
|
gtk_list_store_move_before (editor->dest, &iter, &place_iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_color_display_editor_update_buttons (editor);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-23 07:53:48 +08:00
|
|
|
static void
|
2003-11-23 20:08:21 +08:00
|
|
|
gimp_color_display_editor_enabled (GimpColorDisplay *display,
|
2003-11-23 21:08:56 +08:00
|
|
|
GParamSpec *pspec,
|
2003-11-23 07:53:48 +08:00
|
|
|
GimpColorDisplayEditor *editor)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean iter_valid;
|
|
|
|
|
|
|
|
for (iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter);
|
|
|
|
iter_valid;
|
|
|
|
iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (editor->dest),
|
|
|
|
&iter))
|
|
|
|
{
|
|
|
|
GimpColorDisplay *display2;
|
|
|
|
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (editor->dest), &iter,
|
|
|
|
DEST_COLUMN_FILTER, &display2,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
g_object_unref (display2);
|
|
|
|
|
|
|
|
if (display == display2)
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
gboolean enabled = gimp_color_display_get_enabled (display);
|
2003-11-23 20:08:21 +08:00
|
|
|
|
|
|
|
gtk_list_store_set (editor->dest, &iter,
|
|
|
|
DEST_COLUMN_ENABLED, enabled,
|
|
|
|
-1);
|
2003-11-23 07:53:48 +08:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_editor_enable_toggled (GtkCellRendererToggle *toggle,
|
|
|
|
const gchar *path_str,
|
|
|
|
GimpColorDisplayEditor *editor)
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
|
2003-11-23 07:53:48 +08:00
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dest), &iter, path))
|
|
|
|
{
|
|
|
|
GimpColorDisplay *display;
|
|
|
|
gboolean enabled;
|
|
|
|
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (editor->dest), &iter,
|
|
|
|
DEST_COLUMN_FILTER, &display,
|
|
|
|
DEST_COLUMN_ENABLED, &enabled,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
gimp_color_display_set_enabled (display, ! enabled);
|
2003-11-23 09:56:59 +08:00
|
|
|
|
|
|
|
g_object_unref (display);
|
2003-11-23 07:53:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
static void
|
|
|
|
gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor)
|
|
|
|
{
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean up_sensitive = FALSE;
|
|
|
|
gboolean down_sensitive = FALSE;
|
|
|
|
|
|
|
|
if (gtk_tree_selection_get_selected (editor->dest_sel, &model, &iter))
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
|
|
|
|
gint *indices = gtk_tree_path_get_indices (path);
|
2003-11-22 23:54:12 +08:00
|
|
|
|
|
|
|
up_sensitive = indices[0] > 0;
|
|
|
|
down_sensitive = indices[0] < (g_list_length (editor->stack->filters) - 1);
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (editor->up_button, up_sensitive);
|
|
|
|
gtk_widget_set_sensitive (editor->down_button, down_sensitive);
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|