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,
36 enum ClipboardDestination {
37 CLIPBOARD_TEXT_PLAIN = 0,
38 CLIPBOARD_TEXT_URI_LIST = 1,
39 CLIPBOARD_X_SPECIAL_GNOME_COPIED_FILES = 2,
40 CLIPBOARD_UTF8_STRING = 3
43 enum ClipboardSelection {
44 CLIPBOARD_PRIMARY = 0,
45 CLIPBOARD_CLIPBOARD = 1,
50 MOUSE_BUTTON_LEFT = 1,
51 MOUSE_BUTTON_MIDDLE = 2,
52 MOUSE_BUTTON_RIGHT = 3,
53 MOUSE_BUTTON_WHEEL_UP = 4,
54 MOUSE_BUTTON_WHEEL_DOWN = 5,
63 DIRVIEW_LAST = DIRVIEW_TREE /**< Keep this up to date! */
70 FILEVIEW_LAST = FILEVIEW_ICON /**< Keep this up to date! */
73 #define CMD_COPY "geeqie-copy-command.desktop"
74 #define CMD_MOVE "geeqie-move-command.desktop"
75 #define CMD_RENAME "geeqie-rename-command.desktop"
76 #define CMD_DELETE "geeqie-delete-command.desktop"
77 #define CMD_FOLDER "geeqie-folder-command.desktop"
87 SORT_EXIFTIMEDIGITIZED,
94 * drag and drop default action
103 ALTER_NONE, /**< do nothing */
105 ALTER_ROTATE_90_CC, /**< counterclockwise */
111 enum LayoutLocation {
113 LAYOUT_LEFT = 1 << 0,
114 LAYOUT_RIGHT = 1 << 1,
116 LAYOUT_BOTTOM = 1 << 3
121 IMAGE_STATE_NONE = 0,
122 IMAGE_STATE_IMAGE = 1 << 0,
123 IMAGE_STATE_LOADING = 1 << 1,
124 IMAGE_STATE_ERROR = 1 << 2,
125 IMAGE_STATE_COLOR_ADJ = 1 << 3,
126 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
127 IMAGE_STATE_ROTATE_USER = 1 << 5,
128 IMAGE_STATE_DELAY_FLIP = 1 << 6
131 enum ImageSplitMode {
139 enum FileDataChangeType {
140 FILEDATA_CHANGE_DELETE,
141 FILEDATA_CHANGE_MOVE,
142 FILEDATA_CHANGE_RENAME,
143 FILEDATA_CHANGE_COPY,
144 FILEDATA_CHANGE_UNSPECIFIED,
145 FILEDATA_CHANGE_WRITE_METADATA
148 enum MarkToSelectionMode {
155 enum SelectionToMarkMode {
161 enum FileFormatClass {
162 FORMAT_CLASS_UNKNOWN,
164 FORMAT_CLASS_RAWIMAGE,
167 FORMAT_CLASS_COLLECTION,
168 FORMAT_CLASS_DOCUMENT,
169 FORMAT_CLASS_ARCHIVE,
173 extern const gchar *format_class_list[]; /**< defined in preferences.cc */
176 * @enum SecureSaveErrno
177 * see err field in #SecureSaveInfo
179 enum SecureSaveErrno {
181 SS_ERR_DISABLED, /**< secsave is disabled. */
182 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
193 enum NotifyPriority {
194 NOTIFY_PRIORITY_HIGH = 0,
195 NOTIFY_PRIORITY_MEDIUM,
200 NOTIFY_MARKS = 1 << 1, /**< changed marks */
201 NOTIFY_PIXBUF = 1 << 2, /**< image was read into fd->pixbuf */
202 NOTIFY_HISTMAP = 1 << 3, /**< histmap was read into fd->histmap */
203 NOTIFY_ORIENTATION = 1 << 4, /**< image was rotated */
204 NOTIFY_METADATA = 1 << 5, /**< changed image metadata, not yet written */
205 NOTIFY_GROUPING = 1 << 6, /**< change in fd->sidecar_files or fd->parent */
206 NOTIFY_REREAD = 1 << 7, /**< changed file size, date, etc., file name remains unchanged */
207 NOTIFY_CHANGE = 1 << 8 /**< generic change described by fd->change */
212 CHANGE_WARN_DEST_EXISTS = 1 << 0,
213 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
214 CHANGE_WARN_SAME = 1 << 2,
215 CHANGE_WARN_CHANGED_EXT = 1 << 3,
216 CHANGE_WARN_UNSAVED_META = 1 << 4,
217 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
218 CHANGE_ERROR_MASK = ~0xff, /**< the values below are fatal errors */
219 CHANGE_NO_READ_PERM = 1 << 8,
220 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
221 CHANGE_NO_DEST_DIR = 1 << 10,
222 CHANGE_DUPLICATE_DEST = 1 << 11,
223 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
224 CHANGE_DEST_EXISTS = 1 << 13,
225 CHANGE_NO_SRC = 1 << 14,
226 CHANGE_GENERIC_ERROR = 1 << 16
229 enum MetadataFormat {
230 METADATA_PLAIN = 0, /**< format that can be edited and written back */
231 METADATA_FORMATTED = 1 /**< for display only */
235 STARTUP_PATH_CURRENT = 0,
246 enum PixbufRendererStereoMode {
247 PR_STEREO_NONE = 0, /**< do nothing */
248 PR_STEREO_DUAL = 1 << 0, /**< independent stereo buffers, for example nvidia opengl */
249 PR_STEREO_FIXED = 1 << 1, /**< custom position */
250 PR_STEREO_HORIZ = 1 << 2, /**< side by side */
251 PR_STEREO_VERT = 1 << 3, /**< above below */
252 PR_STEREO_RIGHT = 1 << 4, /**< render right buffer */
253 PR_STEREO_ANAGLYPH_RC = 1 << 5, /**< anaglyph red-cyan */
254 PR_STEREO_ANAGLYPH_GM = 1 << 6, /**< anaglyph green-magenta */
255 PR_STEREO_ANAGLYPH_YB = 1 << 7, /**< anaglyph yellow-blue */
256 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /**< anaglyph gray red-cyan*/
257 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /**< anaglyph gray green-magenta */
258 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /**< anaglyph gray yellow-blue */
259 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /**< anaglyph dubois red-cyan */
260 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /**< anaglyph dubois green-magenta */
261 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /**< anaglyph dubois yellow-blue */
262 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
263 PR_STEREO_ANAGLYPH_GM |
264 PR_STEREO_ANAGLYPH_YB |
265 PR_STEREO_ANAGLYPH_GRAY_RC |
266 PR_STEREO_ANAGLYPH_GRAY_GM |
267 PR_STEREO_ANAGLYPH_GRAY_YB |
268 PR_STEREO_ANAGLYPH_DB_RC |
269 PR_STEREO_ANAGLYPH_DB_GM |
270 PR_STEREO_ANAGLYPH_DB_YB, /**< anaglyph mask */
272 PR_STEREO_MIRROR_LEFT = 1 << 14, /**< mirror */
273 PR_STEREO_FLIP_LEFT = 1 << 15, /**< flip */
275 PR_STEREO_MIRROR_RIGHT = 1 << 16, /**< mirror */
276 PR_STEREO_FLIP_RIGHT = 1 << 17, /**< flip */
278 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /**< mirror mask*/
279 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /**< flip mask*/
280 PR_STEREO_SWAP = 1 << 18, /**< swap left and right buffers */
281 PR_STEREO_TEMP_DISABLE = 1 << 19, /**< temporarily disable stereo mode if source image is not stereo */
282 PR_STEREO_HALF = 1 << 20
285 enum StereoPixbufData {
286 STEREO_PIXBUF_DEFAULT = 0,
287 STEREO_PIXBUF_SBS = 1,
288 STEREO_PIXBUF_CROSS = 2,
289 STEREO_PIXBUF_NONE = 3
293 BAR_SORT_MODE_FOLDER = 0,
294 BAR_SORT_MODE_COLLECTION,
298 enum SortActionType {
302 BAR_SORT_ACTION_COUNT
305 enum SortSelectionType {
306 BAR_SORT_SELECTION_IMAGE = 0,
307 BAR_SORT_SELECTION_SELECTED,
308 BAR_SORT_SELECTION_COUNT
311 #define MAX_SPLIT_IMAGES 4
315 SELECTION_SELECTED = 1 << 0,
316 SELECTION_PRELIGHT = 1 << 1,
317 SELECTION_FOCUS = 1 << 2
323 struct AnimationData;
326 struct CollectionData;
328 struct CollectWindow;
333 struct FileDataChangeInfo;
336 struct LayoutOptions;
339 struct ViewDirInfoList;
340 struct ViewDirInfoTree;
343 struct ViewFileInfoList;
344 struct ViewFileInfoIcon;
346 struct SlideShowData;
347 struct FullScreenData;
349 struct PixmapFolders;
353 struct SecureSaveInfo;
357 struct EditorDescription;
362 gint histogram_channel; /**< drawing mode for histogram */
363 gint histogram_mode; /**< logarithmical or not */
364 guint vgrid; /**< number of vertical divisions, 0 for none */
365 guint hgrid; /**< number of horizontal divisions, 0 for none */
371 } grid_color; /**< grid color */
379 using ThumbLoaderFunc = void (*)(ThumbLoader *, gpointer);
381 using FileUtilDoneFunc = void (*)(gboolean, const gchar *, gpointer);
385 gboolean standard_loader;
388 FileData *fd; /**< fd->pixbuf contains final (scaled) image when done */
390 gboolean cache_enable;
392 gdouble percent_done;
397 ThumbLoaderFunc func_done;
398 ThumbLoaderFunc func_error;
399 ThumbLoaderFunc func_progress;
403 guint idle_done_id; /**< event source id */
410 GdkPixbufAnimation *gpa;
411 GdkPixbufAnimationIter *iter;
416 GCancellable *cancellable;
418 GFileInputStream *gfstream;
428 struct CollectionData
433 SortType sort_method;
435 ThumbLoader *thumb_loader;
436 CollectInfo *thumb_info;
438 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
439 gpointer info_updated_data;
450 gboolean changed; /**< contents changed since save flag */
452 GHashTable *existence;
465 CollectInfo *prev_selection;
467 CollectInfo *click_info;
469 GtkWidget *tip_window;
470 guint tip_delay_id; /**< event source id */
471 CollectInfo *tip_info;
473 GdkWindow *marker_window;
474 CollectInfo *marker_info;
476 GtkWidget *status_label;
477 GtkWidget *extra_label;
481 CollectInfo *focus_info;
484 CollectInfo *drop_info;
487 guint sync_idle_id; /**< event source id */
488 guint drop_idle_id; /**< event source id */
493 GList *editmenu_fd_list; /**< file list for edit menu */
500 GtkWidget *status_box;
502 GtkWidget *close_dialog;
507 using ImageTileRequestFunc = gint (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
508 using ImageTileDisposeFunc = void (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
512 GtkWidget *widget; /**< use this to add it and show it */
518 gboolean unknown; /**< failed to load image */
520 ImageLoader *il; /**< @FIXME image loader should probably go to FileData, but it must first support
521 sending callbacks to multiple ImageWindows in parallel */
523 gint has_frame; /**< not boolean, see image_new() */
525 /* top level (not necessarily parent) window */
526 gboolean top_window_sync; /**< resize top_window when image dimensions change */
527 GtkWidget *top_window; /**< window that gets title, and window to resize when 'fitting' */
528 gchar *title; /**< window title to display left of file name */
529 gchar *title_right; /**< window title to display right of file name */
530 gboolean title_show_zoom; /**< option to include zoom in window title */
533 ImageState state; /**< mask of IMAGE_STATE_* flags about current image */
535 void (*func_update)(ImageWindow *imd, gpointer data);
536 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
537 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
538 ImageTileRequestFunc func_tile_request;
539 ImageTileDisposeFunc func_tile_dispose;
541 gpointer data_update;
542 gpointer data_complete;
546 /* button, scroll functions */
547 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
548 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
549 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
550 void (*func_focus_in)(ImageWindow *, gpointer);
552 gpointer data_button;
554 gpointer data_scroll;
555 gpointer data_focus_in;
558 * @headerfile func_scroll_notify
559 * scroll notification (for scroll bar implementation)
561 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
563 gpointer data_scroll_notify;
565 /* collection info */
566 CollectionData *collection;
567 CollectInfo *collection_info;
570 gboolean color_profile_enable;
571 gint color_profile_input;
572 gboolean color_profile_use_image;
573 gint color_profile_from_image;
576 AlterType delay_alter_type;
578 FileData *read_ahead_fd;
579 ImageLoader *read_ahead_il;
583 gboolean auto_refresh;
588 gboolean overunderexposed;
591 gboolean mouse_wheel_mode;
594 #define FILEDATA_MARKS_SIZE 10
596 struct FileDataChangeInfo {
597 FileDataChangeType type;
601 gboolean regroup_when_finished;
607 gchar *original_path; /**< key to file_data_pool hash table */
610 const gchar *extension;
611 gchar *extended_extension;
612 FileFormatClass format_class;
613 gchar *format_name; /**< set by the image loader */
614 gchar *collate_key_name;
615 gchar *collate_key_name_nocase;
619 mode_t mode; /**< this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
620 gint sidecar_priority;
622 guint marks; /**< each bit represents one mark */
623 guint valid_marks; /**< zero bit means that the corresponding mark needs to be reread */
626 GList *sidecar_files;
627 FileData *parent; /**< parent file if this is a sidecar file, NULL otherwise */
628 FileDataChangeInfo *change; /**< for rename, move ... */
629 GdkPixbuf *thumb_pixbuf;
631 GdkPixbuf *pixbuf; /**< full-size image, only complete images, NULL during loading
632 all FileData with non-NULL pixbuf are referenced by image_cache */
638 gint version; /**< increased when any field in this structure is changed */
639 gboolean disable_grouping;
641 gint user_orientation;
642 gint exif_orientation;
646 time_t exifdate_digitized;
647 GHashTable *modified_xmp; /**< hash table which contains unwritten xmp metadata in format: key->list of string values */
648 GList *cached_metadata;
650 gboolean metadata_in_idle_loaded;
656 SelectionType selected; /**< Used by view-file-icon. */
669 DirViewType dir_view_type;
670 FileViewType file_view_type;
675 } dir_view_list_sort;
677 gboolean show_thumbnails;
679 gboolean show_file_filter;
680 gboolean show_directory_date;
681 gboolean show_info_pixel;
682 gboolean split_pane_sync;
683 gboolean ignore_alpha;
714 gint histogram_channel;
731 } preferences_window;
752 } advanced_exif_window;
754 gboolean tools_float;
755 gboolean tools_hidden;
756 gboolean toolbar_hidden;
761 gboolean tools_float;
762 gboolean tools_hidden;
769 StartUpPath startup_path;
774 SortActionType action;
776 SortSelectionType selection;
782 LayoutOptions options;
792 GtkWidget *group_box;
796 /* menus, path selector */
798 GtkActionGroup *action_group;
799 GtkActionGroup *action_group_editors;
801 GtkUIManager *ui_manager;
802 guint toolbar_merge_id[TOOLBAR_COUNT];
803 GList *toolbar_actions[TOOLBAR_COUNT];
805 GtkWidget *path_entry;
809 LayoutLocation image_location;
813 ImageWindow *split_images[MAX_SPLIT_IMAGES];
814 ImageSplitMode split_mode;
815 gint active_split_image;
817 GtkWidget *split_image_widget;
818 GtkSizeGroup *split_image_sizegroup;
820 /* tools window (float) */
823 GtkWidget *tools_pane;
825 GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
826 GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
829 GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
831 GtkWidget *back_button;
835 LayoutLocation dir_location;
842 LayoutLocation file_location;
846 GtkWidget *file_view;
848 SortType sort_method;
849 gboolean sort_ascend;
851 GtkWidget *info_box; /**< status bar */
852 GtkWidget *info_progress_bar; /**< status bar */
853 GtkWidget *info_sort; /**< status bar */
854 GtkWidget *info_status; /**< status bar */
855 GtkWidget *info_details; /**< status bar */
856 GtkWidget *info_zoom; /**< status bar */
857 GtkWidget *info_pixel; /**< status bar */
861 SlideShowData *slideshow;
865 FullScreenData *full_screen;
869 GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
870 GtkWidget *utility_paned; /**< between image and bar */
874 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.cc 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
1072 GdkPixbuf *read_only;
1075 struct SecureSaveInfo {
1076 FILE *fp; /**< file stream pointer */
1077 gchar *file_name; /**< final file name */
1078 gchar *tmp_file_name; /**< temporary file name */
1079 gint err; /**< set to non-zero value in case of error */
1080 gboolean secure_save; /**< use secure save for this file, internal use only */
1081 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1082 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1083 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1090 gboolean startup_blank;
1091 gboolean startup_full_screen;
1092 gboolean startup_in_slideshow;
1093 gboolean startup_command_line_collection;
1094 gboolean tools_hide;
1095 gboolean tools_show;
1096 gboolean log_window_show;
1100 GList *collection_list;
1104 SecureSaveInfo *ssi;
1105 gboolean new_instance;
1109 * @struct hard_coded_window_keys
1110 * @brief hard coded window shortcut keys
1112 * Used for two purposes:\n
1113 * to display the shortcuts keys in popup menus\n
1114 * used by ./doc/create-shortcuts-xml.sh to generate shortcut documentation in the Help files
1117 struct hard_coded_window_keys {
1118 GdkModifierType mask; /**< modifier key mask */
1119 guint key_value; /**< GDK_keyval */
1120 const gchar *text; /**< menu item label - NULL if end of list */
1124 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */