3 * Copyright (C) 2008 The Geeqie Team
5 * Authors: Vladimir Nadvornik, Laurent Monin
7 * This software is released under the GNU General Public License (GNU GPL).
8 * Please read the included file COPYING for more information.
9 * This software comes with no warranty of any kind, use at your own risk!
17 #include "filefilter.h"
18 #include "histogram.h" /* HCHAN_RGB */
19 #include "image-overlay.h" /* OSD_SHOW_NOTHING */
22 #include "layout_image.h"
23 #include "ui_bookmark.h"
24 #include "ui_fileops.h"
27 ConfOptions *init_options(ConfOptions *options)
29 if (!options) options = g_new0(ConfOptions, 1);
31 options->collections.rectangular_selection = FALSE;
33 options->color_profile.enabled = FALSE;
34 options->color_profile.input_type = 0;
35 options->color_profile.screen_file = NULL;
36 options->color_profile.screen_type = 0;
37 options->color_profile.use_image = TRUE;
39 options->dnd_icon_size = 48;
40 options->documentation.htmldir = NULL;
41 options->documentation.helpdir = NULL;
42 options->duplicates_similarity_threshold = 99;
43 options->enable_metadata_dirs = FALSE;
45 options->file_filter.disable = FALSE;
46 options->file_filter.show_dot_directory = FALSE;
47 options->file_filter.show_hidden_files = FALSE;
49 options->file_ops.confirm_delete = TRUE;
50 options->file_ops.enable_delete_key = TRUE;
51 options->file_ops.enable_in_place_rename = TRUE;
52 options->file_ops.safe_delete_enable = FALSE;
53 options->file_ops.safe_delete_folder_maxsize = 128;
54 options->file_ops.safe_delete_path = NULL;
56 options->file_sort.ascending = TRUE;
57 options->file_sort.case_sensitive = FALSE;
58 options->file_sort.method = SORT_NAME;
60 options->fullscreen.above = FALSE;
61 options->fullscreen.clean_flip = FALSE;
62 options->fullscreen.disable_saver = TRUE;
63 options->fullscreen.screen = -1;
65 options->histogram.last_channel_mode = HCHAN_RGB;
66 options->histogram.last_log_mode = 1;
68 memset(&options->image.border_color, 0, sizeof(options->image.border_color));
69 options->image.dither_quality = GDK_RGB_DITHER_NORMAL;
70 options->image.enable_read_ahead = TRUE;
71 options->image.exif_rotate_enable = TRUE;
72 options->image.fit_window_to_image = FALSE;
73 options->image.idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
74 options->image.limit_autofit_size = FALSE;
75 options->image.limit_window_size = FALSE;
76 options->image.max_autofit_size = 100;
77 options->image.max_window_size = 100;
78 options->image.read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
79 options->image.scroll_reset_method = SCROLL_RESET_TOPLEFT;
80 options->image.tile_cache_max = 10;
81 options->image.image_cache_max = 128; /* 4 x 10MPix */
82 options->image.use_custom_border_color = FALSE;
83 options->image.zoom_2pass = TRUE;
84 options->image.zoom_increment = 5;
85 options->image.zoom_mode = ZOOM_RESET_ORIGINAL;
86 options->image.zoom_quality = GDK_INTERP_BILINEAR;
87 options->image.zoom_to_fit_allow_expand = TRUE;
89 options->image_overlay.common.state = OSD_SHOW_NOTHING;
90 options->image_overlay.common.show_at_startup = FALSE;
91 options->image_overlay.common.template_string = NULL;
92 options->image_overlay.common.x = 10;
93 options->image_overlay.common.y = -10;
95 options->layout.dir_view_type = DIRVIEW_LIST;
96 options->layout.file_view_type = FILEVIEW_LIST;
97 options->layout.float_window.h = 450;
98 options->layout.float_window.vdivider_pos = -1;
99 options->layout.float_window.w = 260;
100 options->layout.float_window.x = 0;
101 options->layout.float_window.y = 0;
102 options->layout.home_path = NULL;
103 options->layout.main_window.h = 400;
104 options->layout.main_window.hdivider_pos = -1;
105 options->layout.main_window.maximized = FALSE;
106 options->layout.main_window.vdivider_pos = 200;
107 options->layout.main_window.w = 500;
108 options->layout.main_window.x = 0;
109 options->layout.main_window.y = 0;
110 options->layout.order = NULL;
111 options->layout.properties_window.w = DEF_PROPERTY_WIDTH;
112 options->layout.properties_window.h = DEF_PROPERTY_HEIGHT;
113 options->layout.save_window_positions = FALSE;
114 options->layout.show_directory_date = FALSE;
115 options->layout.show_marks = FALSE;
116 options->layout.show_thumbnails = FALSE;
117 options->layout.style = 0;
118 options->layout.toolbar_hidden = FALSE;
119 options->layout.tools_float = FALSE;
120 options->layout.tools_hidden = FALSE;
121 options->layout.tools_restore_state = FALSE;
123 options->lazy_image_sync = FALSE;
124 options->mousewheel_scrolls = FALSE;
125 options->open_recent_list_maxsize = 10;
126 options->place_dialogs_under_mouse = FALSE;
128 options->panels.exif.enabled = FALSE;
129 options->panels.exif.width = PANEL_DEFAULT_WIDTH;
130 options->panels.info.enabled = FALSE;
131 options->panels.info.width = PANEL_DEFAULT_WIDTH;
132 options->panels.sort.action_state = 0;
133 options->panels.sort.enabled = FALSE;
134 options->panels.sort.mode_state = 0;
135 options->panels.sort.selection_state = 0;
137 options->progressive_key_scrolling = FALSE;
139 options->save_metadata_in_image_file = FALSE;
141 options->show_copy_path = FALSE;
142 options->show_icon_names = TRUE;
144 options->slideshow.delay = 150;
145 options->slideshow.random = FALSE;
146 options->slideshow.repeat = FALSE;
148 options->startup.path = NULL;
149 options->startup.restore_path = FALSE;
150 options->startup.use_last_path = FALSE;
152 options->thumbnails.cache_into_dirs = FALSE;
153 options->thumbnails.enable_caching = TRUE;
154 options->thumbnails.fast = TRUE;
155 options->thumbnails.max_height = DEFAULT_THUMB_HEIGHT;
156 options->thumbnails.max_width = DEFAULT_THUMB_WIDTH;
157 options->thumbnails.quality = GDK_INTERP_TILES;
158 options->thumbnails.spec_standard = TRUE;
159 options->thumbnails.use_xvpics = TRUE;
161 options->tree_descend_subdirs = FALSE;
162 options->update_on_time_change = TRUE;
167 void setup_default_options(ConfOptions *options)
172 for (i = 0; i < GQ_EDITOR_SLOTS; i++)
174 editor_set_name(i, NULL);
175 editor_set_command(i, NULL);
178 editor_reset_defaults();
180 bookmark_add_default(_("Home"), homedir());
181 path = g_build_filename(homedir(), "Desktop", NULL);
182 bookmark_add_default(_("Desktop"), path);
184 path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL);
185 bookmark_add_default(_("Collections"), path);
188 g_free(options->file_ops.safe_delete_path);
189 options->file_ops.safe_delete_path = g_build_filename(homedir(), GQ_RC_DIR_TRASH, NULL);
191 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
193 options->color_profile.input_file[i] = NULL;
194 options->color_profile.input_name[i] = NULL;
197 set_default_image_overlay_template_string(&options->image_overlay.common.template_string);
198 sidecar_ext_add_defaults();
199 options->layout.order = g_strdup("123");
200 options->properties.tabs_order = g_strdup(info_tab_default_order());
202 options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH);
203 options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
205 options->documentation.htmldir = g_strdup(GQ_HTMLDIR);
206 options->documentation.helpdir = g_strdup(GQ_HELPDIR);
208 for (i = 0; ExifUIList[i].key; i++)
209 ExifUIList[i].current = ExifUIList[i].default_value;
212 void sync_options_with_current_state(ConfOptions *options)
214 LayoutWindow *lw = NULL;
216 if (layout_valid(&lw))
218 options->layout.main_window.maximized = window_maximized(lw->window);
219 if (!options->layout.main_window.maximized)
221 layout_geometry_get(NULL, &options->layout.main_window.x, &options->layout.main_window.y,
222 &options->layout.main_window.w, &options->layout.main_window.h);
225 options->image_overlay.common.state = image_osd_get(lw->image);
228 layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos);
230 layout_views_get(NULL, &options->layout.dir_view_type, &options->layout.file_view_type);
232 options->layout.show_thumbnails = layout_thumb_get(NULL);
233 options->layout.show_marks = layout_marks_get(NULL);
235 layout_sort_get(NULL, &options->file_sort.method, &options->file_sort.ascending);
237 layout_geometry_get_tools(NULL, &options->layout.float_window.x, &options->layout.float_window.y,
238 &options->layout.float_window.w, &options->layout.float_window.h, &options->layout.float_window.vdivider_pos);
239 layout_tools_float_get(NULL, &options->layout.tools_float, &options->layout.tools_hidden);
240 options->layout.toolbar_hidden = layout_toolbar_hidden(NULL);
242 options->color_profile.enabled = layout_image_color_profile_get_use(NULL);
243 layout_image_color_profile_get(NULL,
244 &options->color_profile.input_type,
245 &options->color_profile.screen_type,
246 &options->color_profile.use_image);
248 if (options->startup.restore_path && options->startup.use_last_path)
250 g_free(options->startup.path);
251 options->startup.path = g_strdup(layout_get_path(NULL));