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 // Keep this up to date!
52 DIRVIEW_LAST = DIRVIEW_TREE
59 // Keep this up to date!
60 FILEVIEW_LAST = FILEVIEW_ICON
63 #define CMD_COPY "geeqie-copy-command.desktop"
64 #define CMD_MOVE "geeqie-move-command.desktop"
65 #define CMD_RENAME "geeqie-rename-command.desktop"
66 #define CMD_DELETE "geeqie-delete-command.desktop"
67 #define CMD_FOLDER "geeqie-folder-command.desktop"
78 SORT_EXIFTIMEDIGITIZED,
83 /* drag and drop default action */
91 ALTER_NONE, /* do nothing */
93 ALTER_ROTATE_90_CC, /* counterclockwise */
101 LAYOUT_LEFT = 1 << 0,
102 LAYOUT_RIGHT = 1 << 1,
104 LAYOUT_BOTTOM = 1 << 3
109 IMAGE_STATE_NONE = 0,
110 IMAGE_STATE_IMAGE = 1 << 0,
111 IMAGE_STATE_LOADING = 1 << 1,
112 IMAGE_STATE_ERROR = 1 << 2,
113 IMAGE_STATE_COLOR_ADJ = 1 << 3,
114 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
115 IMAGE_STATE_ROTATE_USER = 1 << 5,
116 IMAGE_STATE_DELAY_FLIP = 1 << 6
127 FILEDATA_CHANGE_DELETE,
128 FILEDATA_CHANGE_MOVE,
129 FILEDATA_CHANGE_RENAME,
130 FILEDATA_CHANGE_COPY,
131 FILEDATA_CHANGE_UNSPECIFIED,
132 FILEDATA_CHANGE_WRITE_METADATA
133 } FileDataChangeType;
140 } MarkToSelectionMode;
146 } SelectionToMarkMode;
149 FORMAT_CLASS_UNKNOWN,
151 FORMAT_CLASS_RAWIMAGE,
154 FORMAT_CLASS_COLLECTION,
155 FORMAT_CLASS_DOCUMENT,
159 /* defined in preferences.c */
160 extern gchar *format_class_list[];
164 SS_ERR_DISABLED, /**< secsave is disabled. */
165 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
167 /* see err field in SecureSaveInfo */
178 NOTIFY_PRIORITY_HIGH = 0,
179 NOTIFY_PRIORITY_MEDIUM,
184 NOTIFY_MARKS = 1 << 1, /* changed marks */
185 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
186 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
187 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
188 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
189 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
190 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
191 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
196 CHANGE_WARN_DEST_EXISTS = 1 << 0,
197 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
198 CHANGE_WARN_SAME = 1 << 2,
199 CHANGE_WARN_CHANGED_EXT = 1 << 3,
200 CHANGE_WARN_UNSAVED_META = 1 << 4,
201 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
202 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
203 CHANGE_NO_READ_PERM = 1 << 8,
204 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
205 CHANGE_NO_DEST_DIR = 1 << 10,
206 CHANGE_DUPLICATE_DEST = 1 << 11,
207 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
208 CHANGE_DEST_EXISTS = 1 << 13,
209 CHANGE_NO_SRC = 1 << 14,
210 CHANGE_GENERIC_ERROR = 1 << 16
214 METADATA_PLAIN = 0, /* format that can be edited and written back */
215 METADATA_FORMATTED = 1 /* for display only */
219 STARTUP_PATH_CURRENT = 0,
231 PR_STEREO_NONE = 0, /* do nothing */
232 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
233 PR_STEREO_FIXED = 1 << 1, /* custom position */
234 PR_STEREO_HORIZ = 1 << 2, /* side by side */
235 PR_STEREO_VERT = 1 << 3, /* above below */
236 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
237 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
238 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
239 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
240 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
241 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
242 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
243 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
244 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
245 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
246 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
247 PR_STEREO_ANAGLYPH_GM |
248 PR_STEREO_ANAGLYPH_YB |
249 PR_STEREO_ANAGLYPH_GRAY_RC |
250 PR_STEREO_ANAGLYPH_GRAY_GM |
251 PR_STEREO_ANAGLYPH_GRAY_YB |
252 PR_STEREO_ANAGLYPH_DB_RC |
253 PR_STEREO_ANAGLYPH_DB_GM |
254 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
256 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
257 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
259 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
260 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
262 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
263 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
264 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
265 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
266 PR_STEREO_HALF = 1 << 20
267 } PixbufRendererStereoMode;
270 STEREO_PIXBUF_DEFAULT = 0,
271 STEREO_PIXBUF_SBS = 1,
272 STEREO_PIXBUF_CROSS = 2,
273 STEREO_PIXBUF_NONE = 3
277 BAR_SORT_MODE_FOLDER = 0,
278 BAR_SORT_MODE_COLLECTION,
286 BAR_SORT_ACTION_COUNT
290 BAR_SORT_SELECTION_IMAGE = 0,
291 BAR_SORT_SELECTION_SELECTED,
292 BAR_SORT_SELECTION_COUNT
295 #define MAX_SPLIT_IMAGES 4
299 SELECTION_SELECTED = 1 << 0,
300 SELECTION_PRELIGHT = 1 << 1,
301 SELECTION_FOCUS = 1 << 2
304 typedef struct _ImageLoader ImageLoader;
305 typedef struct _ThumbLoader ThumbLoader;
307 typedef struct _AnimationData AnimationData;
309 typedef struct _CollectInfo CollectInfo;
310 typedef struct _CollectionData CollectionData;
311 typedef struct _CollectTable CollectTable;
312 typedef struct _CollectWindow CollectWindow;
314 typedef struct _ImageWindow ImageWindow;
316 typedef struct _FileData FileData;
317 typedef struct _FileDataChangeInfo FileDataChangeInfo;
319 typedef struct _LayoutWindow LayoutWindow;
320 typedef struct _LayoutOptions LayoutOptions;
322 typedef struct _ViewDir ViewDir;
323 typedef struct _ViewDirInfoList ViewDirInfoList;
324 typedef struct _ViewDirInfoTree ViewDirInfoTree;
326 typedef struct _ViewFile ViewFile;
327 typedef struct _ViewFileInfoList ViewFileInfoList;
328 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
330 typedef struct _SlideShowData SlideShowData;
331 typedef struct _FullScreenData FullScreenData;
333 typedef struct _PixmapFolders PixmapFolders;
334 typedef struct _Histogram Histogram;
335 typedef struct _HistMap HistMap;
337 typedef struct _SecureSaveInfo SecureSaveInfo;
339 typedef struct _ExifData ExifData;
341 typedef struct _EditorDescription EditorDescription;
343 typedef struct _CommandLine CommandLine;
346 gint histogram_channel; /* drawing mode for histogram */
347 gint histogram_mode; /* logarithmical or not */
348 guint vgrid; /* number of vertical divisions, 0 for none */
349 guint hgrid; /* number of horizontal divisions, 0 for none */
355 } grid_color; /* grid color */
363 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
365 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
369 gboolean standard_loader;
372 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
374 gboolean cache_enable;
376 gdouble percent_done;
381 ThumbLoaderFunc func_done;
382 ThumbLoaderFunc func_error;
383 ThumbLoaderFunc func_progress;
387 guint idle_done_id; /* event source id */
390 struct _AnimationData
394 GdkPixbufAnimation *gpa;
395 GdkPixbufAnimationIter *iter;
400 GCancellable *cancellable;
402 GFileInputStream *gfstream;
412 struct _CollectionData
417 SortType sort_method;
419 ThumbLoader *thumb_loader;
420 CollectInfo *thumb_info;
422 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
423 gpointer info_updated_data;
434 /* contents changed since save flag */
437 GHashTable *existence;
450 CollectInfo *prev_selection;
452 CollectInfo *click_info;
454 GtkWidget *tip_window;
455 guint tip_delay_id; /* event source id */
456 CollectInfo *tip_info;
458 GdkWindow *marker_window;
459 CollectInfo *marker_info;
461 GtkWidget *status_label;
462 GtkWidget *extra_label;
466 CollectInfo *focus_info;
469 CollectInfo *drop_info;
472 guint sync_idle_id; /* event source id */
473 guint drop_idle_id; /* event source id */
478 /* file list for edit menu */
479 GList *editmenu_fd_list;
482 struct _CollectWindow
486 GtkWidget *status_box;
488 GtkWidget *close_dialog;
493 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
494 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
495 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
496 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
500 GtkWidget *widget; /* use this to add it and show it */
506 gboolean unknown; /* failed to load image */
508 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
509 sending callbacks to multiple ImageWindows in parallel */
511 gint has_frame; /* not boolean, see image_new() */
513 /* top level (not necessarily parent) window */
514 gboolean top_window_sync; /* resize top_window when image dimensions change */
515 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
516 gchar *title; /* window title to display left of file name */
517 gchar *title_right; /* window title to display right of file name */
518 gboolean title_show_zoom; /* option to include zoom in window title */
521 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
523 void (*func_update)(ImageWindow *imd, gpointer data);
524 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
525 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
526 ImageTileRequestFunc func_tile_request;
527 ImageTileDisposeFunc func_tile_dispose;
529 gpointer data_update;
530 gpointer data_complete;
534 /* button, scroll functions */
535 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
536 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
537 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
538 void (*func_focus_in)(ImageWindow *, gpointer);
540 gpointer data_button;
542 gpointer data_scroll;
543 gpointer data_focus_in;
545 /* scroll notification (for scroll bar implementation) */
546 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
548 gpointer data_scroll_notify;
550 /* collection info */
551 CollectionData *collection;
552 CollectInfo *collection_info;
555 gboolean color_profile_enable;
556 gint color_profile_input;
557 gboolean color_profile_use_image;
558 gint color_profile_from_image;
561 AlterType delay_alter_type;
563 FileData *read_ahead_fd;
564 ImageLoader *read_ahead_il;
568 gboolean auto_refresh;
573 gboolean overunderexposed;
576 gboolean mouse_wheel_mode;
579 #define FILEDATA_MARKS_SIZE 10
581 struct _FileDataChangeInfo {
582 FileDataChangeType type;
586 gboolean regroup_when_finished;
592 gchar *original_path; /* key to file_data_pool hash table */
595 const gchar *extension;
596 gchar *extended_extension;
597 FileFormatClass format_class;
598 gchar *collate_key_name;
599 gchar *collate_key_name_nocase;
603 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
604 gint sidecar_priority;
606 guint marks; /* each bit represents one mark */
607 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
610 GList *sidecar_files;
611 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
612 FileDataChangeInfo *change; /* for rename, move ... */
613 GdkPixbuf *thumb_pixbuf;
615 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
616 all FileData with non-NULL pixbuf are referenced by image_cache */
622 gint version; /* increased when any field in this structure is changed */
623 gboolean disable_grouping;
625 gint user_orientation;
626 gint exif_orientation;
630 time_t exifdate_digitized;
631 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
632 GList *cached_metadata;
634 gboolean metadata_in_idle_loaded;
640 SelectionType selected; // Used by view_file_icon.
646 struct _LayoutOptions
653 DirViewType dir_view_type;
654 FileViewType file_view_type;
659 } dir_view_list_sort;
661 gboolean show_thumbnails;
663 gboolean show_file_filter;
664 gboolean show_directory_date;
665 gboolean show_info_pixel;
666 gboolean split_pane_sync;
667 gboolean ignore_alpha;
698 gint histogram_channel;
723 gboolean tools_float;
724 gboolean tools_hidden;
725 gboolean toolbar_hidden;
730 gboolean tools_float;
731 gboolean tools_hidden;
738 StartUpPath startup_path;
743 SortActionType action;
745 SortSelectionType selection;
751 LayoutOptions options;
761 GtkWidget *group_box;
765 /* menus, path selector */
767 GtkActionGroup *action_group;
768 GtkActionGroup *action_group_editors;
770 GtkUIManager *ui_manager;
771 guint toolbar_merge_id[TOOLBAR_COUNT];
772 GList *toolbar_actions[TOOLBAR_COUNT];
774 GtkWidget *path_entry;
778 LayoutLocation image_location;
782 ImageWindow *split_images[MAX_SPLIT_IMAGES];
783 ImageSplitMode split_mode;
784 gint active_split_image;
786 GtkWidget *split_image_widget;
787 GtkSizeGroup *split_image_sizegroup;
789 /* tools window (float) */
792 GtkWidget *tools_pane;
795 // gint tools_hidden;
796 GtkWidget *menu_tool_bar; /*Combined menu and toolbar box */
797 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
800 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
801 // gint toolbar_hidden;
803 // GtkWidget *thumb_button;
804 // gint thumbs_enabled;
805 // gint marks_enabled;
807 GtkWidget *back_button;
811 LayoutLocation dir_location;
816 // DirViewType dir_view_type;
820 LayoutLocation file_location;
823 // FileViewType file_view_type;
825 GtkWidget *file_view;
827 SortType sort_method;
828 gboolean sort_ascend;
833 GtkWidget *info_progress_bar;
834 GtkWidget *info_sort;
835 GtkWidget *info_status;
836 GtkWidget *info_details;
837 GtkWidget *info_zoom;
838 GtkWidget *info_pixel;
842 SlideShowData *slideshow;
846 FullScreenData *full_screen;
856 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
857 GtkWidget *utility_paned; /* between image and bar */
861 gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
866 GtkWidget *exif_window;
867 GtkWidget *sar_window; /* Search and Run window */
869 AnimationData *animation;
871 GtkWidget *log_window;
888 guint drop_scroll_id; /* event source id */
891 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
892 gpointer select_data;
894 void (*dnd_drop_update_func)(ViewDir *vd);
895 void (*dnd_drop_leave_func)(ViewDir *vd);
897 LayoutWindow *layout;
904 struct _ViewDirInfoList
909 struct _ViewDirInfoTree
911 guint drop_expand_id; /* event source id */
919 // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
926 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
933 gboolean case_sensitive;
939 SortType sort_method;
940 gboolean sort_ascend;
943 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
944 gpointer data_thumb_status;
946 void (*func_status)(ViewFile *vf, gpointer data);
947 gpointer data_status;
949 LayoutWindow *layout;
954 gboolean thumbs_running;
955 ThumbLoader *thumbs_loader;
956 FileData *thumbs_filedata;
959 gboolean marks_enabled;
964 FileData *stars_filedata;
968 guint refresh_idle_id; /* event source id */
969 time_t time_refresh_set; /* time when refresh_idle_id was set */
971 /* file list for edit menu */
972 GList *editmenu_fd_list;
974 guint read_metadata_in_idle_id;
977 struct _ViewFileInfoList
982 gboolean thumbs_enabled;
984 guint select_idle_id; /* event source id */
987 struct _ViewFileInfoIcon
994 FileData *prev_selection;
996 GtkWidget *tip_window;
997 guint tip_delay_id; /* event source id */
1009 struct _SlideShowData
1011 LayoutWindow *lw; /* use this window to display the slideshow */
1012 ImageWindow *imd; /* use this window only if lw is not available,
1013 FIXME: it is probably required only by img-view.c and should be dropped with it */
1025 guint timeout_id; /* event source id */
1027 gboolean from_selection;
1029 void (*stop_func)(SlideShowData *, gpointer);
1035 struct _FullScreenData
1040 GtkWidget *normal_window;
1041 ImageWindow *normal_imd;
1043 guint hide_mouse_id; /* event source id */
1044 guint busy_mouse_id; /* event source id */
1048 guint saver_block_id; /* event source id */
1050 void (*stop_func)(FullScreenData *, gpointer);
1053 gboolean same_region; /* the returned region will overlap the current location of widget. */
1056 struct _PixmapFolders
1065 struct _SecureSaveInfo {
1066 FILE *fp; /**< file stream pointer */
1067 gchar *file_name; /**< final file name */
1068 gchar *tmp_file_name; /**< temporary file name */
1069 gint err; /**< set to non-zero value in case of error */
1070 gboolean secure_save; /**< use secure save for this file, internal use only */
1071 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1072 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1073 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1080 gboolean startup_blank;
1081 gboolean startup_full_screen;
1082 gboolean startup_in_slideshow;
1083 gboolean startup_command_line_collection;
1084 gboolean tools_hide;
1085 gboolean tools_show;
1086 gboolean log_window_show;
1090 GList *collection_list;
1094 SecureSaveInfo *ssi;
1095 gboolean new_instance;
1099 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */