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