Fix #245: Zoom settings on status bar
[geeqie.git] / src / preferences.c
index da88313..57f3e7b 100644 (file)
 
 #include <math.h>
 
+#ifdef HAVE_LCMS
+#ifdef HAVE_LCMS2
+#include <lcms2.h>
+#else
+#include <lcms.h>
+#endif
+#endif
 
 #define EDITOR_NAME_MAX_LENGTH 32
 #define EDITOR_COMMAND_MAX_LENGTH 1024
@@ -209,6 +216,7 @@ static void config_window_apply(void)
        if (options->file_filter.show_parent_directory != c_options->file_filter.show_parent_directory) refresh = TRUE;
        if (options->file_filter.show_dot_directory != c_options->file_filter.show_dot_directory) refresh = TRUE;
        if (options->file_sort.case_sensitive != c_options->file_sort.case_sensitive) refresh = TRUE;
+       if (options->file_sort.natural != c_options->file_sort.natural) refresh = TRUE;
        if (options->file_filter.disable_file_extension_checks != c_options->file_filter.disable_file_extension_checks) refresh = TRUE;
        if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE;
 
@@ -253,6 +261,7 @@ static void config_window_apply(void)
        options->file_filter.disable_file_extension_checks = c_options->file_filter.disable_file_extension_checks;
 
        options->file_sort.case_sensitive = c_options->file_sort.case_sensitive;
+       options->file_sort.natural = c_options->file_sort.natural;
        options->file_filter.disable = c_options->file_filter.disable;
 
        config_entry_to_option(sidecar_ext_entry, &options->sidecar.ext, NULL);
@@ -267,8 +276,6 @@ static void config_window_apply(void)
 
        options->file_ops.enable_in_place_rename = c_options->file_ops.enable_in_place_rename;
 
-       options->collections.rectangular_selection = c_options->collections.rectangular_selection;
-
        options->image.tile_cache_max = c_options->image.tile_cache_max;
        options->image.image_cache_max = c_options->image.image_cache_max;
 
@@ -290,6 +297,9 @@ static void config_window_apply(void)
                view_window_colors_update();
                }
 
+       options->image.alpha_color_1 = c_options->image.alpha_color_1;
+       options->image.alpha_color_2 = c_options->image.alpha_color_2;
+
        options->fullscreen.screen = c_options->fullscreen.screen;
        options->fullscreen.clean_flip = c_options->fullscreen.clean_flip;
        options->fullscreen.disable_saver = c_options->fullscreen.disable_saver;
@@ -309,7 +319,6 @@ static void config_window_apply(void)
        options->image_overlay.background_blue = c_options->image_overlay.background_blue;
        options->image_overlay.background_alpha = c_options->image_overlay.background_alpha;
        options->update_on_time_change = c_options->update_on_time_change;
-       options->image.exif_rotate_enable = c_options->image.exif_rotate_enable;
        options->image.exif_proof_rotate_enable = c_options->image.exif_proof_rotate_enable;
 
        options->duplicates_similarity_threshold = c_options->duplicates_similarity_threshold;
@@ -328,6 +337,7 @@ static void config_window_apply(void)
        options->metadata.save_legacy_format = c_options->metadata.save_legacy_format;
        options->metadata.sync_grouped_files = c_options->metadata.sync_grouped_files;
        options->metadata.confirm_write = c_options->metadata.confirm_write;
+       options->metadata.sidecar_extended_name = c_options->metadata.sidecar_extended_name;
        options->metadata.confirm_timeout = c_options->metadata.confirm_timeout;
        options->metadata.confirm_after_timeout = c_options->metadata.confirm_after_timeout;
        options->metadata.confirm_on_image_change = c_options->metadata.confirm_on_image_change;
@@ -368,6 +378,11 @@ static void config_window_apply(void)
                }
        config_entry_to_option(color_profile_screen_file_entry, &options->color_profile.screen_file, NULL);
        options->color_profile.use_x11_screen_profile = c_options->color_profile.use_x11_screen_profile;
+       if (options->color_profile.render_intent != c_options->color_profile.render_intent)
+               {
+               options->color_profile.render_intent = c_options->color_profile.render_intent;
+               color_man_update();
+               }
 #endif
 
        image_options_sync();
@@ -394,6 +409,28 @@ static void config_window_close_cb(GtkWidget *widget, gpointer data)
        filter_store = NULL;
 }
 
+static void config_window_help_cb(GtkWidget *widget, gpointer data)
+{
+       GtkWidget *notebook = data;
+       gint i;
+
+       static gchar *html_section[] =
+       {
+       "GuideOptionsGeneral.html",
+       "GuideOptionsImage.html",
+       "GuideOptionsWindow.html",
+       "GuideOptionsKeyboard.html",
+       "GuideOptionsFiltering.html",
+       "GuideOptionsMetadata.html",
+       "GuideOptionsColor.html",
+       "GuideOptionsSteroa.html",
+       "GuideOptionsBehavior.html"
+       };
+
+       i = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+       help_window_show(html_section[i]);
+}
+
 static gboolean config_window_delete(GtkWidget *widget, GdkEventAny *event, gpointer data)
 {
        config_window_close_cb(NULL, NULL);
@@ -1037,7 +1074,7 @@ static void image_overlay_default_template_cb(GtkWidget *widget, gpointer data)
 
 static void image_overlay_help_cb(GtkWidget *widget, gpointer data)
 {
-       help_window_show("overlay");
+       help_window_show("GuideOptionsWindow.html#OverlayScreenDisplay");
 }
 
 static void image_overlay_set_font_cb(GtkWidget *widget, gpointer data)
@@ -1476,33 +1513,6 @@ static void config_tab_image(GtkWidget *notebook)
                             G_CALLBACK(zoom_increment_cb), NULL);
        gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS);
 
-       group = pref_group_new(vbox, FALSE, _("When new image is selected:"), GTK_ORIENTATION_HORIZONTAL);
-
-       vbox2 = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
-       c_options->image.zoom_mode = options->image.zoom_mode;
-       button = pref_radiobutton_new(vbox2, NULL, _("Zoom to original size"),
-                                     (options->image.zoom_mode == ZOOM_RESET_ORIGINAL),
-                                     G_CALLBACK(zoom_mode_cb), GINT_TO_POINTER(ZOOM_RESET_ORIGINAL));
-       button = pref_radiobutton_new(vbox2, button, _("Fit image to window"),
-                                     (options->image.zoom_mode == ZOOM_RESET_FIT_WINDOW),
-                                     G_CALLBACK(zoom_mode_cb), GINT_TO_POINTER(ZOOM_RESET_FIT_WINDOW));
-       button = pref_radiobutton_new(vbox2, button, _("Leave Zoom at previous setting"),
-                                     (options->image.zoom_mode == ZOOM_RESET_NONE),
-                                     G_CALLBACK(zoom_mode_cb), GINT_TO_POINTER(ZOOM_RESET_NONE));
-
-       vbox2 = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
-       c_options->image.scroll_reset_method = options->image.scroll_reset_method;
-       button = pref_radiobutton_new(vbox2, NULL, _("Scroll to top left corner"),
-                                     (options->image.scroll_reset_method == SCROLL_RESET_TOPLEFT),
-                                     G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_TOPLEFT));
-       button = pref_radiobutton_new(vbox2, button, _("Scroll to image center"),
-                                     (options->image.scroll_reset_method == SCROLL_RESET_CENTER),
-                                     G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_CENTER));
-       button = pref_radiobutton_new(vbox2, button, _("Keep the region from previous image"),
-                                     (options->image.scroll_reset_method == SCROLL_RESET_NOCHANGE),
-                                     G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_NOCHANGE));
-
-
        group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL);
 
        pref_checkbox_new_int(group, _("Use custom border color in window mode"),
@@ -1514,10 +1524,18 @@ static void config_tab_image(GtkWidget *notebook)
        pref_color_button_new(group, _("Border color"), &options->image.border_color,
                              G_CALLBACK(pref_color_button_set_cb), &c_options->image.border_color);
 
-       group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL);
+       c_options->image.border_color = options->image.border_color;
+
+       pref_color_button_new(group, _("Alpha channel color 1"), &options->image.alpha_color_1,
+                             G_CALLBACK(pref_color_button_set_cb), &c_options->image.alpha_color_1);
+
+       pref_color_button_new(group, _("Alpha channel color 2"), &options->image.alpha_color_2,
+                             G_CALLBACK(pref_color_button_set_cb), &c_options->image.alpha_color_2);
 
-       pref_checkbox_new_int(group, _("Auto rotate image using Exif information"),
-                             options->image.exif_rotate_enable, &c_options->image.exif_rotate_enable);
+       c_options->image.alpha_color_1 = options->image.alpha_color_1;
+       c_options->image.alpha_color_2 = options->image.alpha_color_2;
+
+       group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL);
 
        pref_checkbox_new_int(group, _("Auto rotate proofs using Exif information"),
                              options->image.exif_proof_rotate_enable, &c_options->image.exif_proof_rotate_enable);
@@ -1692,6 +1710,8 @@ static void config_tab_files(GtkWidget *notebook)
                              options->file_filter.show_parent_directory, &c_options->file_filter.show_parent_directory);
        pref_checkbox_new_int(group, _("Case sensitive sort"),
                              options->file_sort.case_sensitive, &c_options->file_sort.case_sensitive);
+       pref_checkbox_new_int(group, _("Natural sort order"),
+                                         options->file_sort.natural, &c_options->file_sort.natural);
        pref_checkbox_new_int(group, _("Disable file extension checks"),
                              options->file_filter.disable_file_extension_checks, &c_options->file_filter.disable_file_extension_checks);
 
@@ -1876,6 +1896,9 @@ static void config_tab_metadata(GtkWidget *notebook)
        pref_checkbox_new_int(hbox, _("Ask before writing to image files"),
                              options->metadata.confirm_write, &c_options->metadata.confirm_write);
 
+       pref_checkbox_new_int(hbox, _("Create sidecar files named image.ext.xmp (as opposed to image.xmp)"),
+                             options->metadata.sidecar_extended_name, &c_options->metadata.sidecar_extended_name);
+
        group = pref_group_new(vbox, FALSE, _("Step 2 and 3: write to Geeqie private files"), GTK_ORIENTATION_VERTICAL);
 #ifndef HAVE_EXIV2
        gtk_widget_set_sensitive(group, FALSE);
@@ -1917,6 +1940,63 @@ static void config_tab_metadata(GtkWidget *notebook)
 }
 
 /* metadata tab */
+#ifdef HAVE_LCMS
+static void intent_menu_cb(GtkWidget *combo, gpointer data)
+{
+       gint *option = data;
+
+       switch (gtk_combo_box_get_active(GTK_COMBO_BOX(combo)))
+               {
+               case 0:
+               default:
+                       *option = INTENT_PERCEPTUAL;
+                       break;
+               case 1:
+                       *option = INTENT_RELATIVE_COLORIMETRIC;
+                       break;
+               case 2:
+                       *option = INTENT_SATURATION;
+                       break;
+               case 3:
+                       *option = INTENT_ABSOLUTE_COLORIMETRIC;
+                       break;
+               }
+}
+
+static void add_intent_menu(GtkWidget *table, gint column, gint row, const gchar *text,
+                            gint option, gint *option_c)
+{
+       GtkWidget *combo;
+       gint current = 0;
+
+       *option_c = option;
+
+       pref_table_label(table, column, row, text, 0.0);
+
+       combo = gtk_combo_box_text_new();
+
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Perceptual"));
+       if (option == INTENT_PERCEPTUAL) current = 0;
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Relative Colorimetric"));
+       if (option == INTENT_RELATIVE_COLORIMETRIC) current = 1;
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Saturation"));
+       if (option == INTENT_SATURATION) current = 2;
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Absolute Colorimetric"));
+       if (option == INTENT_ABSOLUTE_COLORIMETRIC) current = 3;
+
+       gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
+
+       gtk_widget_set_tooltip_text(combo,"Refer to the lcms documentation for the defaults used when the selected Intent is not available");
+
+       g_signal_connect(G_OBJECT(combo), "changed",
+                        G_CALLBACK(intent_menu_cb), option_c);
+
+       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1,
+                        GTK_EXPAND | GTK_FILL, 0, 0, 0);
+       gtk_widget_show(combo);
+}
+#endif
+
 static void config_tab_color(GtkWidget *notebook)
 {
        GtkWidget *label;
@@ -1988,9 +2068,13 @@ static void config_tab_color(GtkWidget *notebook)
                                     options->color_profile.screen_file, NULL, NULL);
        tab_completion_add_select_button(color_profile_screen_file_entry, _("Select color profile"), FALSE);
        gtk_widget_set_size_request(color_profile_screen_file_entry, 160, -1);
+#ifdef HAVE_LCMS
+       add_intent_menu(table, 0, 1, _("Render Intent:"), options->color_profile.render_intent, &c_options->color_profile.render_intent);
+#endif
        gtk_table_attach(GTK_TABLE(table), tabcomp, 1, 2,
                         0, 1,
                         GTK_FILL | GTK_EXPAND, 0, 0, 0);
+
        gtk_widget_show(tabcomp);
 }
 
@@ -2048,9 +2132,6 @@ static void config_tab_behavior(GtkWidget *notebook)
 
        group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL);
 
-       pref_checkbox_new_int(group, _("Rectangular selection in icon view"),
-                             options->collections.rectangular_selection, &c_options->collections.rectangular_selection);
-
        pref_checkbox_new_int(group, _("Descend folders in tree view"),
                              options->tree_descend_subdirs, &c_options->tree_descend_subdirs);
 
@@ -2060,7 +2141,7 @@ static void config_tab_behavior(GtkWidget *notebook)
        pref_checkbox_new_int(group, _("List directory view uses single click to enter"),
                              options->view_dir_list_single_click_enter, &c_options->view_dir_list_single_click_enter);
 
-       pref_spin_new_int(group, _("Open recent list maximum size"), NULL,
+       pref_spin_new_int(group, _("Recent folder list maximum size"), NULL,
                          1, 50, 1, options->open_recent_list_maxsize, &c_options->open_recent_list_maxsize);
 
        pref_spin_new_int(group, _("Drag'n drop icon size"), NULL,
@@ -2077,13 +2158,6 @@ static void config_tab_behavior(GtkWidget *notebook)
        pref_checkbox_new_int(group, _("Navigation by left or middle click on image"),
                              options->image_lm_click_nav, &c_options->image_lm_click_nav);
 
-       group = pref_group_new(vbox, FALSE, _("Similarities"), GTK_ORIENTATION_VERTICAL);
-
-       pref_spin_new_int(group, _("Custom similarity threshold:"), NULL,
-                         0, 100, 1, options->duplicates_similarity_threshold, (int *)&c_options->duplicates_similarity_threshold);
-       pref_checkbox_new_int(group, _("Rotation invariant duplicate check"),
-                             options->rot_invariant_sim, &c_options->rot_invariant_sim);
-
 #ifdef DEBUG
        group = pref_group_new(vbox, FALSE, _("Debugging"), GTK_ORIENTATION_VERTICAL);
 
@@ -2296,12 +2370,32 @@ static void config_window_create(void)
        gtk_container_add(GTK_CONTAINER(configwindow), win_vbox);
        gtk_widget_show(win_vbox);
 
+       notebook = gtk_notebook_new();
+       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
+       gtk_box_pack_start(GTK_BOX(win_vbox), notebook, TRUE, TRUE, 0);
+
+       config_tab_general(notebook);
+       config_tab_image(notebook);
+       config_tab_windows(notebook);
+       config_tab_accelerators(notebook);
+       config_tab_files(notebook);
+       config_tab_metadata(notebook);
+       config_tab_color(notebook);
+       config_tab_stereo(notebook);
+       config_tab_behavior(notebook);
+
        hbox = gtk_hbutton_box_new();
        gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
        gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP);
        gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0);
        gtk_widget_show(hbox);
 
+       button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE,
+                                G_CALLBACK(config_window_help_cb), notebook);
+       gtk_container_add(GTK_CONTAINER(hbox), button);
+       gtk_widget_set_can_default(button, TRUE);
+       gtk_widget_show(button);
+
        button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
                                 G_CALLBACK(config_window_ok_cb), NULL);
        gtk_container_add(GTK_CONTAINER(hbox), button);
@@ -2334,20 +2428,6 @@ static void config_window_create(void)
                gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1);
                }
 
-       notebook = gtk_notebook_new();
-       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
-       gtk_box_pack_start(GTK_BOX(win_vbox), notebook, TRUE, TRUE, 0);
-
-       config_tab_general(notebook);
-       config_tab_image(notebook);
-       config_tab_windows(notebook);
-       config_tab_accelerators(notebook);
-       config_tab_files(notebook);
-       config_tab_metadata(notebook);
-       config_tab_color(notebook);
-       config_tab_stereo(notebook);
-       config_tab_behavior(notebook);
-
        gtk_widget_show(notebook);
 
        gtk_widget_show(configwindow);