static void save_restart_update (GtkAdjustment *adjustment, GtkWidget *toggle) { if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))) jsvals.restart = gtk_adjustment_get_value (adjustment); else jsvals.restart = 0; gtk_widget_set_sensitive (restart_markers_label, jsvals.restart); gtk_widget_set_sensitive (restart_markers_scale, jsvals.restart); make_preview (); }
static void subsampling_changed (GtkWidget *combo, GtkObject *entry) { gint value; gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo), &value); jsvals.subsmp = value; /* smoothing is not supported with nonstandard sampling ratios */ gimp_scale_entry_set_sensitive (entry, jsvals.subsmp != JPEG_SUBSAMPLING_2x1_1x1_1x1 && jsvals.subsmp != JPEG_SUBSAMPLING_1x2_1x1_1x1); make_preview (); }
void userlayout::on_spinBox_valueChanged(int arg1) { ul_hor=arg1; make_preview(); }
gboolean save_dialog (void) { JpegSaveGui pg; GtkWidget *dialog; GtkWidget *vbox; GtkObject *entry; GtkWidget *table; GtkWidget *table2; GtkWidget *tabledefaults; GtkWidget *expander; GtkWidget *frame; GtkWidget *toggle; GtkWidget *spinbutton; GtkWidget *label; GtkWidget *combo; GtkWidget *text_view; GtkTextBuffer *text_buffer; GtkWidget *scrolled_window; GtkWidget *button; gchar *text; gint row; dialog = gimp_export_dialog_new (_("JPEG"), PLUG_IN_BINARY, SAVE_PROC); g_signal_connect (dialog, "response", G_CALLBACK (save_dialog_response), &pg); g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_box_pack_start (GTK_BOX (gimp_export_dialog_get_content_area (dialog)), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); pg.quality = entry = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("_Quality:"), SCALE_WIDTH, 0, jsvals.quality, 0.0, 100.0, 1.0, 10.0, 0, TRUE, 0.0, 0.0, _("JPEG quality parameter"), "file-jpeg-save-quality"); g_signal_connect (entry, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &jsvals.quality); g_signal_connect (entry, "value-changed", G_CALLBACK (make_preview), NULL); preview_size = gtk_label_new (_("File size: unknown")); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_label_set_ellipsize (GTK_LABEL (preview_size), PANGO_ELLIPSIZE_END); gimp_label_set_attributes (GTK_LABEL (preview_size), PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, -1); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_widget_show (preview_size); gimp_help_set_help_data (preview_size, _("Enable preview to obtain the file size."), NULL); pg.preview = toggle = gtk_check_button_new_with_mnemonic (_("Sho_w preview in image window")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.preview); 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), &jsvals.preview); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); text = g_strdup_printf ("<b>%s</b>", _("_Advanced Options")); expander = gtk_expander_new_with_mnemonic (text); gtk_expander_set_use_markup (GTK_EXPANDER (expander), TRUE); g_free (text); gtk_box_pack_start (GTK_BOX (vbox), expander, TRUE, TRUE, 0); gtk_widget_show (expander); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_add (GTK_CONTAINER (expander), vbox); gtk_widget_show (vbox); frame = gimp_frame_new ("<expander>"); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); table = gtk_table_new (4, 8, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12); gtk_container_add (GTK_CONTAINER (frame), table); table2 = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table2), 6); gtk_table_attach (GTK_TABLE (table), table2, 2, 6, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (table2); pg.smoothing = entry = gimp_scale_entry_new (GTK_TABLE (table2), 0, 0, _("S_moothing:"), 100, 0, jsvals.smoothing, 0.0, 1.0, 0.01, 0.1, 2, TRUE, 0.0, 0.0, NULL, "file-jpeg-save-smoothing"); g_signal_connect (entry, "value-changed", G_CALLBACK (gimp_double_adjustment_update), &jsvals.smoothing); g_signal_connect (entry, "value-changed", G_CALLBACK (make_preview), NULL); restart_markers_label = gtk_label_new (_("Interval (MCU rows):")); gtk_misc_set_alignment (GTK_MISC (restart_markers_label), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), restart_markers_label, 4, 5, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_widget_show (restart_markers_label); pg.scale_data = (GtkAdjustment *) gtk_adjustment_new (((jsvals.restart == 0) ? DEFAULT_RESTART_MCU_ROWS : jsvals.restart), 1.0, 64.0, 1.0, 1.0, 0); pg.restart = restart_markers_scale = spinbutton = gtk_spin_button_new (pg.scale_data, 1.0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); gtk_table_attach (GTK_TABLE (table), spinbutton, 5, 6, 1, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (spinbutton); pg.use_restart_markers = toggle = gtk_check_button_new_with_mnemonic (_("Use _restart markers")); gtk_table_attach (GTK_TABLE (table), toggle, 2, 4, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.restart); gtk_widget_set_sensitive (restart_markers_label, jsvals.restart); gtk_widget_set_sensitive (restart_markers_scale, jsvals.restart); g_signal_connect (pg.scale_data, "value-changed", G_CALLBACK (save_restart_update), toggle); pg.handler_id_restart = g_signal_connect_swapped (toggle, "toggled", G_CALLBACK (save_restart_update), pg.scale_data); row = 0; /* Optimize */ pg.optimize = toggle = gtk_check_button_new_with_mnemonic (_("_Optimize")); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.optimize); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.optimize); if (arithc_supported) gtk_widget_set_sensitive (toggle, !jsvals.arithmetic_coding); row++; if (arithc_supported) { /* Arithmetic coding */ pg.arithmetic_coding = toggle = gtk_check_button_new_with_mnemonic (_("Use arithmetic _coding")); gtk_widget_set_tooltip_text (toggle, _("Older software may have trouble opening " "arithmetic-coded images")); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.arithmetic_coding); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); g_signal_connect (toggle, "toggled", G_CALLBACK (toggle_arithmetic_coding), pg.optimize); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.arithmetic_coding); row++; } /* Progressive */ pg.progressive = toggle = gtk_check_button_new_with_mnemonic (_("_Progressive")); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.progressive); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.progressive); row++; /* Save EXIF data */ pg.save_exif = toggle = gtk_check_button_new_with_mnemonic (_("Save _Exif data")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.save_exif); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.save_exif); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); gtk_widget_set_sensitive (toggle, TRUE); row++; /* Save thumbnail */ pg.save_thumbnail = toggle = gtk_check_button_new_with_mnemonic (_("Save _thumbnail")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.save_thumbnail); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.save_thumbnail); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); row++; /* XMP metadata */ pg.save_xmp = toggle = gtk_check_button_new_with_mnemonic (_("Save _XMP data")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.save_xmp); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.save_xmp); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); gtk_widget_set_sensitive (toggle, TRUE); row++; /* IPTC metadata */ pg.save_iptc = toggle = gtk_check_button_new_with_mnemonic (_("Save _IPTC data")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.save_iptc); gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.save_iptc); g_signal_connect (toggle, "toggled", G_CALLBACK (make_preview), NULL); gtk_widget_set_sensitive (toggle, TRUE); row++; /* custom quantization tables - now used also for original quality */ pg.use_orig_quality = toggle = gtk_check_button_new_with_mnemonic (_("_Use quality settings from original " "image")); gtk_table_attach (GTK_TABLE (table), toggle, 0, 4, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (toggle); gimp_help_set_help_data (toggle, _("If the original image was loaded from a JPEG " "file using non-standard quality settings " "(quantization tables), enable this option to " "get almost the same quality and file size."), NULL); g_signal_connect (toggle, "toggled", G_CALLBACK (gimp_toggle_button_update), &jsvals.use_orig_quality); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), jsvals.use_orig_quality && (orig_quality > 0)); gtk_widget_set_sensitive (toggle, (orig_quality > 0)); /* changing quality disables custom quantization tables, and vice-versa */ g_signal_connect (pg.quality, "value-changed", G_CALLBACK (quality_changed), pg.use_orig_quality); g_signal_connect (pg.use_orig_quality, "toggled", G_CALLBACK (use_orig_qual_changed), pg.quality); /* Subsampling */ label = gtk_label_new_with_mnemonic (_("Su_bsampling:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); pg.subsmp = combo = gimp_int_combo_box_new (_("4:4:4 (best quality)"), JPEG_SUBSAMPLING_1x1_1x1_1x1, _("4:2:2 horizontal (chroma halved)"), JPEG_SUBSAMPLING_2x1_1x1_1x1, _("4:2:2 vertical (chroma halved)"), JPEG_SUBSAMPLING_1x2_1x1_1x1, _("4:2:0 (chroma quartered)"), JPEG_SUBSAMPLING_2x2_1x1_1x1, NULL); gtk_table_attach (GTK_TABLE (table), combo, 3, 6, 2, 3, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_widget_show (combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); if (gimp_drawable_is_rgb (drawable_ID_global)) { gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), jsvals.subsmp, G_CALLBACK (subsampling_changed), entry); g_signal_connect (pg.use_orig_quality, "toggled", G_CALLBACK (use_orig_qual_changed2), pg.subsmp); } else { gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), JPEG_SUBSAMPLING_1x1_1x1_1x1); gtk_widget_set_sensitive (combo, FALSE); } /* DCT method */ label = gtk_label_new_with_mnemonic (_("_DCT method:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 3, 4, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); pg.dct = combo = gimp_int_combo_box_new (_("Fast Integer"), 1, _("Integer"), 0, _("Floating-Point"), 2, NULL); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), jsvals.dct); gtk_table_attach (GTK_TABLE (table), combo, 3, 6, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_widget_show (combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); g_signal_connect (combo, "changed", G_CALLBACK (gimp_int_combo_box_get_active), &jsvals.dct); g_signal_connect (combo, "changed", G_CALLBACK (make_preview), NULL); frame = gimp_frame_new (_("Comment")); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_size_request (scrolled_window, 250, 50); gtk_container_add (GTK_CONTAINER (frame), scrolled_window); gtk_widget_show (scrolled_window); pg.text_buffer = text_buffer = gtk_text_buffer_new (NULL); if (image_comment) gtk_text_buffer_set_text (text_buffer, image_comment, -1); text_view = gtk_text_view_new_with_buffer (text_buffer); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gtk_widget_show (text_view); g_object_unref (text_buffer); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_box_pack_start (GTK_BOX (gimp_export_dialog_get_content_area (dialog)), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); tabledefaults = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (tabledefaults), 6); gtk_box_pack_start (GTK_BOX (vbox), tabledefaults, FALSE, FALSE, 0); gtk_widget_show (tabledefaults); button = gtk_button_new_with_mnemonic (_("_Load Defaults")); gtk_table_attach (GTK_TABLE (tabledefaults), button, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show (button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (load_gui_defaults), &pg); button = gtk_button_new_with_mnemonic (_("Sa_ve Defaults")); gtk_table_attach (GTK_TABLE (tabledefaults), button, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show (button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (save_defaults), &pg); gtk_widget_show (frame); gtk_widget_show (table); gtk_widget_show (dialog); make_preview (); pg.run = FALSE; gtk_main (); destroy_preview (); return pg.run; }