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,
157 FORMAT_CLASS_ARCHIVE,
161 extern gchar *format_class_list[]; /**< defined in preferences.c */
164 * @typedef SecureSaveErrno
165 * see err field in #SecureSaveInfo
169 SS_ERR_DISABLED, /**< secsave is disabled. */
170 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
182 NOTIFY_PRIORITY_HIGH = 0,
183 NOTIFY_PRIORITY_MEDIUM,
188 NOTIFY_MARKS = 1 << 1, /**< changed marks */
189 NOTIFY_PIXBUF = 1 << 2, /**< image was read into fd->pixbuf */
190 NOTIFY_HISTMAP = 1 << 3, /**< histmap was read into fd->histmap */
191 NOTIFY_ORIENTATION = 1 << 4, /**< image was rotated */
192 NOTIFY_METADATA = 1 << 5, /**< changed image metadata, not yet written */
193 NOTIFY_GROUPING = 1 << 6, /**< change in fd->sidecar_files or fd->parent */
194 NOTIFY_REREAD = 1 << 7, /**< changed file size, date, etc., file name remains unchanged */
195 NOTIFY_CHANGE = 1 << 8 /**< generic change described by fd->change */
200 CHANGE_WARN_DEST_EXISTS = 1 << 0,
201 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
202 CHANGE_WARN_SAME = 1 << 2,
203 CHANGE_WARN_CHANGED_EXT = 1 << 3,
204 CHANGE_WARN_UNSAVED_META = 1 << 4,
205 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
206 CHANGE_ERROR_MASK = (~0U) << 8, /**< the values below are fatal errors */
207 CHANGE_NO_READ_PERM = 1 << 8,
208 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
209 CHANGE_NO_DEST_DIR = 1 << 10,
210 CHANGE_DUPLICATE_DEST = 1 << 11,
211 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
212 CHANGE_DEST_EXISTS = 1 << 13,
213 CHANGE_NO_SRC = 1 << 14,
214 CHANGE_GENERIC_ERROR = 1 << 16
218 METADATA_PLAIN = 0, /**< format that can be edited and written back */
219 METADATA_FORMATTED = 1 /**< for display only */
223 STARTUP_PATH_CURRENT = 0,
235 PR_STEREO_NONE = 0, /**< do nothing */
236 PR_STEREO_DUAL = 1 << 0, /**< independent stereo buffers, for example nvidia opengl */
237 PR_STEREO_FIXED = 1 << 1, /**< custom position */
238 PR_STEREO_HORIZ = 1 << 2, /**< side by side */
239 PR_STEREO_VERT = 1 << 3, /**< above below */
240 PR_STEREO_RIGHT = 1 << 4, /**< render right buffer */
241 PR_STEREO_ANAGLYPH_RC = 1 << 5, /**< anaglyph red-cyan */
242 PR_STEREO_ANAGLYPH_GM = 1 << 6, /**< anaglyph green-magenta */
243 PR_STEREO_ANAGLYPH_YB = 1 << 7, /**< anaglyph yellow-blue */
244 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /**< anaglyph gray red-cyan*/
245 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /**< anaglyph gray green-magenta */
246 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /**< anaglyph gray yellow-blue */
247 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /**< anaglyph dubois red-cyan */
248 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /**< anaglyph dubois green-magenta */
249 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /**< anaglyph dubois yellow-blue */
250 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
251 PR_STEREO_ANAGLYPH_GM |
252 PR_STEREO_ANAGLYPH_YB |
253 PR_STEREO_ANAGLYPH_GRAY_RC |
254 PR_STEREO_ANAGLYPH_GRAY_GM |
255 PR_STEREO_ANAGLYPH_GRAY_YB |
256 PR_STEREO_ANAGLYPH_DB_RC |
257 PR_STEREO_ANAGLYPH_DB_GM |
258 PR_STEREO_ANAGLYPH_DB_YB, /**< anaglyph mask */
260 PR_STEREO_MIRROR_LEFT = 1 << 14, /**< mirror */
261 PR_STEREO_FLIP_LEFT = 1 << 15, /**< flip */
263 PR_STEREO_MIRROR_RIGHT = 1 << 16, /**< mirror */
264 PR_STEREO_FLIP_RIGHT = 1 << 17, /**< flip */
266 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /**< mirror mask*/
267 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /**< flip mask*/
268 PR_STEREO_SWAP = 1 << 18, /**< swap left and right buffers */
269 PR_STEREO_TEMP_DISABLE = 1 << 19, /**< temporarily disable stereo mode if source image is not stereo */
270 PR_STEREO_HALF = 1 << 20
271 } PixbufRendererStereoMode;
274 STEREO_PIXBUF_DEFAULT = 0,
275 STEREO_PIXBUF_SBS = 1,
276 STEREO_PIXBUF_CROSS = 2,
277 STEREO_PIXBUF_NONE = 3
281 BAR_SORT_MODE_FOLDER = 0,
282 BAR_SORT_MODE_COLLECTION,
290 BAR_SORT_ACTION_COUNT
294 BAR_SORT_SELECTION_IMAGE = 0,
295 BAR_SORT_SELECTION_SELECTED,
296 BAR_SORT_SELECTION_COUNT
299 #define MAX_SPLIT_IMAGES 4
303 SELECTION_SELECTED = 1 << 0,
304 SELECTION_PRELIGHT = 1 << 1,
305 SELECTION_FOCUS = 1 << 2
308 typedef struct _ImageLoader ImageLoader;
309 typedef struct _ThumbLoader ThumbLoader;
311 typedef struct _AnimationData AnimationData;
313 typedef struct _CollectInfo CollectInfo;
314 typedef struct _CollectionData CollectionData;
315 typedef struct _CollectTable CollectTable;
316 typedef struct _CollectWindow CollectWindow;
318 typedef struct _ImageWindow ImageWindow;
320 typedef struct _FileData FileData;
321 typedef struct _FileDataChangeInfo FileDataChangeInfo;
323 typedef struct _LayoutWindow LayoutWindow;
324 typedef struct _LayoutOptions LayoutOptions;
326 typedef struct _ViewDir ViewDir;
327 typedef struct _ViewDirInfoList ViewDirInfoList;
328 typedef struct _ViewDirInfoTree ViewDirInfoTree;
330 typedef struct _ViewFile ViewFile;
331 typedef struct _ViewFileInfoList ViewFileInfoList;
332 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
334 typedef struct _SlideShowData SlideShowData;
335 typedef struct _FullScreenData FullScreenData;
337 typedef struct _PixmapFolders PixmapFolders;
338 typedef struct _Histogram Histogram;
339 typedef struct _HistMap HistMap;
341 typedef struct _SecureSaveInfo SecureSaveInfo;
343 typedef struct _ExifData ExifData;
345 typedef struct _EditorDescription EditorDescription;
347 typedef struct _CommandLine CommandLine;
350 gint histogram_channel; /**< drawing mode for histogram */
351 gint histogram_mode; /**< logarithmical or not */
352 guint vgrid; /**< number of vertical divisions, 0 for none */
353 guint hgrid; /**< number of horizontal divisions, 0 for none */
359 } grid_color; /**< grid color */
367 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
369 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
373 gboolean standard_loader;
376 FileData *fd; /**< fd->pixbuf contains final (scaled) image when done */
378 gboolean cache_enable;
380 gdouble percent_done;
385 ThumbLoaderFunc func_done;
386 ThumbLoaderFunc func_error;
387 ThumbLoaderFunc func_progress;
391 guint idle_done_id; /**< event source id */
394 struct _AnimationData
398 GdkPixbufAnimation *gpa;
399 GdkPixbufAnimationIter *iter;
404 GCancellable *cancellable;
406 GFileInputStream *gfstream;
416 struct _CollectionData
421 SortType sort_method;
423 ThumbLoader *thumb_loader;
424 CollectInfo *thumb_info;
426 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
427 gpointer info_updated_data;
438 gboolean changed; /**< contents changed since save flag */
440 GHashTable *existence;
453 CollectInfo *prev_selection;
455 CollectInfo *click_info;
457 GtkWidget *tip_window;
458 guint tip_delay_id; /**< event source id */
459 CollectInfo *tip_info;
461 GdkWindow *marker_window;
462 CollectInfo *marker_info;
464 GtkWidget *status_label;
465 GtkWidget *extra_label;
469 CollectInfo *focus_info;
472 CollectInfo *drop_info;
475 guint sync_idle_id; /**< event source id */
476 guint drop_idle_id; /**< event source id */
481 GList *editmenu_fd_list; /**< file list for edit menu */
484 struct _CollectWindow
488 GtkWidget *status_box;
490 GtkWidget *close_dialog;
495 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
496 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
497 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
498 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
502 GtkWidget *widget; /**< use this to add it and show it */
508 gboolean unknown; /**< failed to load image */
510 ImageLoader *il; /**< @FIXME image loader should probably go to FileData, but it must first support
511 sending callbacks to multiple ImageWindows in parallel */
513 gint has_frame; /**< not boolean, see image_new() */
515 /* top level (not necessarily parent) window */
516 gboolean top_window_sync; /**< resize top_window when image dimensions change */
517 GtkWidget *top_window; /**< window that gets title, and window to resize when 'fitting' */
518 gchar *title; /**< window title to display left of file name */
519 gchar *title_right; /**< window title to display right of file name */
520 gboolean title_show_zoom; /**< option to include zoom in window title */
523 ImageState state; /**< mask of IMAGE_STATE_* flags about current image */
525 void (*func_update)(ImageWindow *imd, gpointer data);
526 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
527 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
528 ImageTileRequestFunc func_tile_request;
529 ImageTileDisposeFunc func_tile_dispose;
531 gpointer data_update;
532 gpointer data_complete;
536 /* button, scroll functions */
537 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
538 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
539 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
540 void (*func_focus_in)(ImageWindow *, gpointer);
542 gpointer data_button;
544 gpointer data_scroll;
545 gpointer data_focus_in;
548 * @headerfile func_scroll_notify
549 * scroll notification (for scroll bar implementation)
551 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
553 gpointer data_scroll_notify;
555 /* collection info */
556 CollectionData *collection;
557 CollectInfo *collection_info;
560 gboolean color_profile_enable;
561 gint color_profile_input;
562 gboolean color_profile_use_image;
563 gint color_profile_from_image;
566 AlterType delay_alter_type;
568 FileData *read_ahead_fd;
569 ImageLoader *read_ahead_il;
573 gboolean auto_refresh;
578 gboolean overunderexposed;
581 gboolean mouse_wheel_mode;
584 #define FILEDATA_MARKS_SIZE 10
586 struct _FileDataChangeInfo {
587 FileDataChangeType type;
591 gboolean regroup_when_finished;
597 gchar *original_path; /**< key to file_data_pool hash table */
600 const gchar *extension;
601 gchar *extended_extension;
602 FileFormatClass format_class;
603 gchar *format_name; /**< set by the image loader */
604 gchar *collate_key_name;
605 gchar *collate_key_name_nocase;
609 mode_t mode; /**< this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
610 gint sidecar_priority;
612 guint marks; /**< each bit represents one mark */
613 guint valid_marks; /**< zero bit means that the corresponding mark needs to be reread */
616 GList *sidecar_files;
617 FileData *parent; /**< parent file if this is a sidecar file, NULL otherwise */
618 FileDataChangeInfo *change; /**< for rename, move ... */
619 GdkPixbuf *thumb_pixbuf;
621 GdkPixbuf *pixbuf; /**< full-size image, only complete images, NULL during loading
622 all FileData with non-NULL pixbuf are referenced by image_cache */
628 gint version; /**< increased when any field in this structure is changed */
629 gboolean disable_grouping;
631 gint user_orientation;
632 gint exif_orientation;
636 time_t exifdate_digitized;
637 GHashTable *modified_xmp; /**< hash table which contains unwritten xmp metadata in format: key->list of string values */
638 GList *cached_metadata;
640 gboolean metadata_in_idle_loaded;
646 SelectionType selected; /**< Used by view_file_icon. */
652 struct _LayoutOptions
659 DirViewType dir_view_type;
660 FileViewType file_view_type;
665 } dir_view_list_sort;
667 gboolean show_thumbnails;
669 gboolean show_file_filter;
670 gboolean show_directory_date;
671 gboolean show_info_pixel;
672 gboolean split_pane_sync;
673 gboolean ignore_alpha;
704 gint histogram_channel;
721 } preferences_window;
742 } advanced_exif_window;
744 gboolean tools_float;
745 gboolean tools_hidden;
746 gboolean toolbar_hidden;
751 gboolean tools_float;
752 gboolean tools_hidden;
759 StartUpPath startup_path;
764 SortActionType action;
766 SortSelectionType selection;
772 LayoutOptions options;
782 GtkWidget *group_box;
786 /* menus, path selector */
788 GtkActionGroup *action_group;
789 GtkActionGroup *action_group_editors;
791 GtkUIManager *ui_manager;
792 guint toolbar_merge_id[TOOLBAR_COUNT];
793 GList *toolbar_actions[TOOLBAR_COUNT];
795 GtkWidget *path_entry;
799 LayoutLocation image_location;
803 ImageWindow *split_images[MAX_SPLIT_IMAGES];
804 ImageSplitMode split_mode;
805 gint active_split_image;
807 GtkWidget *split_image_widget;
808 GtkSizeGroup *split_image_sizegroup;
810 /* tools window (float) */
813 GtkWidget *tools_pane;
816 // gint tools_hidden;
817 GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
818 GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
821 GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
822 // gint toolbar_hidden;
824 // GtkWidget *thumb_button;
825 // gint thumbs_enabled;
826 // gint marks_enabled;
828 GtkWidget *back_button;
832 LayoutLocation dir_location;
837 // DirViewType dir_view_type;
841 LayoutLocation file_location;
844 // FileViewType file_view_type;
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;
875 GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
876 GtkWidget *utility_paned; /**< between image and bar */
880 gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
885 GtkWidget *exif_window;
886 GtkWidget *sar_window; /**< Search and Run window */
888 AnimationData *animation;
890 GtkWidget *log_window;
907 guint drop_scroll_id; /**< event source id */
910 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
911 gpointer select_data;
913 void (*dnd_drop_update_func)(ViewDir *vd);
914 void (*dnd_drop_leave_func)(ViewDir *vd);
916 LayoutWindow *layout;
923 struct _ViewDirInfoList
928 struct _ViewDirInfoTree
930 guint drop_expand_id; /**< event source id */
937 FileViewType type; /**< @todo (xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h). */
945 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
952 gboolean case_sensitive;
958 SortType sort_method;
959 gboolean sort_ascend;
962 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
963 gpointer data_thumb_status;
965 void (*func_status)(ViewFile *vf, gpointer data);
966 gpointer data_status;
968 LayoutWindow *layout;
973 gboolean thumbs_running;
974 ThumbLoader *thumbs_loader;
975 FileData *thumbs_filedata;
978 gboolean marks_enabled;
983 FileData *stars_filedata;
987 guint refresh_idle_id; /**< event source id */
988 time_t time_refresh_set; /**< time when refresh_idle_id was set */
990 GList *editmenu_fd_list; /**< file list for edit menu */
992 guint read_metadata_in_idle_id;
995 struct _ViewFileInfoList
1000 gboolean thumbs_enabled;
1002 guint select_idle_id; /**< event source id */
1005 struct _ViewFileInfoIcon
1012 FileData *prev_selection;
1014 GtkWidget *tip_window;
1015 guint tip_delay_id; /**< event source id */
1027 struct _SlideShowData
1029 LayoutWindow *lw; /**< use this window to display the slideshow */
1030 ImageWindow *imd; /**< use this window only if lw is not available,
1031 @FIXME it is probably required only by img-view.c and should be dropped with it */
1043 guint timeout_id; /**< event source id */
1045 gboolean from_selection;
1047 void (*stop_func)(SlideShowData *, gpointer);
1053 struct _FullScreenData
1058 GtkWidget *normal_window;
1059 ImageWindow *normal_imd;
1061 guint hide_mouse_id; /**< event source id */
1062 guint busy_mouse_id; /**< event source id */
1066 guint saver_block_id; /**< event source id */
1068 void (*stop_func)(FullScreenData *, gpointer);
1071 gboolean same_region; /**< the returned region will overlap the current location of widget. */
1074 struct _PixmapFolders
1083 struct _SecureSaveInfo {
1084 FILE *fp; /**< file stream pointer */
1085 gchar *file_name; /**< final file name */
1086 gchar *tmp_file_name; /**< temporary file name */
1087 gint err; /**< set to non-zero value in case of error */
1088 gboolean secure_save; /**< use secure save for this file, internal use only */
1089 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1090 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1091 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1098 gboolean startup_blank;
1099 gboolean startup_full_screen;
1100 gboolean startup_in_slideshow;
1101 gboolean startup_command_line_collection;
1102 gboolean tools_hide;
1103 gboolean tools_show;
1104 gboolean log_window_show;
1108 GList *collection_list;
1112 SecureSaveInfo *ssi;
1113 gboolean new_instance;
1117 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */