mirror of https://github.com/GNOME/gimp.git
added API to enable/disable a filter. A disabled filter has no effect.
2003-11-23 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolordisplay.[ch]: added API to enable/disable a filter. A disabled filter has no effect. * libgimpmodule/gimpmodule.h: incremented GIMP_MODULE_ABI_VERSION. * app/widgets/gimpcolordisplayeditor.c: added a check column to the "Active Filters" tree view so the effect of all filters can quickly be toggled. Cleanup. * modules/cdisplay_colorblind.c: removed "none" from the enum and from the GUI because disabling a filter is implemented generically now. * modules/cdisplay_colorblind.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/cdisplay_proof.c: added mnemonics, cleanup.
This commit is contained in:
parent
aba3d437e2
commit
ed3f0eb6e4
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2003-11-23 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpcolordisplay.[ch]: added API to
|
||||||
|
enable/disable a filter. A disabled filter has no effect.
|
||||||
|
|
||||||
|
* libgimpmodule/gimpmodule.h: incremented GIMP_MODULE_ABI_VERSION.
|
||||||
|
|
||||||
|
* app/widgets/gimpcolordisplayeditor.c: added a check column to
|
||||||
|
the "Active Filters" tree view so the effect of all filters can
|
||||||
|
quickly be toggled. Cleanup.
|
||||||
|
|
||||||
|
* modules/cdisplay_colorblind.c: removed "none" from the enum and
|
||||||
|
from the GUI because disabling a filter is implemented generically
|
||||||
|
now.
|
||||||
|
|
||||||
|
* modules/cdisplay_colorblind.c
|
||||||
|
* modules/cdisplay_gamma.c
|
||||||
|
* modules/cdisplay_highcontrast.c
|
||||||
|
* modules/cdisplay_proof.c: added mnemonics, cleanup.
|
||||||
|
|
||||||
2003-11-22 Michael Natterer <mitch@gimp.org>
|
2003-11-22 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* libgimpwidgets/gimpwidgetsmarshal.list
|
* libgimpwidgets/gimpwidgetsmarshal.list
|
||||||
|
|
|
@ -45,6 +45,7 @@ enum
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
DEST_COLUMN_ENABLED,
|
||||||
DEST_COLUMN_NAME,
|
DEST_COLUMN_NAME,
|
||||||
DEST_COLUMN_FILTER,
|
DEST_COLUMN_FILTER,
|
||||||
N_DEST_COLUMNS
|
N_DEST_COLUMNS
|
||||||
|
@ -84,6 +85,12 @@ static void gimp_color_display_editor_reordered (GimpColorDisplayStack *
|
||||||
gint position,
|
gint position,
|
||||||
GimpColorDisplayEditor *editor);
|
GimpColorDisplayEditor *editor);
|
||||||
|
|
||||||
|
static void gimp_color_display_editor_changed (GimpColorDisplay *display,
|
||||||
|
GimpColorDisplayEditor *editor);
|
||||||
|
static void gimp_color_display_editor_enable_toggled (GtkCellRendererToggle *toggle,
|
||||||
|
const gchar *path,
|
||||||
|
GimpColorDisplayEditor *editor);
|
||||||
|
|
||||||
static void gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor);
|
static void gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor);
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +146,10 @@ gimp_color_display_editor_init (GimpColorDisplayEditor *editor)
|
||||||
GtkWidget *tv;
|
GtkWidget *tv;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
GtkTreeViewColumn *column;
|
||||||
|
GtkCellRenderer *rend;
|
||||||
|
|
||||||
|
gtk_box_set_spacing (GTK_BOX (editor), 6);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 6);
|
hbox = gtk_hbox_new (FALSE, 6);
|
||||||
gtk_box_pack_start (GTK_BOX (editor), hbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (editor), hbox, TRUE, TRUE, 0);
|
||||||
|
@ -154,7 +165,8 @@ gimp_color_display_editor_init (GimpColorDisplayEditor *editor)
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
|
|
||||||
editor->src = gtk_list_store_new (N_SRC_COLUMNS,
|
editor->src = gtk_list_store_new (N_SRC_COLUMNS,
|
||||||
G_TYPE_STRING, G_TYPE_POINTER);
|
G_TYPE_STRING,
|
||||||
|
G_TYPE_POINTER);
|
||||||
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->src));
|
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->src));
|
||||||
g_object_unref (editor->src);
|
g_object_unref (editor->src);
|
||||||
|
|
||||||
|
@ -164,7 +176,8 @@ gimp_color_display_editor_init (GimpColorDisplayEditor *editor)
|
||||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
|
||||||
0, _("Available Filters"),
|
0, _("Available Filters"),
|
||||||
gtk_cell_renderer_text_new (),
|
gtk_cell_renderer_text_new (),
|
||||||
"text", 0, NULL);
|
"text", SRC_COLUMN_NAME,
|
||||||
|
NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
||||||
gtk_widget_show (tv);
|
gtk_widget_show (tv);
|
||||||
|
|
||||||
|
@ -247,17 +260,36 @@ gimp_color_display_editor_init (GimpColorDisplayEditor *editor)
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
|
|
||||||
editor->dest = gtk_list_store_new (N_DEST_COLUMNS,
|
editor->dest = gtk_list_store_new (N_DEST_COLUMNS,
|
||||||
G_TYPE_STRING, GIMP_TYPE_COLOR_DISPLAY);
|
G_TYPE_BOOLEAN,
|
||||||
|
G_TYPE_STRING,
|
||||||
|
GIMP_TYPE_COLOR_DISPLAY);
|
||||||
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->dest));
|
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (editor->dest));
|
||||||
g_object_unref (editor->dest);
|
g_object_unref (editor->dest);
|
||||||
|
|
||||||
gtk_widget_set_size_request (tv, LIST_WIDTH, LIST_HEIGHT);
|
gtk_widget_set_size_request (tv, LIST_WIDTH, LIST_HEIGHT);
|
||||||
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (tv), FALSE);
|
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (tv), FALSE);
|
||||||
|
|
||||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
|
|
||||||
0, _("Active Filters"),
|
column = gtk_tree_view_column_new ();
|
||||||
gtk_cell_renderer_text_new (),
|
gtk_tree_view_column_set_title (column, _("Active Filters"));
|
||||||
"text", 0, NULL);
|
gtk_tree_view_insert_column (GTK_TREE_VIEW (tv), column, 0);
|
||||||
|
|
||||||
|
rend = gtk_cell_renderer_toggle_new ();
|
||||||
|
gtk_tree_view_column_pack_start (column, rend, FALSE);
|
||||||
|
gtk_tree_view_column_set_attributes (column, rend,
|
||||||
|
"active", DEST_COLUMN_ENABLED,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_connect (rend, "toggled",
|
||||||
|
G_CALLBACK (gimp_color_display_editor_enable_toggled),
|
||||||
|
editor);
|
||||||
|
|
||||||
|
rend = gtk_cell_renderer_text_new ();
|
||||||
|
gtk_tree_view_column_pack_start (column, rend, FALSE);
|
||||||
|
gtk_tree_view_column_set_attributes (column, rend,
|
||||||
|
"text", DEST_COLUMN_NAME,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
||||||
gtk_widget_show (tv);
|
gtk_widget_show (tv);
|
||||||
|
|
||||||
|
@ -315,8 +347,8 @@ GtkWidget *
|
||||||
gimp_color_display_editor_new (GimpColorDisplayStack *stack)
|
gimp_color_display_editor_new (GimpColorDisplayStack *stack)
|
||||||
{
|
{
|
||||||
GimpColorDisplayEditor *editor;
|
GimpColorDisplayEditor *editor;
|
||||||
GType *filter_types;
|
GType *display_types;
|
||||||
guint n_filter_types;
|
guint n_display_types;
|
||||||
gint i;
|
gint i;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
|
@ -326,41 +358,49 @@ gimp_color_display_editor_new (GimpColorDisplayStack *stack)
|
||||||
|
|
||||||
editor->stack = g_object_ref (stack);
|
editor->stack = g_object_ref (stack);
|
||||||
|
|
||||||
filter_types = g_type_children (GIMP_TYPE_COLOR_DISPLAY, &n_filter_types);
|
display_types = g_type_children (GIMP_TYPE_COLOR_DISPLAY, &n_display_types);
|
||||||
|
|
||||||
for (i = 0; i < n_filter_types; i++)
|
for (i = 0; i < n_display_types; i++)
|
||||||
{
|
{
|
||||||
GimpColorDisplayClass *filter_class;
|
GimpColorDisplayClass *display_class;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
filter_class = g_type_class_ref (filter_types[i]);
|
display_class = g_type_class_ref (display_types[i]);
|
||||||
|
|
||||||
gtk_list_store_append (editor->src, &iter);
|
gtk_list_store_append (editor->src, &iter);
|
||||||
|
|
||||||
gtk_list_store_set (editor->src, &iter,
|
gtk_list_store_set (editor->src, &iter,
|
||||||
SRC_COLUMN_NAME, filter_class->name,
|
SRC_COLUMN_NAME, display_class->name,
|
||||||
SRC_COLUMN_TYPE, filter_types[i],
|
SRC_COLUMN_TYPE, display_types[i],
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_type_class_unref (filter_class);
|
g_type_class_unref (display_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filter_types);
|
g_free (display_types);
|
||||||
|
|
||||||
for (list = stack->filters; list; list = g_list_next (list))
|
for (list = stack->filters; list; list = g_list_next (list))
|
||||||
{
|
{
|
||||||
GimpColorDisplay *filter = list->data;
|
GimpColorDisplay *display = list->data;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
gboolean enabled;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
|
|
||||||
name = GIMP_COLOR_DISPLAY_GET_CLASS (filter)->name;
|
enabled = gimp_color_display_get_enabled (display);
|
||||||
|
|
||||||
|
name = GIMP_COLOR_DISPLAY_GET_CLASS (display)->name;
|
||||||
|
|
||||||
gtk_list_store_append (editor->dest, &iter);
|
gtk_list_store_append (editor->dest, &iter);
|
||||||
|
|
||||||
gtk_list_store_set (editor->dest, &iter,
|
gtk_list_store_set (editor->dest, &iter,
|
||||||
|
DEST_COLUMN_ENABLED, enabled,
|
||||||
DEST_COLUMN_NAME, name,
|
DEST_COLUMN_NAME, name,
|
||||||
DEST_COLUMN_FILTER, filter,
|
DEST_COLUMN_FILTER, display,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
g_signal_connect_object (display, "changed",
|
||||||
|
G_CALLBACK (gimp_color_display_editor_changed),
|
||||||
|
G_OBJECT (editor), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_connect_object (stack, "added",
|
g_signal_connect_object (stack, "added",
|
||||||
|
@ -388,7 +428,7 @@ gimp_color_display_editor_add_clicked (GtkWidget *widget,
|
||||||
GimpColorDisplay *display;
|
GimpColorDisplay *display;
|
||||||
GValue val = { 0, };
|
GValue val = { 0, };
|
||||||
|
|
||||||
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
|
gtk_tree_model_get_value (model, &iter, SRC_COLUMN_TYPE, &val);
|
||||||
|
|
||||||
display = gimp_color_display_new ((GType) g_value_get_pointer (&val));
|
display = gimp_color_display_new ((GType) g_value_get_pointer (&val));
|
||||||
|
|
||||||
|
@ -462,7 +502,7 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GimpColorDisplay *filter = NULL;
|
GimpColorDisplay *display = NULL;
|
||||||
|
|
||||||
if (editor->selected)
|
if (editor->selected)
|
||||||
{
|
{
|
||||||
|
@ -477,31 +517,31 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
||||||
|
|
||||||
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
|
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
|
||||||
|
|
||||||
filter = g_value_get_object (&val);
|
display = g_value_get_object (&val);
|
||||||
|
|
||||||
g_value_unset (&val);
|
g_value_unset (&val);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_set_sensitive (editor->remove_button, filter != NULL);
|
gtk_widget_set_sensitive (editor->remove_button, display != NULL);
|
||||||
gtk_widget_set_sensitive (editor->reset_button, filter != NULL);
|
gtk_widget_set_sensitive (editor->reset_button, display != NULL);
|
||||||
|
|
||||||
if (editor->config_widget)
|
if (editor->config_widget)
|
||||||
gtk_container_remove (GTK_CONTAINER (editor->config_box),
|
gtk_container_remove (GTK_CONTAINER (editor->config_box),
|
||||||
editor->config_widget);
|
editor->config_widget);
|
||||||
|
|
||||||
if (filter)
|
if (display)
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
editor->selected = filter;
|
editor->selected = display;
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (filter),
|
g_object_add_weak_pointer (G_OBJECT (display),
|
||||||
(gpointer) &editor->selected);
|
(gpointer) &editor->selected);
|
||||||
|
|
||||||
editor->config_widget = gimp_color_display_configure (filter);
|
editor->config_widget = gimp_color_display_configure (display);
|
||||||
|
|
||||||
str = g_strdup_printf (_("Configure Selected Filter: %s"),
|
str = g_strdup_printf (_("Configure Selected Filter: %s"),
|
||||||
GIMP_COLOR_DISPLAY_GET_CLASS (filter)->name);
|
GIMP_COLOR_DISPLAY_GET_CLASS (display)->name);
|
||||||
gtk_frame_set_label (GTK_FRAME (editor->config_frame), str);
|
gtk_frame_set_label (GTK_FRAME (editor->config_frame), str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
@ -534,17 +574,25 @@ gimp_color_display_editor_added (GimpColorDisplayStack *stack,
|
||||||
GimpColorDisplayEditor *editor)
|
GimpColorDisplayEditor *editor)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
gboolean enabled;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
|
|
||||||
|
enabled = gimp_color_display_get_enabled (display);
|
||||||
|
|
||||||
name = GIMP_COLOR_DISPLAY_GET_CLASS (display)->name;
|
name = GIMP_COLOR_DISPLAY_GET_CLASS (display)->name;
|
||||||
|
|
||||||
gtk_list_store_insert (editor->dest, &iter, position);
|
gtk_list_store_insert (editor->dest, &iter, position);
|
||||||
|
|
||||||
gtk_list_store_set (editor->dest, &iter,
|
gtk_list_store_set (editor->dest, &iter,
|
||||||
|
DEST_COLUMN_ENABLED, enabled,
|
||||||
DEST_COLUMN_NAME, name,
|
DEST_COLUMN_NAME, name,
|
||||||
DEST_COLUMN_FILTER, display,
|
DEST_COLUMN_FILTER, display,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
g_signal_connect_object (display, "changed",
|
||||||
|
G_CALLBACK (gimp_color_display_editor_changed),
|
||||||
|
G_OBJECT (editor), 0);
|
||||||
|
|
||||||
gimp_color_display_editor_update_buttons (editor);
|
gimp_color_display_editor_update_buttons (editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +620,10 @@ gimp_color_display_editor_removed (GimpColorDisplayStack *stack,
|
||||||
|
|
||||||
if (display == display2)
|
if (display == display2)
|
||||||
{
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (display,
|
||||||
|
gimp_color_display_editor_changed,
|
||||||
|
editor);
|
||||||
|
|
||||||
gtk_list_store_remove (editor->dest, &iter);
|
gtk_list_store_remove (editor->dest, &iter);
|
||||||
|
|
||||||
gimp_color_display_editor_update_buttons (editor);
|
gimp_color_display_editor_update_buttons (editor);
|
||||||
|
@ -647,6 +699,67 @@ gimp_color_display_editor_reordered (GimpColorDisplayStack *stack,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_display_editor_changed (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;
|
||||||
|
gboolean enabled;
|
||||||
|
|
||||||
|
gtk_tree_model_get (GTK_TREE_MODEL (editor->dest), &iter,
|
||||||
|
DEST_COLUMN_FILTER, &display2,
|
||||||
|
DEST_COLUMN_ENABLED, &enabled,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
g_object_unref (display2);
|
||||||
|
|
||||||
|
if (display == display2)
|
||||||
|
{
|
||||||
|
if (enabled != gimp_color_display_get_enabled (display))
|
||||||
|
gtk_list_store_set (editor->dest, &iter,
|
||||||
|
DEST_COLUMN_ENABLED, ! enabled,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_display_editor_enable_toggled (GtkCellRendererToggle *toggle,
|
||||||
|
const gchar *path_str,
|
||||||
|
GimpColorDisplayEditor *editor)
|
||||||
|
{
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
path = gtk_tree_path_new_from_string (path_str);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor)
|
gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ G_BEGIN_DECLS
|
||||||
* - one of the classes implemented by modules (currently GimpColorDisplay
|
* - one of the classes implemented by modules (currently GimpColorDisplay
|
||||||
* and GimpColorSelector).
|
* and GimpColorSelector).
|
||||||
*/
|
*/
|
||||||
#define GIMP_MODULE_ABI_VERSION 0x0001
|
#define GIMP_MODULE_ABI_VERSION 0x0002
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -103,6 +103,7 @@ gimp_color_display_class_init (GimpColorDisplayClass *klass)
|
||||||
static void
|
static void
|
||||||
gimp_color_display_init (GimpColorDisplay *display)
|
gimp_color_display_init (GimpColorDisplay *display)
|
||||||
{
|
{
|
||||||
|
display->enabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorDisplay *
|
GimpColorDisplay *
|
||||||
|
@ -129,6 +130,28 @@ gimp_color_display_clone (GimpColorDisplay *display)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_color_display_set_enabled (GimpColorDisplay *display,
|
||||||
|
gboolean enabled)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||||
|
|
||||||
|
if (enabled != display->enabled)
|
||||||
|
{
|
||||||
|
display->enabled = enabled ? TRUE : FALSE;
|
||||||
|
|
||||||
|
gimp_color_display_changed (display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_color_display_get_enabled (GimpColorDisplay *display)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), FALSE);
|
||||||
|
|
||||||
|
return display->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_color_display_convert (GimpColorDisplay *display,
|
gimp_color_display_convert (GimpColorDisplay *display,
|
||||||
guchar *buf,
|
guchar *buf,
|
||||||
|
@ -139,7 +162,7 @@ gimp_color_display_convert (GimpColorDisplay *display,
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||||
|
|
||||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert)
|
if (display->enabled && GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert)
|
||||||
GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert (display, buf,
|
GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert (display, buf,
|
||||||
width, height,
|
width, height,
|
||||||
bpp, bpl);
|
bpp, bpl);
|
||||||
|
|
|
@ -37,6 +37,8 @@ typedef struct _GimpColorDisplayClass GimpColorDisplayClass;
|
||||||
struct _GimpColorDisplay
|
struct _GimpColorDisplay
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
|
gboolean enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpColorDisplayClass
|
struct _GimpColorDisplayClass
|
||||||
|
@ -67,9 +69,12 @@ struct _GimpColorDisplayClass
|
||||||
|
|
||||||
GType gimp_color_display_get_type (void) G_GNUC_CONST;
|
GType gimp_color_display_get_type (void) G_GNUC_CONST;
|
||||||
GimpColorDisplay * gimp_color_display_new (GType display_type);
|
GimpColorDisplay * gimp_color_display_new (GType display_type);
|
||||||
|
|
||||||
GimpColorDisplay * gimp_color_display_clone (GimpColorDisplay *display);
|
GimpColorDisplay * gimp_color_display_clone (GimpColorDisplay *display);
|
||||||
|
|
||||||
|
void gimp_color_display_set_enabled (GimpColorDisplay *display,
|
||||||
|
gboolean enabled);
|
||||||
|
gboolean gimp_color_display_get_enabled (GimpColorDisplay *display);
|
||||||
|
|
||||||
void gimp_color_display_convert (GimpColorDisplay *display,
|
void gimp_color_display_convert (GimpColorDisplay *display,
|
||||||
guchar *buf,
|
guchar *buf,
|
||||||
gint width,
|
gint width,
|
||||||
|
|
|
@ -43,10 +43,12 @@
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
COLORBLIND_DEFICIENCY_NONE,
|
COLORBLIND_DEFICIENCY_FIRST,
|
||||||
COLORBLIND_DEFICIENCY_PROTANOPIA,
|
|
||||||
|
COLORBLIND_DEFICIENCY_PROTANOPIA = COLORBLIND_DEFICIENCY_FIRST,
|
||||||
COLORBLIND_DEFICIENCY_DEUTERANOPIA,
|
COLORBLIND_DEFICIENCY_DEUTERANOPIA,
|
||||||
COLORBLIND_DEFICIENCY_TRITANOPIA,
|
COLORBLIND_DEFICIENCY_TRITANOPIA,
|
||||||
|
|
||||||
COLORBLIND_DEFICIENCY_LAST = COLORBLIND_DEFICIENCY_TRITANOPIA
|
COLORBLIND_DEFICIENCY_LAST = COLORBLIND_DEFICIENCY_TRITANOPIA
|
||||||
} ColorblindDeficiency;
|
} ColorblindDeficiency;
|
||||||
|
|
||||||
|
@ -299,9 +301,6 @@ cdisplay_colorblind_convert (GimpColorDisplay *display,
|
||||||
|
|
||||||
colorblind = CDISPLAY_COLORBLIND (display);
|
colorblind = CDISPLAY_COLORBLIND (display);
|
||||||
|
|
||||||
if (colorblind->deficiency == COLORBLIND_DEFICIENCY_NONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* to improve readability, copy the parameters into local variables */
|
/* to improve readability, copy the parameters into local variables */
|
||||||
memcpy (rgb2lms, colorblind->rgb2lms, sizeof (rgb2lms));
|
memcpy (rgb2lms, colorblind->rgb2lms, sizeof (rgb2lms));
|
||||||
memcpy (lms2rgb, colorblind->lms2rgb, sizeof (lms2rgb));
|
memcpy (lms2rgb, colorblind->lms2rgb, sizeof (lms2rgb));
|
||||||
|
@ -424,7 +423,7 @@ cdisplay_colorblind_load_state (GimpColorDisplay *display,
|
||||||
|
|
||||||
if (sscanf (str, "%d", &deficiency) == 1)
|
if (sscanf (str, "%d", &deficiency) == 1)
|
||||||
{
|
{
|
||||||
if (deficiency >= COLORBLIND_DEFICIENCY_NONE &&
|
if (deficiency >= COLORBLIND_DEFICIENCY_FIRST &&
|
||||||
deficiency <= COLORBLIND_DEFICIENCY_LAST)
|
deficiency <= COLORBLIND_DEFICIENCY_LAST)
|
||||||
{
|
{
|
||||||
colorblind->deficiency = deficiency;
|
colorblind->deficiency = deficiency;
|
||||||
|
@ -456,12 +455,13 @@ cdisplay_colorblind_configure (GimpColorDisplay *display)
|
||||||
if (colorblind->hbox)
|
if (colorblind->hbox)
|
||||||
gtk_widget_destroy (colorblind->hbox);
|
gtk_widget_destroy (colorblind->hbox);
|
||||||
|
|
||||||
colorblind->hbox = gtk_hbox_new (FALSE, 2);
|
colorblind->hbox = gtk_hbox_new (FALSE, 4);
|
||||||
|
|
||||||
g_signal_connect (colorblind->hbox, "destroy",
|
g_signal_connect (colorblind->hbox, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&colorblind->hbox);
|
&colorblind->hbox);
|
||||||
|
|
||||||
label = gtk_label_new ( _("Color Deficiency Type:"));
|
label = gtk_label_new_with_mnemonic (_("Color _Deficiency Type:"));
|
||||||
gtk_box_pack_start (GTK_BOX (colorblind->hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (colorblind->hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
|
@ -470,9 +470,6 @@ cdisplay_colorblind_configure (GimpColorDisplay *display)
|
||||||
G_CALLBACK (colorblind_deficiency_callback),
|
G_CALLBACK (colorblind_deficiency_callback),
|
||||||
colorblind, colorblind->deficiency,
|
colorblind, colorblind->deficiency,
|
||||||
|
|
||||||
_("None (normal vision)"),
|
|
||||||
COLORBLIND_DEFICIENCY_NONE, NULL,
|
|
||||||
|
|
||||||
_("Protanopia (insensitivity to red)"),
|
_("Protanopia (insensitivity to red)"),
|
||||||
COLORBLIND_DEFICIENCY_PROTANOPIA, NULL,
|
COLORBLIND_DEFICIENCY_PROTANOPIA, NULL,
|
||||||
|
|
||||||
|
@ -488,6 +485,8 @@ cdisplay_colorblind_configure (GimpColorDisplay *display)
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (colorblind->optionmenu);
|
gtk_widget_show (colorblind->optionmenu);
|
||||||
|
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), colorblind->optionmenu);
|
||||||
|
|
||||||
return colorblind->hbox;
|
return colorblind->hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,9 +542,6 @@ cdisplay_colorblind_changed (GimpColorDisplay *display)
|
||||||
|
|
||||||
switch (colorblind->deficiency)
|
switch (colorblind->deficiency)
|
||||||
{
|
{
|
||||||
case COLORBLIND_DEFICIENCY_NONE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COLORBLIND_DEFICIENCY_DEUTERANOPIA:
|
case COLORBLIND_DEFICIENCY_DEUTERANOPIA:
|
||||||
/* find a,b,c for lam=575nm and lam=475 */
|
/* find a,b,c for lam=575nm and lam=475 */
|
||||||
colorblind->a1 = anchor_e[1] * anchor[8] - anchor_e[2] * anchor[7];
|
colorblind->a1 = anchor_e[1] * anchor[8] - anchor_e[2] * anchor[7];
|
||||||
|
|
|
@ -303,11 +303,12 @@ cdisplay_gamma_configure (GimpColorDisplay *display)
|
||||||
gtk_widget_destroy (gamma->hbox);
|
gtk_widget_destroy (gamma->hbox);
|
||||||
|
|
||||||
gamma->hbox = gtk_hbox_new (FALSE, 4);
|
gamma->hbox = gtk_hbox_new (FALSE, 4);
|
||||||
|
|
||||||
g_signal_connect (gamma->hbox, "destroy",
|
g_signal_connect (gamma->hbox, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&gamma->hbox);
|
&gamma->hbox);
|
||||||
|
|
||||||
label = gtk_label_new ( _("Gamma:"));
|
label = gtk_label_new_with_mnemonic (_("_Gamma:"));
|
||||||
gtk_box_pack_start (GTK_BOX (gamma->hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gamma->hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
|
@ -317,6 +318,8 @@ cdisplay_gamma_configure (GimpColorDisplay *display)
|
||||||
gtk_box_pack_start (GTK_BOX (gamma->hbox), spinbutton, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (gamma->hbox), spinbutton, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (spinbutton);
|
gtk_widget_show (spinbutton);
|
||||||
|
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||||
|
|
||||||
g_signal_connect (gamma->adjustment, "value_changed",
|
g_signal_connect (gamma->adjustment, "value_changed",
|
||||||
G_CALLBACK (gamma_configure_adj_callback),
|
G_CALLBACK (gamma_configure_adj_callback),
|
||||||
gamma);
|
gamma);
|
||||||
|
|
|
@ -299,12 +299,13 @@ cdisplay_contrast_configure (GimpColorDisplay *display)
|
||||||
if (contrast->hbox)
|
if (contrast->hbox)
|
||||||
gtk_widget_destroy (contrast->hbox);
|
gtk_widget_destroy (contrast->hbox);
|
||||||
|
|
||||||
contrast->hbox = gtk_hbox_new (FALSE, 2);
|
contrast->hbox = gtk_hbox_new (FALSE, 4);
|
||||||
|
|
||||||
g_signal_connect (contrast->hbox, "destroy",
|
g_signal_connect (contrast->hbox, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&contrast->hbox);
|
&contrast->hbox);
|
||||||
|
|
||||||
label = gtk_label_new ( _("Contrast Cycles:"));
|
label = gtk_label_new_with_mnemonic (_("Contrast C_ycles:"));
|
||||||
gtk_box_pack_start (GTK_BOX (contrast->hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (contrast->hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
|
@ -315,6 +316,8 @@ cdisplay_contrast_configure (GimpColorDisplay *display)
|
||||||
gtk_box_pack_start (GTK_BOX (contrast->hbox), spinbutton, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (contrast->hbox), spinbutton, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (spinbutton);
|
gtk_widget_show (spinbutton);
|
||||||
|
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||||
|
|
||||||
g_signal_connect (contrast->adjustment, "value_changed",
|
g_signal_connect (contrast->adjustment, "value_changed",
|
||||||
G_CALLBACK (contrast_configure_adj_callback),
|
G_CALLBACK (contrast_configure_adj_callback),
|
||||||
contrast);
|
contrast);
|
||||||
|
|
|
@ -335,7 +335,7 @@ cdisplay_proof_configure (GimpColorDisplay *display)
|
||||||
proof->filename, FALSE, FALSE);
|
proof->filename, FALSE, FALSE);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (proof->table), 0, 1,
|
gimp_table_attach_aligned (GTK_TABLE (proof->table), 0, 1,
|
||||||
_("_Profile:"), 1.0, 0.5,
|
_("_Profile:"), 1.0, 0.5,
|
||||||
entry, 1, TRUE);
|
entry, 1, FALSE);
|
||||||
|
|
||||||
g_signal_connect (entry, "filename-changed",
|
g_signal_connect (entry, "filename-changed",
|
||||||
G_CALLBACK (proof_file_callback),
|
G_CALLBACK (proof_file_callback),
|
||||||
|
|
Loading…
Reference in New Issue