comparison src/layout.c @ 1333:bdc19836c33d

Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
author zas_
date Fri, 27 Feb 2009 23:25:31 +0000
parents 4286f08079b6
children f97450e632a1
comparison
equal deleted inserted replaced
1332:4286f08079b6 1333:bdc19836c33d
400 layout_image_refresh(lw); 400 layout_image_refresh(lw);
401 } 401 }
402 402
403 static gchar *layout_color_name_parse(const gchar *name) 403 static gchar *layout_color_name_parse(const gchar *name)
404 { 404 {
405 if (!name) return g_strdup(_("Empty")); 405 if (!name || !*name) return g_strdup(_("Empty"));
406 return g_strdelimit(g_strdup(name), "_", '-'); 406 return g_strdelimit(g_strdup(name), "_", '-');
407 } 407 }
408 408
409 #endif /* HAVE_LCMS */ 409 #endif /* HAVE_LCMS */
410 410
425 gint active; 425 gint active;
426 gint input = 0; 426 gint input = 0;
427 gint screen = 0; 427 gint screen = 0;
428 gint use_image = 0; 428 gint use_image = 0;
429 gint from_image = 0; 429 gint from_image = 0;
430 gint image_profile;
430 gint i; 431 gint i;
431 432
432 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; 433 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
433 434
434 from_image = use_image && (layout_image_color_profile_get_from_image(lw) != COLOR_PROFILE_NONE); 435 image_profile = layout_image_color_profile_get_from_image(lw);
436 from_image = use_image && (image_profile != COLOR_PROFILE_NONE);
435 menu = popup_menu_short_lived(); 437 menu = popup_menu_short_lived();
436 438
437 active = layout_image_color_profile_get_use(lw); 439 active = layout_image_color_profile_get_use(lw);
438 menu_item_add_check(menu, _("Use _color profiles"), active, 440 menu_item_add_check(menu, _("Use _color profiles"), active,
439 G_CALLBACK(layout_color_menu_enable_cb), lw); 441 G_CALLBACK(layout_color_menu_enable_cb), lw);
452 { 454 {
453 case COLOR_PROFILE_SRGB: label = _("sRGB"); break; 455 case COLOR_PROFILE_SRGB: label = _("sRGB"); break;
454 case COLOR_PROFILE_ADOBERGB: label = _("AdobeRGB compatible"); break; 456 case COLOR_PROFILE_ADOBERGB: label = _("AdobeRGB compatible"); break;
455 default: label = "fixme"; break; 457 default: label = "fixme"; break;
456 } 458 }
457 buf = g_strdup_printf(_("Input _%d: %s"), i, label); 459 buf = g_strdup_printf(_("Input _%d: %s%s"), i, label, (i == image_profile) ? " *" : "");
458 item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item, 460 item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item,
459 buf, (input == i), 461 buf, (input == i),
460 G_CALLBACK(layout_color_menu_input_cb), lw); 462 G_CALLBACK(layout_color_menu_input_cb), lw);
461 g_free(buf); 463 g_free(buf);
462 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i)); 464 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i));
478 item = menu_item_add_radio(menu, item, 480 item = menu_item_add_radio(menu, item,
479 buf, (i + COLOR_PROFILE_FILE == input), 481 buf, (i + COLOR_PROFILE_FILE == input),
480 G_CALLBACK(layout_color_menu_input_cb), lw); 482 G_CALLBACK(layout_color_menu_input_cb), lw);
481 g_free(buf); 483 g_free(buf);
482 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE)); 484 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE));
483 gtk_widget_set_sensitive(item, active && !from_image && options->color_profile.input_file[i][0]); 485 gtk_widget_set_sensitive(item, active && !from_image && options->color_profile.input_file[i] && options->color_profile.input_file[i][0]);
484 } 486 }
485 487
486 menu_item_add_divider(menu); 488 menu_item_add_divider(menu);
487 489
488 item = menu_item_add_radio(menu, NULL, 490 item = menu_item_add_radio(menu, NULL,
494 496
495 item = menu_item_add_radio(menu, item, 497 item = menu_item_add_radio(menu, item,
496 _("_Screen profile"), (screen == 1), 498 _("_Screen profile"), (screen == 1),
497 G_CALLBACK(layout_color_menu_screen_cb), lw); 499 G_CALLBACK(layout_color_menu_screen_cb), lw);
498 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1)); 500 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
499 gtk_widget_set_sensitive(item, active && options->color_profile.screen_file[0]); 501 gtk_widget_set_sensitive(item, active && options->color_profile.screen_file && options->color_profile.screen_file[0]);
500 502
501 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); 503 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
502 #endif /* HAVE_LCMS */ 504 #endif /* HAVE_LCMS */
503 } 505 }
504 506