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