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