static void cdisplay_proof_profile_changed (GtkWidget *combo, CdisplayProof *proof) { gchar *profile; profile = gimp_color_profile_combo_box_get_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo)); g_object_set (proof, "profile", profile, NULL); g_free (profile); }
static GimpPDBStatusType lcms_dialog (GimpColorConfig *config, gint32 image, gboolean apply, LcmsValues *values) { GimpColorProfileComboBox *box; GtkWidget *dialog; GtkWidget *main_vbox; GtkWidget *frame; GtkWidget *label; GtkWidget *combo; cmsHPROFILE src_profile; gchar *name; gboolean success = FALSE; gboolean run; src_profile = lcms_image_get_profile (config, image, NULL); if (src_profile && ! lcms_icc_profile_is_rgb (src_profile)) { g_printerr ("lcms: attached color profile is not for RGB color space " "(skipping)\n"); cmsCloseProfile (src_profile); src_profile = NULL; } if (! src_profile) src_profile = cmsCreate_sRGBProfile (); gimp_ui_init (PLUG_IN_BINARY, FALSE); dialog = gimp_dialog_new (apply ? _("Convert to ICC Color Profile") : _("Assign ICC Color Profile"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, apply ? PLUG_IN_PROC_APPLY : PLUG_IN_PROC_SET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, apply ? GTK_STOCK_CONVERT : _("_Assign"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dialog)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); frame = gimp_frame_new (_("Current Color Profile")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); name = lcms_icc_profile_get_desc (src_profile); if (! name) name = lcms_icc_profile_get_name (src_profile); label = gtk_label_new (name); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_container_add (GTK_CONTAINER (frame), label); gtk_widget_show (label); g_free (name); frame = gimp_frame_new (apply ? _("Convert to") : _("Assign")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = lcms_icc_combo_box_new (config, NULL); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); box = GIMP_COLOR_PROFILE_COMBO_BOX (combo); if (apply) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *toggle; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("_Rendering Intent:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gimp_enum_combo_box_new (GIMP_TYPE_COLOR_RENDERING_INTENT); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), values->intent, G_CALLBACK (gimp_int_combo_box_get_active), &values->intent); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); toggle = gtk_check_button_new_with_mnemonic (_("_Black Point Compensation")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), values->bpc); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &values->bpc); } while ((run = gimp_dialog_run (GIMP_DIALOG (dialog))) == GTK_RESPONSE_OK) { gchar *filename = gimp_color_profile_combo_box_get_active (box); cmsHPROFILE dest_profile; gtk_widget_set_sensitive (dialog, FALSE); if (filename) { dest_profile = lcms_load_profile (filename, NULL); } else { dest_profile = cmsCreate_sRGBProfile (); } if (dest_profile) { if (lcms_icc_profile_is_rgb (dest_profile)) { if (apply) success = lcms_image_apply_profile (image, src_profile, dest_profile, filename, values->intent, values->bpc); else success = lcms_image_set_profile (image, dest_profile, filename, TRUE); } else { gimp_message (_("Destination profile is not for RGB color space.")); } cmsCloseProfile (dest_profile); } if (success) break; else gtk_widget_set_sensitive (dialog, TRUE); } gtk_widget_destroy (dialog); cmsCloseProfile (src_profile); return (run ? (success ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR) : GIMP_PDB_CANCEL); }