2 * Copyright (C) 2006 John Ellis
3 * Copyright (C) 2008 - 2016 The Geeqie Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 ZOOM_RESET_ORIGINAL = 0,
27 ZOOM_RESET_FIT_WINDOW = 1,
32 CLIPBOARD_PRIMARY = 0,
33 CLIPBOARD_CLIPBOARD = 1,
38 MOUSE_BUTTON_LEFT = 1,
39 MOUSE_BUTTON_MIDDLE = 2,
40 MOUSE_BUTTON_RIGHT = 3,
41 MOUSE_BUTTON_WHEEL_UP = 4,
42 MOUSE_BUTTON_WHEEL_DOWN = 5,
51 DIRVIEW_LAST = DIRVIEW_TREE /**< Keep this up to date! */
58 FILEVIEW_LAST = FILEVIEW_ICON /**< Keep this up to date! */
61 #define CMD_COPY "geeqie-copy-command.desktop"
62 #define CMD_MOVE "geeqie-move-command.desktop"
63 #define CMD_RENAME "geeqie-rename-command.desktop"
64 #define CMD_DELETE "geeqie-delete-command.desktop"
65 #define CMD_FOLDER "geeqie-folder-command.desktop"
76 SORT_EXIFTIMEDIGITIZED,
83 * drag and drop default action
92 ALTER_NONE, /**< do nothing */
94 ALTER_ROTATE_90_CC, /**< counterclockwise */
102 LAYOUT_LEFT = 1 << 0,
103 LAYOUT_RIGHT = 1 << 1,
105 LAYOUT_BOTTOM = 1 << 3
110 IMAGE_STATE_NONE = 0,
111 IMAGE_STATE_IMAGE = 1 << 0,
112 IMAGE_STATE_LOADING = 1 << 1,
113 IMAGE_STATE_ERROR = 1 << 2,
114 IMAGE_STATE_COLOR_ADJ = 1 << 3,
115 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
116 IMAGE_STATE_ROTATE_USER = 1 << 5,
117 IMAGE_STATE_DELAY_FLIP = 1 << 6
128 FILEDATA_CHANGE_DELETE,
129 FILEDATA_CHANGE_MOVE,
130 FILEDATA_CHANGE_RENAME,
131 FILEDATA_CHANGE_COPY,
132 FILEDATA_CHANGE_UNSPECIFIED,
133 FILEDATA_CHANGE_WRITE_METADATA
134 } FileDataChangeType;
141 } MarkToSelectionMode;
147 } SelectionToMarkMode;
150 FORMAT_CLASS_UNKNOWN,
152 FORMAT_CLASS_RAWIMAGE,
155 FORMAT_CLASS_COLLECTION,
156 FORMAT_CLASS_DOCUMENT,
160 extern gchar *format_class_list[]; /**< defined in preferences.c */
163 * @typedef SecureSaveErrno
164 * see err field in #SecureSaveInfo
168 SS_ERR_DISABLED, /**< secsave is disabled. */
169 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
181 NOTIFY_PRIORITY_HIGH = 0,
182 NOTIFY_PRIORITY_MEDIUM,
187 NOTIFY_MARKS = 1 << 1, /**< changed marks */
188 NOTIFY_PIXBUF = 1 << 2, /**< image was read into fd->pixbuf */
189 NOTIFY_HISTMAP = 1 << 3, /**< histmap was read into fd->histmap */
190 NOTIFY_ORIENTATION = 1 << 4, /**< image was rotated */
191 NOTIFY_METADATA = 1 << 5, /**< changed image metadata, not yet written */
192 NOTIFY_GROUPING = 1 << 6, /**< change in fd->sidecar_files or fd->parent */
193 NOTIFY_REREAD = 1 << 7, /**< changed file size, date, etc., file name remains unchanged */
194 NOTIFY_CHANGE = 1 << 8 /**< generic change described by fd->change */
199 CHANGE_WARN_DEST_EXISTS = 1 << 0,
200 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
201 CHANGE_WARN_SAME = 1 << 2,
202 CHANGE_WARN_CHANGED_EXT = 1 << 3,
203 CHANGE_WARN_UNSAVED_META = 1 << 4,
204 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
205 CHANGE_ERROR_MASK = (~0U) << 8, /**< the values below are fatal errors */
206 CHANGE_NO_READ_PERM = 1 << 8,
207 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
208 CHANGE_NO_DEST_DIR = 1 << 10,
209 CHANGE_DUPLICATE_DEST = 1 << 11,
210 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
211 CHANGE_DEST_EXISTS = 1 << 13,
212 CHANGE_NO_SRC = 1 << 14,
213 CHANGE_GENERIC_ERROR = 1 << 16
217 METADATA_PLAIN = 0, /**< format that can be edited and written back */
218 METADATA_FORMATTED = 1 /**< for display only */
222 STARTUP_PATH_CURRENT = 0,
234 PR_STEREO_NONE = 0, /**< do nothing */
235 PR_STEREO_DUAL = 1 << 0, /**< independent stereo buffers, for example nvidia opengl */
236 PR_STEREO_FIXED = 1 << 1, /**< custom position */
237 PR_STEREO_HORIZ = 1 << 2, /**< side by side */
238 PR_STEREO_VERT = 1 << 3, /**< above below */
239 PR_STEREO_RIGHT = 1 << 4, /**< render right buffer */
240 PR_STEREO_ANAGLYPH_RC = 1 << 5, /**< anaglyph red-cyan */
241 PR_STEREO_ANAGLYPH_GM = 1 << 6, /**< anaglyph green-magenta */
242 PR_STEREO_ANAGLYPH_YB = 1 << 7, /**< anaglyph yellow-blue */
243 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /**< anaglyph gray red-cyan*/
244 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /**< anaglyph gray green-magenta */
245 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /**< anaglyph gray yellow-blue */
246 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /**< anaglyph dubois red-cyan */
247 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /**< anaglyph dubois green-magenta */
248 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /**< anaglyph dubois yellow-blue */
249 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
250 PR_STEREO_ANAGLYPH_GM |
251 PR_STEREO_ANAGLYPH_YB |
252 PR_STEREO_ANAGLYPH_GRAY_RC |
253 PR_STEREO_ANAGLYPH_GRAY_GM |
254 PR_STEREO_ANAGLYPH_GRAY_YB |
255 PR_STEREO_ANAGLYPH_DB_RC |
256 PR_STEREO_ANAGLYPH_DB_GM |
257 PR_STEREO_ANAGLYPH_DB_YB, /**< anaglyph mask */
259 PR_STEREO_MIRROR_LEFT = 1 << 14, /**< mirror */
260 PR_STEREO_FLIP_LEFT = 1 << 15, /**< flip */
262 PR_STEREO_MIRROR_RIGHT = 1 << 16, /**< mirror */
263 PR_STEREO_FLIP_RIGHT = 1 << 17, /**< flip */
265 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /**< mirror mask*/
266 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /**< flip mask*/
267 PR_STEREO_SWAP = 1 << 18, /**< swap left and right buffers */
268 PR_STEREO_TEMP_DISABLE = 1 << 19, /**< temporarily disable stereo mode if source image is not stereo */
269 PR_STEREO_HALF = 1 << 20
270 } PixbufRendererStereoMode;
273 STEREO_PIXBUF_DEFAULT = 0,
274 STEREO_PIXBUF_SBS = 1,
275 STEREO_PIXBUF_CROSS = 2,
276 STEREO_PIXBUF_NONE = 3
280 BAR_SORT_MODE_FOLDER = 0,
281 BAR_SORT_MODE_COLLECTION,
289 BAR_SORT_ACTION_COUNT
293 BAR_SORT_SELECTION_IMAGE = 0,
294 BAR_SORT_SELECTION_SELECTED,
295 BAR_SORT_SELECTION_COUNT
298 #define MAX_SPLIT_IMAGES 4
302 SELECTION_SELECTED = 1 << 0,
303 SELECTION_PRELIGHT = 1 << 1,
304 SELECTION_FOCUS = 1 << 2
307 typedef struct _ImageLoader ImageLoader;
308 typedef struct _ThumbLoader ThumbLoader;
310 typedef struct _AnimationData AnimationData;
312 typedef struct _CollectInfo CollectInfo;
313 typedef struct _CollectionData CollectionData;
314 typedef struct _CollectTable CollectTable;
315 typedef struct _CollectWindow CollectWindow;
317 typedef struct _ImageWindow ImageWindow;
319 typedef struct _FileData FileData;
320 typedef struct _FileDataChangeInfo FileDataChangeInfo;
322 typedef struct _LayoutWindow LayoutWindow;
323 typedef struct _LayoutOptions LayoutOptions;
325 typedef struct _ViewDir ViewDir;
326 typedef struct _ViewDirInfoList ViewDirInfoList;
327 typedef struct _ViewDirInfoTree ViewDirInfoTree;
329 typedef struct _ViewFile ViewFile;
330 typedef struct _ViewFileInfoList ViewFileInfoList;
331 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
333 typedef struct _SlideShowData SlideShowData;
334 typedef struct _FullScreenData FullScreenData;
336 typedef struct _PixmapFolders PixmapFolders;
337 typedef struct _Histogram Histogram;
338 typedef struct _HistMap HistMap;
340 typedef struct _SecureSaveInfo SecureSaveInfo;
342 typedef struct _ExifData ExifData;
344 typedef struct _EditorDescription EditorDescription;
346 typedef struct _CommandLine CommandLine;
349 gint histogram_channel; /**< drawing mode for histogram */
350 gint histogram_mode; /**< logarithmical or not */
351 guint vgrid; /**< number of vertical divisions, 0 for none */
352 guint hgrid; /**< number of horizontal divisions, 0 for none */
358 } grid_color; /**< grid color */
366 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
368 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
372 gboolean standard_loader;
375 FileData *fd; /**< fd->pixbuf contains final (scaled) image when done */
377 gboolean cache_enable;
379 gdouble percent_done;
384 ThumbLoaderFunc func_done;
385 ThumbLoaderFunc func_error;
386 ThumbLoaderFunc func_progress;
390 guint idle_done_id; /**< event source id */
393 struct _AnimationData
397 GdkPixbufAnimation *gpa;
398 GdkPixbufAnimationIter *iter;
403 GCancellable *cancellable;
405 GFileInputStream *gfstream;
415 struct _CollectionData
420 SortType sort_method;
422 ThumbLoader *thumb_loader;
423 CollectInfo *thumb_info;
425 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
426 gpointer info_updated_data;
437 gboolean changed; /**< contents changed since save flag */
439 GHashTable *existence;
452 CollectInfo *prev_selection;
454 CollectInfo *click_info;
456 GtkWidget *tip_window;
457 guint tip_delay_id; /**< event source id */
458 CollectInfo *tip_info;
460 GdkWindow *marker_window;
461 CollectInfo *marker_info;
463 GtkWidget *status_label;
464 GtkWidget *extra_label;
468 CollectInfo *focus_info;
471 CollectInfo *drop_info;
474 guint sync_idle_id; /**< event source id */
475 guint drop_idle_id; /**< event source id */
480 GList *editmenu_fd_list; /**< file list for edit menu */
483 struct _CollectWindow
487 GtkWidget *status_box;
489 GtkWidget *close_dialog;
494 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
495 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
496 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
497 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
501 GtkWidget *widget; /**< use this to add it and show it */
507 gboolean unknown; /**< failed to load image */
509 ImageLoader *il; /**< @FIXME image loader should probably go to FileData, but it must first support
510 sending callbacks to multiple ImageWindows in parallel */
512 gint has_frame; /**< not boolean, see image_new() */
514 /* top level (not necessarily parent) window */
515 gboolean top_window_sync; /**< resize top_window when image dimensions change */
516 GtkWidget *top_window; /**< window that gets title, and window to resize when 'fitting' */
517 gchar *title; /**< window title to display left of file name */
518 gchar *title_right; /**< window title to display right of file name */
519 gboolean title_show_zoom; /**< option to include zoom in window title */
522 ImageState state; /**< mask of IMAGE_STATE_* flags about current image */
524 void (*func_update)(ImageWindow *imd, gpointer data);
525 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
526 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
527 ImageTileRequestFunc func_tile_request;
528 ImageTileDisposeFunc func_tile_dispose;
530 gpointer data_update;
531 gpointer data_complete;
535 /* button, scroll functions */
536 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
537 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
538 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
539 void (*func_focus_in)(ImageWindow *, gpointer);
541 gpointer data_button;
543 gpointer data_scroll;
544 gpointer data_focus_in;
547 * @headerfile func_scroll_notify
548 * scroll notification (for scroll bar implementation)
550 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
552 gpointer data_scroll_notify;
554 /* collection info */
555 CollectionData *collection;
556 CollectInfo *collection_info;
559 gboolean color_profile_enable;
560 gint color_profile_input;
561 gboolean color_profile_use_image;
562 gint color_profile_from_image;
565 AlterType delay_alter_type;
567 FileData *read_ahead_fd;
568 ImageLoader *read_ahead_il;
572 gboolean auto_refresh;
577 gboolean overunderexposed;
580 gboolean mouse_wheel_mode;
583 #define FILEDATA_MARKS_SIZE 10
585 struct _FileDataChangeInfo {
586 FileDataChangeType type;
590 gboolean regroup_when_finished;
596 gchar *original_path; /**< key to file_data_pool hash table */
599 const gchar *extension;
600 gchar *extended_extension;
601 FileFormatClass format_class;
602 gchar *collate_key_name;
603 gchar *collate_key_name_nocase;
607 mode_t mode; /**< this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
608 gint sidecar_priority;
610 guint marks; /**< each bit represents one mark */
611 guint valid_marks; /**< zero bit means that the corresponding mark needs to be reread */
614 GList *sidecar_files;
615 FileData *parent; /**< parent file if this is a sidecar file, NULL otherwise */
616 FileDataChangeInfo *change; /**< for rename, move ... */
617 GdkPixbuf *thumb_pixbuf;
619 GdkPixbuf *pixbuf; /**< full-size image, only complete images, NULL during loading
620 all FileData with non-NULL pixbuf are referenced by image_cache */
626 gint version; /**< increased when any field in this structure is changed */
627 gboolean disable_grouping;
629 gint user_orientation;
630 gint exif_orientation;
634 time_t exifdate_digitized;
635 GHashTable *modified_xmp; /**< hash table which contains unwritten xmp metadata in format: key->list of string values */
636 GList *cached_metadata;
638 gboolean metadata_in_idle_loaded;
644 SelectionType selected; /**< Used by view_file_icon. */
650 struct _LayoutOptions
657 DirViewType dir_view_type;
658 FileViewType file_view_type;
663 } dir_view_list_sort;
665 gboolean show_thumbnails;
667 gboolean show_file_filter;
668 gboolean show_directory_date;
669 gboolean show_info_pixel;
670 gboolean split_pane_sync;
671 gboolean ignore_alpha;
702 gint histogram_channel;
719 } preferences_window;
735 gboolean tools_float;
736 gboolean tools_hidden;
737 gboolean toolbar_hidden;
742 gboolean tools_float;
743 gboolean tools_hidden;
750 StartUpPath startup_path;
755 SortActionType action;
757 SortSelectionType selection;
763 LayoutOptions options;
773 GtkWidget *group_box;
777 /* menus, path selector */
779 GtkActionGroup *action_group;
780 GtkActionGroup *action_group_editors;
782 GtkUIManager *ui_manager;
783 guint toolbar_merge_id[TOOLBAR_COUNT];
784 GList *toolbar_actions[TOOLBAR_COUNT];
786 GtkWidget *path_entry;
790 LayoutLocation image_location;
794 ImageWindow *split_images[MAX_SPLIT_IMAGES];
795 ImageSplitMode split_mode;
796 gint active_split_image;
798 GtkWidget *split_image_widget;
799 GtkSizeGroup *split_image_sizegroup;
801 /* tools window (float) */
804 GtkWidget *tools_pane;
807 // gint tools_hidden;
808 GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
809 GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
812 GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
813 // gint toolbar_hidden;
815 // GtkWidget *thumb_button;
816 // gint thumbs_enabled;
817 // gint marks_enabled;
819 GtkWidget *back_button;
823 LayoutLocation dir_location;
828 // DirViewType dir_view_type;
832 LayoutLocation file_location;
835 // FileViewType file_view_type;
837 GtkWidget *file_view;
839 SortType sort_method;
840 gboolean sort_ascend;
842 GtkWidget *info_box; /**< status bar */
843 GtkWidget *info_progress_bar; /**< status bar */
844 GtkWidget *info_sort; /**< status bar */
845 GtkWidget *info_status; /**< status bar */
846 GtkWidget *info_details; /**< status bar */
847 GtkWidget *info_zoom; /**< status bar */
848 GtkWidget *info_pixel; /**< status bar */
852 SlideShowData *slideshow;
856 FullScreenData *full_screen;
866 GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
867 GtkWidget *utility_paned; /**< between image and bar */
871 gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
876 GtkWidget *exif_window;
877 GtkWidget *sar_window; /**< Search and Run window */
879 AnimationData *animation;
881 GtkWidget *log_window;
898 guint drop_scroll_id; /**< event source id */
901 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
902 gpointer select_data;
904 void (*dnd_drop_update_func)(ViewDir *vd);
905 void (*dnd_drop_leave_func)(ViewDir *vd);
907 LayoutWindow *layout;
914 struct _ViewDirInfoList
919 struct _ViewDirInfoTree
921 guint drop_expand_id; /**< event source id */
928 FileViewType type; /**< @todo (xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h). */
936 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
943 gboolean case_sensitive;
949 SortType sort_method;
950 gboolean sort_ascend;
953 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
954 gpointer data_thumb_status;
956 void (*func_status)(ViewFile *vf, gpointer data);
957 gpointer data_status;
959 LayoutWindow *layout;
964 gboolean thumbs_running;
965 ThumbLoader *thumbs_loader;
966 FileData *thumbs_filedata;
969 gboolean marks_enabled;
974 FileData *stars_filedata;
978 guint refresh_idle_id; /**< event source id */
979 time_t time_refresh_set; /**< time when refresh_idle_id was set */
981 GList *editmenu_fd_list; /**< file list for edit menu */
983 guint read_metadata_in_idle_id;
986 struct _ViewFileInfoList
991 gboolean thumbs_enabled;
993 guint select_idle_id; /**< event source id */
996 struct _ViewFileInfoIcon
1003 FileData *prev_selection;
1005 GtkWidget *tip_window;
1006 guint tip_delay_id; /**< event source id */
1018 struct _SlideShowData
1020 LayoutWindow *lw; /**< use this window to display the slideshow */
1021 ImageWindow *imd; /**< use this window only if lw is not available,
1022 @FIXME it is probably required only by img-view.c and should be dropped with it */
1034 guint timeout_id; /**< event source id */
1036 gboolean from_selection;
1038 void (*stop_func)(SlideShowData *, gpointer);
1044 struct _FullScreenData
1049 GtkWidget *normal_window;
1050 ImageWindow *normal_imd;
1052 guint hide_mouse_id; /**< event source id */
1053 guint busy_mouse_id; /**< event source id */
1057 guint saver_block_id; /**< event source id */
1059 void (*stop_func)(FullScreenData *, gpointer);
1062 gboolean same_region; /**< the returned region will overlap the current location of widget. */
1065 struct _PixmapFolders
1074 struct _SecureSaveInfo {
1075 FILE *fp; /**< file stream pointer */
1076 gchar *file_name; /**< final file name */
1077 gchar *tmp_file_name; /**< temporary file name */
1078 gint err; /**< set to non-zero value in case of error */
1079 gboolean secure_save; /**< use secure save for this file, internal use only */
1080 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1081 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1082 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1089 gboolean startup_blank;
1090 gboolean startup_full_screen;
1091 gboolean startup_in_slideshow;
1092 gboolean startup_command_line_collection;
1093 gboolean tools_hide;
1094 gboolean tools_show;
1095 gboolean log_window_show;
1099 GList *collection_list;
1103 SecureSaveInfo *ssi;
1104 gboolean new_instance;
1108 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */