#define COLOR_MAN_H
typedef enum {
- COLOR_PROFILE_NONE = 0,
- COLOR_PROFILE_FILE,
- COLOR_PROFILE_SRGB,
+ COLOR_PROFILE_NONE = -1,
+ COLOR_PROFILE_MEM = -2,
+ COLOR_PROFILE_SRGB = 0,
COLOR_PROFILE_ADOBERGB,
- COLOR_PROFILE_MEM
+ COLOR_PROFILE_FILE,
} ColorManProfileType;
typedef enum {
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;
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
{
return FALSE;
}
+ imd->color_profile_from_image = COLOR_PROFILE_NONE;
if (imd->color_profile_use_image && exif)
{
{
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");
}
{
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");
}
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);
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 ||
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;
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);
#include "layout.h"
#include "image.h"
+#include "color-man.h"
#include "layout_config.h"
#include "layout_image.h"
#include "layout_util.h"
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);
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++)
{
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);
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
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);
#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"
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);
gint color_profile_input;
gint color_profile_screen;
gint color_profile_use_image;
+ gint color_profile_from_image;
gpointer cm;
AlterType delay_alter_type;