Mercurial > geeqie.yaz
changeset 426:9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
author | nadvornik |
---|---|
date | Sat, 19 Apr 2008 17:55:41 +0000 |
parents | 10efd67e5d3c |
children | 134beb10d916 |
files | src/color-man.h src/image.c src/image.h src/layout.c src/layout_image.c src/layout_image.h src/preferences.c src/typedefs.h |
diffstat | 8 files changed, 51 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/color-man.h Sat Apr 19 17:14:03 2008 +0000 +++ b/src/color-man.h Sat Apr 19 17:55:41 2008 +0000 @@ -14,11 +14,11 @@ #define COLOR_MAN_H typedef enum { - COLOR_PROFILE_NONE = 0, + COLOR_PROFILE_NONE = -1, + COLOR_PROFILE_MEM = -2, + COLOR_PROFILE_SRGB = 0, + COLOR_PROFILE_ADOBERGB, COLOR_PROFILE_FILE, - COLOR_PROFILE_SRGB, - COLOR_PROFILE_ADOBERGB, - COLOR_PROFILE_MEM } ColorManProfileType; typedef enum {
--- a/src/image.c Sat Apr 19 17:14:03 2008 +0000 +++ b/src/image.c Sat Apr 19 17:55:41 2008 +0000 @@ -339,8 +339,8 @@ if (imd->cm) return FALSE; - if (imd->color_profile_input >= 1 && - imd->color_profile_input <= COLOR_PROFILE_INPUTS) + if (imd->color_profile_input >= COLOR_PROFILE_FILE && + imd->color_profile_input < COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) { gint n; @@ -350,9 +350,10 @@ input_type = COLOR_PROFILE_FILE; input_file = options->color_profile.input_file[n]; } - else if (imd->color_profile_input == 0) + else if (imd->color_profile_input >= COLOR_PROFILE_SRGB && + imd->color_profile_input < COLOR_PROFILE_FILE) { - input_type = COLOR_PROFILE_SRGB; + input_type = imd->color_profile_input; input_file = NULL; } else @@ -375,6 +376,7 @@ { return FALSE; } + imd->color_profile_from_image = COLOR_PROFILE_NONE; if (imd->color_profile_use_image && exif) { @@ -392,6 +394,7 @@ { input_type = COLOR_PROFILE_SRGB; input_file = NULL; + imd->color_profile_from_image = COLOR_PROFILE_SRGB; if (debug) printf("Found EXIF ColorSpace of sRGB\n"); } @@ -399,6 +402,7 @@ { input_type = COLOR_PROFILE_ADOBERGB; input_file = NULL; + imd->color_profile_from_image = COLOR_PROFILE_ADOBERGB; if (debug) printf("Found EXIF ColorSpace of AdobeRGB\n"); } @@ -412,6 +416,7 @@ unsigned char *data; guint data_len; if (debug) printf("Found embedded color profile\n"); + imd->color_profile_from_image = COLOR_PROFILE_MEM; data = (unsigned char *) exif_item_get_data(item, &data_len); @@ -1744,6 +1749,13 @@ return imd->color_profile_enable; } +gint image_color_profile_get_from_image(ImageWindow *imd) +{ + if (!imd) return FALSE; + + return imd->color_profile_from_image; +} + void image_set_delay_flip(ImageWindow *imd, gint delay) { if (!imd || @@ -2002,6 +2014,7 @@ imd->color_profile_input = 0; imd->color_profile_screen = 0; imd->color_profile_use_image = FALSE; + imd->color_profile_from_image = COLOR_PROFILE_NONE; imd->auto_refresh_id = -1; imd->auto_refresh_interval = -1;
--- a/src/image.h Sat Apr 19 17:14:03 2008 +0000 +++ b/src/image.h Sat Apr 19 17:55:41 2008 +0000 @@ -104,6 +104,7 @@ gint *use_image); void image_color_profile_set_use(ImageWindow *imd, gint enable); gint image_color_profile_get_use(ImageWindow *imd); +gint image_color_profile_get_from_image(ImageWindow *imd); /* set delayed page flipping */ void image_set_delay_flip(ImageWindow *imd, gint delay);
--- a/src/layout.c Sat Apr 19 17:14:03 2008 +0000 +++ b/src/layout.c Sat Apr 19 17:55:41 2008 +0000 @@ -13,6 +13,7 @@ #include "layout.h" #include "image.h" +#include "color-man.h" #include "layout_config.h" #include "layout_image.h" #include "layout_util.h" @@ -389,10 +390,12 @@ gint input = 0; gint screen = 0; gint use_image = 0; + gint from_image = 0; gint i; if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; + from_image = use_image && (layout_image_color_profile_get_from_image(lw) != COLOR_PROFILE_NONE); menu = popup_menu_short_lived(); active = layout_image_color_profile_get_use(lw); @@ -405,15 +408,18 @@ G_CALLBACK(layout_color_menu_use_image_cb), lw); gtk_widget_set_sensitive(item, active); - front = g_strdup_printf(_("Input _%d:"), 0); - buf = g_strdup_printf("%s %s", front, "sRGB"); - g_free(front); - item = menu_item_add_radio(menu, NULL, - buf, (options->color_profile.input_type == 0), + for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++) + { + front = g_strdup_printf(_("Input _%d:"), i); + buf = g_strdup_printf("%s %s", front, i == COLOR_PROFILE_SRGB ? _("sRGB") : _("AdobeRGB compatible")); + g_free(front); + item = menu_item_add_radio(menu, (i == 0) ? NULL : item, + buf, (input == i), G_CALLBACK(layout_color_menu_input_cb), lw); - g_free(buf); - g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0)); - gtk_widget_set_sensitive(item, active); + g_free(buf); + g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i)); + gtk_widget_set_sensitive(item, active && !from_image); + } for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { @@ -422,18 +428,18 @@ name = options->color_profile.input_name[i]; if (!name) name = filename_from_path(options->color_profile.input_file[i]); - front = g_strdup_printf(_("Input _%d:"), i + 1); + front = g_strdup_printf(_("Input _%d:"), i + COLOR_PROFILE_FILE); end = layout_color_name_parse(name); buf = g_strdup_printf("%s %s", front, end); g_free(front); g_free(end); item = menu_item_add_radio(menu, item, - buf, (i + 1 == input), + buf, (i + COLOR_PROFILE_FILE == input), G_CALLBACK(layout_color_menu_input_cb), lw); g_free(buf); - g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + 1)); - gtk_widget_set_sensitive(item, active && options->color_profile.input_file[i]); + g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE)); + gtk_widget_set_sensitive(item, active && options->color_profile.input_file[i] && !from_image); } menu_item_add_divider(menu);
--- a/src/layout_image.c Sat Apr 19 17:14:03 2008 +0000 +++ b/src/layout_image.c Sat Apr 19 17:55:41 2008 +0000 @@ -1305,6 +1305,13 @@ return image_color_profile_get_use(lw->image); } +gint layout_image_color_profile_get_from_image(LayoutWindow *lw) +{ + if (!layout_valid(&lw)) return FALSE; + + return image_color_profile_get_from_image(lw->image); +} + /* *---------------------------------------------------------------------------- * list walkers
--- a/src/layout_image.h Sat Apr 19 17:14:03 2008 +0000 +++ b/src/layout_image.h Sat Apr 19 17:55:41 2008 +0000 @@ -35,6 +35,7 @@ gint *use_image); void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable); gint layout_image_color_profile_get_use(LayoutWindow *lw); +gint layout_image_color_profile_get_from_image(LayoutWindow *lw); const gchar *layout_image_get_path(LayoutWindow *lw);
--- a/src/preferences.c Sat Apr 19 17:14:03 2008 +0000 +++ b/src/preferences.c Sat Apr 19 17:55:41 2008 +0000 @@ -18,6 +18,7 @@ #include "filelist.h" #include "fullscreen.h" #include "image.h" +#include "color-man.h" #include "img-view.h" #include "layout_config.h" #include "layout_util.h" @@ -1451,7 +1452,7 @@ GtkWidget *entry; gchar *buf; - buf = g_strdup_printf("Input %d:", i + 1); + buf = g_strdup_printf("Input %d:", i + COLOR_PROFILE_FILE); pref_table_label(table, 0, i + 1, buf, 1.0); g_free(buf);