static GtkWidget * lcms_icc_combo_box_new (GimpColorConfig *config, const gchar *filename) { GtkWidget *combo; GtkWidget *dialog; gchar *history; gchar *label; gchar *name; const gchar *rgb_filename = NULL; cmsHPROFILE profile = NULL; dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile")); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (dialog, history); g_free (history); if (config->rgb_profile) { GError *error = NULL; profile = gimp_lcms_profile_open_from_file (config->rgb_profile, &error); if (! profile) { g_message ("%s", error->message); g_clear_error (&error); } else if (! gimp_lcms_profile_is_rgb (profile)) { g_message (_("Color profile '%s' is not for RGB color space."), gimp_filename_to_utf8 (config->rgb_profile)); cmsCloseProfile (profile); profile = NULL; } else { rgb_filename = config->rgb_profile; } } if (! profile) profile = gimp_lcms_create_srgb_profile (); name = gimp_lcms_profile_get_label (profile); label = g_strdup_printf (_("RGB workspace (%s)"), name); g_free (name); cmsCloseProfile (profile); gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo), rgb_filename, label); g_free (label); gimp_color_profile_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo), filename, NULL); return combo; }
static GtkWidget * cdisplay_proof_configure (GimpColorDisplay *display) { CdisplayProof *proof = CDISPLAY_PROOF (display); GtkWidget *table; GtkWidget *combo; GtkWidget *toggle; GtkWidget *dialog; gchar *history; table = gtk_table_new (3, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); dialog = gimp_color_profile_chooser_dialog_new (_("Choose an ICC Color Profile")); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (dialog, history); g_free (history); g_signal_connect (combo, "changed", G_CALLBACK (cdisplay_proof_profile_changed), proof); if (proof->profile) gimp_color_profile_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo), proof->profile, NULL); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("_Profile:"), 0.0, 0.5, combo, 1, FALSE); combo = gimp_prop_enum_combo_box_new (G_OBJECT (proof), "intent", 0, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("_Intent:"), 0.0, 0.5, combo, 1, FALSE); toggle = gimp_prop_check_button_new (G_OBJECT (proof), "black-point-compensation", _("_Black Point Compensation")); gtk_table_attach_defaults (GTK_TABLE (table), toggle, 1, 2, 2, 3); gtk_widget_show (toggle); return table; }
static GtkWidget * color_profile_combo_box_new (ProfileDialog *dialog) { GtkWidget *combo; GtkWidget *chooser; gchar *history; GimpColorProfile *profile; gboolean to_gray; gchar *label; GError *error = NULL; chooser = gimp_color_profile_chooser_dialog_new (_("Select Destination Profile"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (chooser, history); g_free (history); switch (dialog->dialog_type) { case COLOR_PROFILE_DIALOG_ASSIGN_PROFILE: case COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE: to_gray = (gimp_image_get_base_type (dialog->image) == GIMP_GRAY); break; case COLOR_PROFILE_DIALOG_CONVERT_TO_RGB: to_gray = FALSE; break; case COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY: to_gray = TRUE; break; default: g_return_val_if_reached (NULL); } profile = dialog->builtin_profile; if (to_gray) { label = g_strdup_printf (_("Built-in grayscale (%s)"), gimp_color_profile_get_label (profile)); profile = gimp_color_config_get_gray_color_profile (dialog->config, &error); } else { label = g_strdup_printf (_("Built-in RGB (%s)"), gimp_color_profile_get_label (profile)); profile = gimp_color_config_get_rgb_color_profile (dialog->config, &error); } gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), NULL, label); g_free (label); if (profile) { GFile *file; if (to_gray) { file = g_file_new_for_path (dialog->config->gray_profile); label = g_strdup_printf (_("Preferred grayscale (%s)"), gimp_color_profile_get_label (profile)); } else { file = g_file_new_for_path (dialog->config->rgb_profile); label = g_strdup_printf (_("Preferred RGB (%s)"), gimp_color_profile_get_label (profile)); } g_object_unref (profile); gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), file, label); g_object_unref (file); g_free (label); } else if (error) { gimp_message (dialog->image->gimp, G_OBJECT (dialog->dialog), GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), NULL, NULL); return combo; }
static GtkWidget * color_profile_combo_box_new (ProfileDialog *dialog) { GtkWidget *combo; GtkWidget *chooser; gchar *history; GimpColorProfile *profile; gchar *label; GError *error = NULL; chooser = gimp_color_profile_chooser_dialog_new (_("Select destination profile")); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (chooser, history); g_free (history); profile = gimp_image_get_builtin_color_profile (dialog->image); if (gimp_image_get_base_type (dialog->image) == GIMP_GRAY) { label = g_strdup_printf (_("Built-in grayscale (%s)"), gimp_color_profile_get_label (profile)); profile = gimp_color_config_get_gray_color_profile (dialog->config, &error); } else { label = g_strdup_printf (_("Built-in RGB (%s)"), gimp_color_profile_get_label (profile)); profile = gimp_color_config_get_rgb_color_profile (dialog->config, &error); } gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), NULL, label); g_free (label); if (profile) { GFile *file = g_file_new_for_path (dialog->config->rgb_profile); if (gimp_image_get_base_type (dialog->image) == GIMP_GRAY) { label = g_strdup_printf (_("Preferred grayscale (%s)"), gimp_color_profile_get_label (profile)); } else { label = g_strdup_printf (_("Preferred RGB (%s)"), gimp_color_profile_get_label (profile)); } g_object_unref (profile); gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), file, label); g_object_unref (file); g_free (label); } else if (error) { gimp_message (dialog->image->gimp, G_OBJECT (dialog->dialog), GIMP_MESSAGE_ERROR, "%s", error->message); g_clear_error (&error); } gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), NULL, NULL); return combo; }