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,
37 CLIPBOARD_PRIMARY = 0,
38 CLIPBOARD_CLIPBOARD = 1,
43 MOUSE_BUTTON_LEFT = 1,
44 MOUSE_BUTTON_MIDDLE = 2,
45 MOUSE_BUTTON_RIGHT = 3,
46 MOUSE_BUTTON_WHEEL_UP = 4,
47 MOUSE_BUTTON_WHEEL_DOWN = 5,
56 DIRVIEW_LAST = DIRVIEW_TREE /**< Keep this up to date! */
63 FILEVIEW_LAST = FILEVIEW_ICON /**< Keep this up to date! */
66 #define CMD_COPY "geeqie-copy-command.desktop"
67 #define CMD_MOVE "geeqie-move-command.desktop"
68 #define CMD_RENAME "geeqie-rename-command.desktop"
69 #define CMD_DELETE "geeqie-delete-command.desktop"
70 #define CMD_FOLDER "geeqie-folder-command.desktop"
81 SORT_EXIFTIMEDIGITIZED,
88 * drag and drop default action
97 ALTER_NONE, /**< do nothing */
99 ALTER_ROTATE_90_CC, /**< counterclockwise */
107 LAYOUT_LEFT = 1 << 0,
108 LAYOUT_RIGHT = 1 << 1,
110 LAYOUT_BOTTOM = 1 << 3
115 IMAGE_STATE_NONE = 0,
116 IMAGE_STATE_IMAGE = 1 << 0,
117 IMAGE_STATE_LOADING = 1 << 1,
118 IMAGE_STATE_ERROR = 1 << 2,
119 IMAGE_STATE_COLOR_ADJ = 1 << 3,
120 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
121 IMAGE_STATE_ROTATE_USER = 1 << 5,
122 IMAGE_STATE_DELAY_FLIP = 1 << 6
133 FILEDATA_CHANGE_DELETE,
134 FILEDATA_CHANGE_MOVE,
135 FILEDATA_CHANGE_RENAME,
136 FILEDATA_CHANGE_COPY,
137 FILEDATA_CHANGE_UNSPECIFIED,
138 FILEDATA_CHANGE_WRITE_METADATA
139 } FileDataChangeType;
146 } MarkToSelectionMode;
152 } SelectionToMarkMode;
155 FORMAT_CLASS_UNKNOWN,
157 FORMAT_CLASS_RAWIMAGE,
160 FORMAT_CLASS_COLLECTION,
161 FORMAT_CLASS_DOCUMENT,
162 FORMAT_CLASS_ARCHIVE,
166 extern gchar *format_class_list[]; /**< defined in preferences.c */
169 * @typedef SecureSaveErrno
170 * see err field in #SecureSaveInfo
174 SS_ERR_DISABLED, /**< secsave is disabled. */
175 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
187 NOTIFY_PRIORITY_HIGH = 0,
188 NOTIFY_PRIORITY_MEDIUM,
193 NOTIFY_MARKS = 1 << 1, /**< changed marks */
194 NOTIFY_PIXBUF = 1 << 2, /**< image was read into fd->pixbuf */
195 NOTIFY_HISTMAP = 1 << 3, /**< histmap was read into fd->histmap */
196 NOTIFY_ORIENTATION = 1 << 4, /**< image was rotated */
197 NOTIFY_METADATA = 1 << 5, /**< changed image metadata, not yet written */
198 NOTIFY_GROUPING = 1 << 6, /**< change in fd->sidecar_files or fd->parent */
199 NOTIFY_REREAD = 1 << 7, /**< changed file size, date, etc., file name remains unchanged */
200 NOTIFY_CHANGE = 1 << 8 /**< generic change described by fd->change */
205 CHANGE_WARN_DEST_EXISTS = 1 << 0,
206 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
207 CHANGE_WARN_SAME = 1 << 2,
208 CHANGE_WARN_CHANGED_EXT = 1 << 3,
209 CHANGE_WARN_UNSAVED_META = 1 << 4,
210 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
211 CHANGE_ERROR_MASK = (~0U) << 8, /**< the values below are fatal errors */
212 CHANGE_NO_READ_PERM = 1 << 8,
213 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
214 CHANGE_NO_DEST_DIR = 1 << 10,
215 CHANGE_DUPLICATE_DEST = 1 << 11,
216 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
217 CHANGE_DEST_EXISTS = 1 << 13,
218 CHANGE_NO_SRC = 1 << 14,
219 CHANGE_GENERIC_ERROR = 1 << 16
223 METADATA_PLAIN = 0, /**< format that can be edited and written back */
224 METADATA_FORMATTED = 1 /**< for display only */
228 STARTUP_PATH_CURRENT = 0,
240 PR_STEREO_NONE = 0, /**< do nothing */
241 PR_STEREO_DUAL = 1 << 0, /**< independent stereo buffers, for example nvidia opengl */
242 PR_STEREO_FIXED = 1 << 1, /**< custom position */
243 PR_STEREO_HORIZ = 1 << 2, /**< side by side */
244 PR_STEREO_VERT = 1 << 3, /**< above below */
245 PR_STEREO_RIGHT = 1 << 4, /**< render right buffer */
246 PR_STEREO_ANAGLYPH_RC = 1 << 5, /**< anaglyph red-cyan */
247 PR_STEREO_ANAGLYPH_GM = 1 << 6, /**< anaglyph green-magenta */
248 PR_STEREO_ANAGLYPH_YB = 1 << 7, /**< anaglyph yellow-blue */
249 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /**< anaglyph gray red-cyan*/
250 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /**< anaglyph gray green-magenta */
251 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /**< anaglyph gray yellow-blue */
252 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /**< anaglyph dubois red-cyan */
253 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /**< anaglyph dubois green-magenta */
254 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /**< anaglyph dubois yellow-blue */
255 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
256 PR_STEREO_ANAGLYPH_GM |
257 PR_STEREO_ANAGLYPH_YB |
258 PR_STEREO_ANAGLYPH_GRAY_RC |
259 PR_STEREO_ANAGLYPH_GRAY_GM |
260 PR_STEREO_ANAGLYPH_GRAY_YB |
261 PR_STEREO_ANAGLYPH_DB_RC |
262 PR_STEREO_ANAGLYPH_DB_GM |
263 PR_STEREO_ANAGLYPH_DB_YB, /**< anaglyph mask */
265 PR_STEREO_MIRROR_LEFT = 1 << 14, /**< mirror */
266 PR_STEREO_FLIP_LEFT = 1 << 15, /**< flip */
268 PR_STEREO_MIRROR_RIGHT = 1 << 16, /**< mirror */
269 PR_STEREO_FLIP_RIGHT = 1 << 17, /**< flip */
271 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /**< mirror mask*/
272 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /**< flip mask*/
273 PR_STEREO_SWAP = 1 << 18, /**< swap left and right buffers */
274 PR_STEREO_TEMP_DISABLE = 1 << 19, /**< temporarily disable stereo mode if source image is not stereo */
275 PR_STEREO_HALF = 1 << 20
276 } PixbufRendererStereoMode;
279 STEREO_PIXBUF_DEFAULT = 0,
280 STEREO_PIXBUF_SBS = 1,
281 STEREO_PIXBUF_CROSS = 2,
282 STEREO_PIXBUF_NONE = 3
286 BAR_SORT_MODE_FOLDER = 0,
287 BAR_SORT_MODE_COLLECTION,
295 BAR_SORT_ACTION_COUNT
299 BAR_SORT_SELECTION_IMAGE = 0,
300 BAR_SORT_SELECTION_SELECTED,
301 BAR_SORT_SELECTION_COUNT
304 #define MAX_SPLIT_IMAGES 4
308 SELECTION_SELECTED = 1 << 0,
309 SELECTION_PRELIGHT = 1 << 1,
310 SELECTION_FOCUS = 1 << 2
313 typedef struct _ImageLoader ImageLoader;
314 typedef struct _ThumbLoader ThumbLoader;
316 typedef struct _AnimationData AnimationData;
318 typedef struct _CollectInfo CollectInfo;
319 typedef struct _CollectionData CollectionData;
320 typedef struct _CollectTable CollectTable;
321 typedef struct _CollectWindow CollectWindow;
323 typedef struct _ImageWindow ImageWindow;
325 typedef struct _FileData FileData;
326 typedef struct _FileDataChangeInfo FileDataChangeInfo;
328 typedef struct _LayoutWindow LayoutWindow;
329 typedef struct _LayoutOptions LayoutOptions;
331 typedef struct _ViewDir ViewDir;
332 typedef struct _ViewDirInfoList ViewDirInfoList;
333 typedef struct _ViewDirInfoTree ViewDirInfoTree;
335 typedef struct _ViewFile ViewFile;
336 typedef struct _ViewFileInfoList ViewFileInfoList;
337 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
339 typedef struct _SlideShowData SlideShowData;
340 typedef struct _FullScreenData FullScreenData;
342 typedef struct _PixmapFolders PixmapFolders;
343 typedef struct _Histogram Histogram;
344 typedef struct _HistMap HistMap;
346 typedef struct _SecureSaveInfo SecureSaveInfo;
348 typedef struct _ExifData ExifData;
350 typedef struct _EditorDescription EditorDescription;
352 typedef struct _CommandLine CommandLine;
355 gint histogram_channel; /**< drawing mode for histogram */
356 gint histogram_mode; /**< logarithmical or not */
357 guint vgrid; /**< number of vertical divisions, 0 for none */
358 guint hgrid; /**< number of horizontal divisions, 0 for none */
364 } grid_color; /**< grid color */
372 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
374 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
378 gboolean standard_loader;
381 FileData *fd; /**< fd->pixbuf contains final (scaled) image when done */
383 gboolean cache_enable;
385 gdouble percent_done;
390 ThumbLoaderFunc func_done;
391 ThumbLoaderFunc func_error;
392 ThumbLoaderFunc func_progress;
396 guint idle_done_id; /**< event source id */
399 struct _AnimationData
403 GdkPixbufAnimation *gpa;
404 GdkPixbufAnimationIter *iter;
409 GCancellable *cancellable;
411 GFileInputStream *gfstream;
421 struct _CollectionData
426 SortType sort_method;
428 ThumbLoader *thumb_loader;
429 CollectInfo *thumb_info;
431 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
432 gpointer info_updated_data;
443 gboolean changed; /**< contents changed since save flag */
445 GHashTable *existence;
458 CollectInfo *prev_selection;
460 CollectInfo *click_info;
462 GtkWidget *tip_window;
463 guint tip_delay_id; /**< event source id */
464 CollectInfo *tip_info;
466 GdkWindow *marker_window;
467 CollectInfo *marker_info;
469 GtkWidget *status_label;
470 GtkWidget *extra_label;
474 CollectInfo *focus_info;
477 CollectInfo *drop_info;
480 guint sync_idle_id; /**< event source id */
481 guint drop_idle_id; /**< event source id */
486 GList *editmenu_fd_list; /**< file list for edit menu */
489 struct _CollectWindow
493 GtkWidget *status_box;
495 GtkWidget *close_dialog;
500 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
501 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
502 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
503 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
507 GtkWidget *widget; /**< use this to add it and show it */
513 gboolean unknown; /**< failed to load image */
515 ImageLoader *il; /**< @FIXME image loader should probably go to FileData, but it must first support
516 sending callbacks to multiple ImageWindows in parallel */
518 gint has_frame; /**< not boolean, see image_new() */
520 /* top level (not necessarily parent) window */
521 gboolean top_window_sync; /**< resize top_window when image dimensions change */
522 GtkWidget *top_window; /**< window that gets title, and window to resize when 'fitting' */
523 gchar *title; /**< window title to display left of file name */
524 gchar *title_right; /**< window title to display right of file name */
525 gboolean title_show_zoom; /**< option to include zoom in window title */
528 ImageState state; /**< mask of IMAGE_STATE_* flags about current image */
530 void (*func_update)(ImageWindow *imd, gpointer data);
531 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
532 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
533 ImageTileRequestFunc func_tile_request;
534 ImageTileDisposeFunc func_tile_dispose;
536 gpointer data_update;
537 gpointer data_complete;
541 /* button, scroll functions */
542 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
543 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
544 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
545 void (*func_focus_in)(ImageWindow *, gpointer);
547 gpointer data_button;
549 gpointer data_scroll;
550 gpointer data_focus_in;
553 * @headerfile func_scroll_notify
554 * scroll notification (for scroll bar implementation)
556 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
558 gpointer data_scroll_notify;
560 /* collection info */
561 CollectionData *collection;
562 CollectInfo *collection_info;
565 gboolean color_profile_enable;
566 gint color_profile_input;
567 gboolean color_profile_use_image;
568 gint color_profile_from_image;
571 AlterType delay_alter_type;
573 FileData *read_ahead_fd;
574 ImageLoader *read_ahead_il;
578 gboolean auto_refresh;
583 gboolean overunderexposed;
586 gboolean mouse_wheel_mode;
589 #define FILEDATA_MARKS_SIZE 10
591 struct _FileDataChangeInfo {
592 FileDataChangeType type;
596 gboolean regroup_when_finished;
602 gchar *original_path; /**< key to file_data_pool hash table */
605 const gchar *extension;
606 gchar *extended_extension;
607 FileFormatClass format_class;
608 gchar *format_name; /**< set by the image loader */
609 gchar *collate_key_name;
610 gchar *collate_key_name_nocase;
614 mode_t mode; /**< this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
615 gint sidecar_priority;
617 guint marks; /**< each bit represents one mark */
618 guint valid_marks; /**< zero bit means that the corresponding mark needs to be reread */
621 GList *sidecar_files;
622 FileData *parent; /**< parent file if this is a sidecar file, NULL otherwise */
623 FileDataChangeInfo *change; /**< for rename, move ... */
624 GdkPixbuf *thumb_pixbuf;
626 GdkPixbuf *pixbuf; /**< full-size image, only complete images, NULL during loading
627 all FileData with non-NULL pixbuf are referenced by image_cache */
633 gint version; /**< increased when any field in this structure is changed */
634 gboolean disable_grouping;
636 gint user_orientation;
637 gint exif_orientation;
641 time_t exifdate_digitized;
642 GHashTable *modified_xmp; /**< hash table which contains unwritten xmp metadata in format: key->list of string values */
643 GList *cached_metadata;
645 gboolean metadata_in_idle_loaded;
651 SelectionType selected; /**< Used by view_file_icon. */
657 struct _LayoutOptions
664 DirViewType dir_view_type;
665 FileViewType file_view_type;
670 } dir_view_list_sort;
672 gboolean show_thumbnails;
674 gboolean show_file_filter;
675 gboolean show_directory_date;
676 gboolean show_info_pixel;
677 gboolean split_pane_sync;
678 gboolean ignore_alpha;
709 gint histogram_channel;
726 } preferences_window;
747 } advanced_exif_window;
749 gboolean tools_float;
750 gboolean tools_hidden;
751 gboolean toolbar_hidden;
756 gboolean tools_float;
757 gboolean tools_hidden;
764 StartUpPath startup_path;
769 SortActionType action;
771 SortSelectionType selection;
777 LayoutOptions options;
787 GtkWidget *group_box;
791 /* menus, path selector */
793 GtkActionGroup *action_group;
794 GtkActionGroup *action_group_editors;
796 GtkUIManager *ui_manager;
797 guint toolbar_merge_id[TOOLBAR_COUNT];
798 GList *toolbar_actions[TOOLBAR_COUNT];
800 GtkWidget *path_entry;
804 LayoutLocation image_location;
808 ImageWindow *split_images[MAX_SPLIT_IMAGES];
809 ImageSplitMode split_mode;
810 gint active_split_image;
812 GtkWidget *split_image_widget;
813 GtkSizeGroup *split_image_sizegroup;
815 /* tools window (float) */
818 GtkWidget *tools_pane;
821 // gint tools_hidden;
822 GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
823 GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
826 GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
827 // gint toolbar_hidden;
829 // GtkWidget *thumb_button;
830 // gint thumbs_enabled;
831 // gint marks_enabled;
833 GtkWidget *back_button;
837 LayoutLocation dir_location;
842 // DirViewType dir_view_type;
846 LayoutLocation file_location;
849 // FileViewType file_view_type;
851 GtkWidget *file_view;
853 SortType sort_method;
854 gboolean sort_ascend;
856 GtkWidget *info_box; /**< status bar */
857 GtkWidget *info_progress_bar; /**< status bar */
858 GtkWidget *info_sort; /**< status bar */
859 GtkWidget *info_status; /**< status bar */
860 GtkWidget *info_details; /**< status bar */
861 GtkWidget *info_zoom; /**< status bar */
862 GtkWidget *info_pixel; /**< status bar */
866 SlideShowData *slideshow;
870 FullScreenData *full_screen;
880 GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
881 GtkWidget *utility_paned; /**< between image and bar */
885 gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
890 GtkWidget *exif_window;
891 GtkWidget *sar_window; /**< Search and Run window */
893 AnimationData *animation;
895 GtkWidget *log_window;
912 guint drop_scroll_id; /**< event source id */
915 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
916 gpointer select_data;
918 void (*dnd_drop_update_func)(ViewDir *vd);
919 void (*dnd_drop_leave_func)(ViewDir *vd);
921 LayoutWindow *layout;
928 struct _ViewDirInfoList
933 struct _ViewDirInfoTree
935 guint drop_expand_id; /**< event source id */
942 FileViewType type; /**< @todo (xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h). */
950 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
957 gboolean case_sensitive;
963 SortType sort_method;
964 gboolean sort_ascend;
967 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
968 gpointer data_thumb_status;
970 void (*func_status)(ViewFile *vf, gpointer data);
971 gpointer data_status;
973 LayoutWindow *layout;
978 gboolean thumbs_running;
979 ThumbLoader *thumbs_loader;
980 FileData *thumbs_filedata;
983 gboolean marks_enabled;
988 FileData *stars_filedata;
992 guint refresh_idle_id; /**< event source id */
993 time_t time_refresh_set; /**< time when refresh_idle_id was set */
995 GList *editmenu_fd_list; /**< file list for edit menu */
997 guint read_metadata_in_idle_id;
1000 struct _ViewFileInfoList
1003 FileData *select_fd;
1005 gboolean thumbs_enabled;
1007 guint select_idle_id; /**< event source id */
1010 struct _ViewFileInfoIcon
1017 FileData *prev_selection;
1019 GtkWidget *tip_window;
1020 guint tip_delay_id; /**< event source id */
1032 struct _SlideShowData
1034 LayoutWindow *lw; /**< use this window to display the slideshow */
1035 ImageWindow *imd; /**< use this window only if lw is not available,
1036 @FIXME it is probably required only by img-view.c and should be dropped with it */
1048 guint timeout_id; /**< event source id */
1050 gboolean from_selection;
1052 void (*stop_func)(SlideShowData *, gpointer);
1058 struct _FullScreenData
1063 GtkWidget *normal_window;
1064 ImageWindow *normal_imd;
1066 guint hide_mouse_id; /**< event source id */
1067 guint busy_mouse_id; /**< event source id */
1071 guint saver_block_id; /**< event source id */
1073 void (*stop_func)(FullScreenData *, gpointer);
1076 gboolean same_region; /**< the returned region will overlap the current location of widget. */
1079 struct _PixmapFolders
1088 struct _SecureSaveInfo {
1089 FILE *fp; /**< file stream pointer */
1090 gchar *file_name; /**< final file name */
1091 gchar *tmp_file_name; /**< temporary file name */
1092 gint err; /**< set to non-zero value in case of error */
1093 gboolean secure_save; /**< use secure save for this file, internal use only */
1094 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1095 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1096 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1103 gboolean startup_blank;
1104 gboolean startup_full_screen;
1105 gboolean startup_in_slideshow;
1106 gboolean startup_command_line_collection;
1107 gboolean tools_hide;
1108 gboolean tools_show;
1109 gboolean log_window_show;
1113 GList *collection_list;
1117 SecureSaveInfo *ssi;
1118 gboolean new_instance;
1122 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */