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