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