2b333207ba5037034635f7d6525b78aa0379f8f0
[geeqie.git] / src / options.h
1 /*
2  * Copyright (C) 2008 - 2016 The Geeqie Team
3  *
4  * Authors: Vladimir Nadvornik, Laurent Monin
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef OPTIONS_H
22 #define OPTIONS_H
23
24 struct SecureSaveInfo;
25
26 /**
27  * @enum DnDAction
28  * drag and drop default action
29  */
30 enum DnDAction {
31         DND_ACTION_ASK,
32         DND_ACTION_COPY,
33         DND_ACTION_MOVE
34 };
35
36 enum ZoomStyle {
37         ZOOM_GEOMETRIC  = 0,
38         ZOOM_ARITHMETIC = 1
39 };
40
41 struct ConfOptions
42 {
43         /* ui */
44         gboolean progressive_key_scrolling;
45         guint keyboard_scroll_step;
46         gboolean place_dialogs_under_mouse;
47         gboolean mousewheel_scrolls;
48         gboolean image_lm_click_nav;
49         gboolean image_l_click_archive;
50         gboolean image_l_click_video;
51         gchar *image_l_click_video_editor;
52         gboolean show_icon_names;
53         gboolean show_star_rating;
54         gboolean draw_rectangle;
55         gboolean show_predefined_keyword_tree;
56         gboolean overunderexposed;
57         gboolean expand_menu_toolbar;
58         gboolean hamburger_menu;
59
60         /* various */
61         gboolean tree_descend_subdirs;
62         gboolean view_dir_list_single_click_enter;
63
64         gboolean circular_selection_lists;
65
66         gboolean lazy_image_sync;
67         gboolean update_on_time_change;
68
69         guint duplicates_similarity_threshold;
70         guint duplicates_match;
71         gboolean duplicates_thumbnails;
72         guint duplicates_select_type;
73         gboolean rot_invariant_sim;
74         gboolean sort_totals;
75
76         gint open_recent_list_maxsize;
77         gint recent_folder_image_list_maxsize;
78         gint dnd_icon_size;
79         DnDAction dnd_default_action;
80         gint clipboard_selection;
81
82         gboolean save_window_positions;
83         gboolean use_saved_window_positions_for_new_windows;
84         gboolean save_window_workspace;
85         gboolean tools_restore_state;
86         gboolean save_dialog_window_positions;
87         gboolean show_window_ids;
88
89         gint log_window_lines;
90
91         gboolean marks_save;            /**< save marks on exit */
92         gchar *marks_tooltips[FILEDATA_MARKS_SIZE];
93
94         gboolean appimage_notifications;
95
96         gboolean with_rename;
97         gboolean collections_duplicates;
98         gboolean collections_on_top;
99         gboolean hide_window_in_fullscreen;
100
101         gchar *help_search_engine;
102
103         /**
104          * @struct info_comment
105          * info sidebar component height
106          */
107         struct {
108                 gint height;
109         } info_comment;
110
111         /**
112          * @struct info_keywords
113          * info sidebar component height
114          */
115         struct {
116                 gint height;
117         } info_keywords;
118
119         /**
120          * @struct info_title
121          * info sidebar component height
122          */
123         struct {
124                 gint height;
125         } info_title;
126
127         /**
128          * @struct info_rating
129          * info sidebar component height
130          */
131         struct {
132                 gint height;
133         } info_rating;
134
135         /**
136          * @struct info_headline
137          * info sidebar component height
138          */
139         struct {
140                 gint height;
141         } info_headline;
142
143         /* file ops */
144         struct {
145                 gboolean enable_in_place_rename;
146
147                 gboolean confirm_delete;
148                 gboolean confirm_move_to_trash;
149                 gboolean enable_delete_key;
150                 gboolean safe_delete_enable;
151                 gboolean use_system_trash;
152                 gchar *safe_delete_path;
153                 gint safe_delete_folder_maxsize;
154                 gboolean no_trash;
155         } file_ops;
156
157         /* image */
158         struct {
159                 gboolean exif_rotate_enable;
160                 guint scroll_reset_method;
161                 gboolean fit_window_to_image;
162                 gboolean limit_window_size;
163                 gint max_window_size;
164                 gboolean limit_autofit_size;
165                 gint max_autofit_size;
166                 gint max_enlargement_size;
167
168                 gint tile_cache_max;    /**< in megabytes */
169                 gint image_cache_max;   /**< in megabytes */
170                 gboolean enable_read_ahead;
171
172                 ZoomMode zoom_mode;
173                 gboolean zoom_2pass;
174                 gboolean zoom_to_fit_allow_expand;
175                 guint zoom_quality;
176                 gint zoom_increment;    /**< 100 is 1.0, 5 is 0.05, 200 is 2.0, etc. */
177                 ZoomStyle zoom_style;
178
179                 gboolean use_custom_border_color_in_fullscreen;
180                 gboolean use_custom_border_color;
181                 GdkRGBA border_color;
182                 GdkRGBA alpha_color_1;
183                 GdkRGBA alpha_color_2;
184
185                 gint tile_size;
186         } image;
187
188         /* thumbnails */
189         struct {
190                 gint max_width;
191                 gint max_height;
192                 gboolean enable_caching;
193                 gboolean cache_into_dirs;
194                 gboolean use_xvpics;
195                 gboolean spec_standard;
196                 guint quality;
197                 gboolean use_exif;
198                 gboolean use_color_management;
199                 gboolean use_ft_metadata;
200                 gint collection_preview;
201         } thumbnails;
202
203         /* file filtering */
204         struct {
205                 gboolean show_hidden_files;
206                 gboolean show_parent_directory;
207                 gboolean show_dot_directory;
208                 gboolean disable_file_extension_checks;
209                 gboolean disable;
210         } file_filter;
211
212         struct {
213                 gchar *ext;
214         } sidecar;
215
216         /* collections */
217         struct {
218                 gboolean rectangular_selection;
219         } collections;
220
221         /* shell */
222         struct {
223                 gchar *path;
224                 gchar *options;
225         } shell;
226
227         /* file sorting */
228         struct {
229                 gboolean case_sensitive; /**< file sorting method (case) */
230         } file_sort;
231
232         /* slideshow */
233         struct {
234                 gint delay;     /**< in tenths of a second */
235                 gboolean random;
236                 gboolean repeat;
237         } slideshow;
238
239         /* fullscreen */
240         struct {
241                 gint screen;
242                 gboolean clean_flip;
243                 gboolean disable_saver;
244                 gboolean above;
245         } fullscreen;
246
247         /* image overlay */
248         struct {
249                 gchar *template_string;
250                 gint x;
251                 gint y;
252                 guint16 text_red;
253                 guint16 text_green;
254                 guint16 text_blue;
255                 guint16 text_alpha;
256                 guint16 background_red;
257                 guint16 background_green;
258                 guint16 background_blue;
259                 guint16 background_alpha;
260                 gchar *font;
261         } image_overlay;
262
263         /* properties dialog */
264         struct {
265                 gchar *tabs_order;
266         } properties;
267
268         /* color profiles */
269         struct {
270                 gboolean enabled;
271                 gint input_type;
272                 gchar *input_file[COLOR_PROFILE_INPUTS];
273                 gchar *input_name[COLOR_PROFILE_INPUTS];
274                 gchar *screen_file;
275                 gboolean use_image;
276                 gboolean use_x11_screen_profile;
277                 gint render_intent;
278         } color_profile;
279
280         /* Helpers programs */
281         struct {
282                 struct {
283                         gchar *command_name;
284                         gchar *command_line;
285                 } html_browser;
286         } helpers;
287
288         /* Metadata */
289         struct {
290                 gboolean enable_metadata_dirs;
291
292                 gboolean save_in_image_file;
293                 gboolean save_legacy_IPTC;
294                 gboolean warn_on_write_problems;
295
296                 gboolean save_legacy_format;
297
298                 gboolean sync_grouped_files;
299
300                 gboolean confirm_write;
301                 gint confirm_timeout;
302                 gboolean confirm_after_timeout;
303                 gboolean confirm_on_image_change;
304                 gboolean confirm_on_dir_change;
305                 gboolean keywords_case_sensitive;
306                 gboolean write_orientation;
307                 gboolean sidecar_extended_name;
308
309                 gboolean check_spelling;
310         } metadata;
311
312         /* Stereo */
313         struct {
314                 gint mode;
315                 gint fsmode;
316                 gboolean enable_fsmode;
317                 gint fixed_w, fixed_h;
318                 gint fixed_x1, fixed_y1;
319                 gint fixed_x2, fixed_y2;
320                 /**
321                  * @struct tmp
322                  * options in this struct are packed to mode and fsmode entries
323                  */
324                 struct {
325                         gboolean mirror_right;
326                         gboolean mirror_left;
327                         gboolean flip_right;
328                         gboolean flip_left;
329                         gboolean swap;
330                         gboolean temp_disable;
331                         gboolean fs_mirror_right;
332                         gboolean fs_mirror_left;
333                         gboolean fs_flip_right;
334                         gboolean fs_flip_left;
335                         gboolean fs_swap;
336                         gboolean fs_temp_disable;
337                 } tmp;
338         } stereo;
339
340         /* External preview extraction */
341         struct {
342                 gboolean enable;
343                 gchar *select; /**< path to executable */
344                 gchar *extract; /**< path to executable */
345         } external_preview;
346
347         /**
348          * @struct cp_mv_rn
349          * copy move rename
350          */
351         struct {
352                 gint auto_start;
353                 gchar *auto_end;
354                 gint auto_padding;
355                 gint formatted_start;
356         } cp_mv_rn;
357
358         /* log window */
359         struct {
360                 gboolean paused;
361                 gboolean line_wrap;
362                 gboolean timer_data;
363                 gchar *action; /** Used with F1 key */
364         } log_window;
365
366         /* star rating */
367         struct {
368                 gunichar star;
369                 gunichar rejected;
370         } star_rating;
371
372         /* Printer */
373         struct {
374                 gchar *image_font;
375                 gchar *page_font;
376                 gboolean show_image_text;
377                 gboolean show_page_text;
378                 gchar *page_text;
379                 gint image_text_position;
380                 gint page_text_position;
381                 gchar *template_string;
382         } printer;
383
384         /* Threads */
385         struct {
386                 gint duplicates;
387         } threads;
388
389         /* Selectable bars */
390         struct {
391                 gboolean menu_bar;
392                 gboolean tool_bar;
393                 gboolean status_bar;
394         } selectable_bars;
395
396         /* Alternate similarity algorithm */
397         struct {
398                 gboolean enabled;
399                 gboolean grayscale; /**< convert fingerprint to greyscale */
400         } alternate_similarity_algorithm;
401
402         gchar *mouse_button_8; /**< user-definable mouse buttons */
403         gchar *mouse_button_9; /**< user-definable mouse buttons */
404
405         gboolean class_filter[FILE_FORMAT_CLASSES]; /**< class file filter */
406
407         gboolean read_metadata_in_idle;
408
409         gboolean disable_gpu; /**< GPU - see main.cc */
410         gboolean override_disable_gpu; /**< GPU - see main.cc */
411
412         GList *disabled_plugins;
413 };
414
415 struct CommandLine
416 {
417         int argc;
418         gchar **argv;
419         gboolean startup_blank;
420         gboolean startup_full_screen;
421         gboolean startup_in_slideshow;
422         gboolean startup_command_line_collection;
423         gboolean tools_hide;
424         gboolean tools_show;
425         gboolean log_window_show;
426         gchar *path;
427         gchar *file;
428         GList *cmd_list;
429         GList *collection_list;
430         gchar *geometry;
431         gchar *regexp;
432         gchar *log_file;
433         SecureSaveInfo *ssi;
434         gboolean new_instance;
435 };
436
437 extern ConfOptions *options;
438 extern CommandLine *command_line;
439
440 ConfOptions *init_options(ConfOptions *options);
441 void setup_default_options(ConfOptions *options);
442 void save_options(ConfOptions *options);
443 gboolean load_options(ConfOptions *options);
444
445
446 enum StartUpPath {
447         STARTUP_PATH_CURRENT    = 0,
448         STARTUP_PATH_LAST,
449         STARTUP_PATH_HOME,
450 };
451
452 enum SortActionType {
453         BAR_SORT_COPY = 0,
454         BAR_SORT_MOVE,
455         BAR_SORT_FILTER,
456         BAR_SORT_ACTION_COUNT
457 };
458
459 enum SortModeType {
460         BAR_SORT_MODE_FOLDER = 0,
461         BAR_SORT_MODE_COLLECTION,
462         BAR_SORT_MODE_COUNT
463 };
464
465 enum SortSelectionType {
466         BAR_SORT_SELECTION_IMAGE = 0,
467         BAR_SORT_SELECTION_SELECTED,
468         BAR_SORT_SELECTION_COUNT
469 };
470
471 struct LayoutOptions
472 {
473         gchar *id;
474
475         gchar *order;
476         gint style;
477
478         DirViewType dir_view_type;
479         FileViewType file_view_type;
480
481         struct {
482                 SortType method;
483                 gboolean ascend;
484                 gboolean case_sensitive;
485         } dir_view_list_sort;
486
487         struct {
488                 SortType method;
489                 gboolean ascend;
490                 gboolean case_sensitive;
491         } file_view_list_sort;
492
493         gboolean show_thumbnails;
494         gboolean show_marks;
495         gboolean show_file_filter;
496         gboolean show_directory_date;
497         gboolean show_info_pixel;
498         gboolean split_pane_sync;
499         gboolean ignore_alpha;
500
501         struct {
502                 gint w;
503                 gint h;
504                 gint x;
505                 gint y;
506                 gboolean maximized;
507                 gint hdivider_pos;
508                 gint vdivider_pos;
509         } main_window;
510
511         struct {
512                 gint w;
513                 gint h;
514                 gint x;
515                 gint y;
516                 gint vdivider_pos;
517         } float_window;
518
519         struct {
520                 gint vdivider_pos;
521         } folder_window;
522
523         struct {
524                 gint w;
525                 gint h;
526         } properties_window;
527
528         struct {
529                 guint state;
530                 gint histogram_channel;
531                 gint histogram_mode;
532         } image_overlay;
533
534         struct {
535                 gint w;
536                 gint h;
537                 gint x;
538                 gint y;
539         } log_window;
540
541         struct {
542                 gint w;
543                 gint h;
544                 gint x;
545                 gint y;
546                 gint page_number;
547         } preferences_window;
548
549         struct {
550                 gint w;
551                 gint h;
552                 gint x;
553                 gint y;
554         } search_window;
555
556         struct {
557                 gint w;
558                 gint h;
559                 gint x;
560                 gint y;
561         } dupe_window;
562
563         struct {
564                 gint w;
565                 gint h;
566                 gint x;
567                 gint y;
568         } advanced_exif_window;
569
570         gboolean tools_float;
571         gboolean tools_hidden;
572         gboolean selectable_toolbars_hidden;
573
574         struct {
575                 gboolean info;
576                 gboolean sort;
577                 gboolean tools_float;
578                 gboolean tools_hidden;
579                 gboolean hidden;
580         } bars_state;
581
582         gchar *home_path;
583         gchar *last_path;
584
585         StartUpPath startup_path;
586
587         gboolean animate;
588         gint workspace;
589
590         SortActionType action;
591         SortModeType mode;
592         SortSelectionType selection;
593         gchar *filter_key;
594 };
595
596 void copy_layout_options(LayoutOptions *dest, const LayoutOptions *src);
597 void free_layout_options_content(LayoutOptions *dest);
598 LayoutOptions *init_layout_options(LayoutOptions *options);
599
600 #endif /* OPTIONS_H */
601 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */