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 MOUSE_BUTTON_LEFT = 1,
38 MOUSE_BUTTON_MIDDLE = 2,
39 MOUSE_BUTTON_RIGHT = 3,
40 MOUSE_BUTTON_WHEEL_UP = 4,
41 MOUSE_BUTTON_WHEEL_DOWN = 5,
50 // Keep this up to date!
51 DIRVIEW_LAST = DIRVIEW_TREE
58 // Keep this up to date!
59 FILEVIEW_LAST = FILEVIEW_ICON
62 #define CMD_COPY "geeqie-copy-command.desktop"
63 #define CMD_MOVE "geeqie-move-command.desktop"
64 #define CMD_RENAME "geeqie-rename-command.desktop"
65 #define CMD_DELETE "geeqie-delete-command.desktop"
66 #define CMD_FOLDER "geeqie-folder-command.desktop"
77 SORT_EXIFTIMEDIGITIZED,
83 ALTER_NONE, /* do nothing */
85 ALTER_ROTATE_90_CC, /* counterclockwise */
94 LAYOUT_RIGHT = 1 << 1,
96 LAYOUT_BOTTOM = 1 << 3
101 IMAGE_STATE_NONE = 0,
102 IMAGE_STATE_IMAGE = 1 << 0,
103 IMAGE_STATE_LOADING = 1 << 1,
104 IMAGE_STATE_ERROR = 1 << 2,
105 IMAGE_STATE_COLOR_ADJ = 1 << 3,
106 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
107 IMAGE_STATE_ROTATE_USER = 1 << 5,
108 IMAGE_STATE_DELAY_FLIP = 1 << 6
119 FILEDATA_CHANGE_DELETE,
120 FILEDATA_CHANGE_MOVE,
121 FILEDATA_CHANGE_RENAME,
122 FILEDATA_CHANGE_COPY,
123 FILEDATA_CHANGE_UNSPECIFIED,
124 FILEDATA_CHANGE_WRITE_METADATA
125 } FileDataChangeType;
132 } MarkToSelectionMode;
138 } SelectionToMarkMode;
141 FORMAT_CLASS_UNKNOWN,
143 FORMAT_CLASS_RAWIMAGE,
146 FORMAT_CLASS_COLLECTION,
147 FORMAT_CLASS_DOCUMENT,
151 /* defined in preferences.c */
152 extern gchar *format_class_list[];
156 SS_ERR_DISABLED, /**< secsave is disabled. */
157 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
159 /* see err field in SecureSaveInfo */
170 NOTIFY_PRIORITY_HIGH = 0,
171 NOTIFY_PRIORITY_MEDIUM,
176 NOTIFY_MARKS = 1 << 1, /* changed marks */
177 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
178 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
179 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
180 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
181 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
182 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
183 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
188 CHANGE_WARN_DEST_EXISTS = 1 << 0,
189 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
190 CHANGE_WARN_SAME = 1 << 2,
191 CHANGE_WARN_CHANGED_EXT = 1 << 3,
192 CHANGE_WARN_UNSAVED_META = 1 << 4,
193 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
194 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
195 CHANGE_NO_READ_PERM = 1 << 8,
196 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
197 CHANGE_NO_DEST_DIR = 1 << 10,
198 CHANGE_DUPLICATE_DEST = 1 << 11,
199 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
200 CHANGE_DEST_EXISTS = 1 << 13,
201 CHANGE_NO_SRC = 1 << 14,
202 CHANGE_GENERIC_ERROR = 1 << 16
206 METADATA_PLAIN = 0, /* format that can be edited and written back */
207 METADATA_FORMATTED = 1 /* for display only */
211 STARTUP_PATH_CURRENT = 0,
223 PR_STEREO_NONE = 0, /* do nothing */
224 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
225 PR_STEREO_FIXED = 1 << 1, /* custom position */
226 PR_STEREO_HORIZ = 1 << 2, /* side by side */
227 PR_STEREO_VERT = 1 << 3, /* above below */
228 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
229 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
230 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
231 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
232 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
233 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
234 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
235 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
236 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
237 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
238 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
239 PR_STEREO_ANAGLYPH_GM |
240 PR_STEREO_ANAGLYPH_YB |
241 PR_STEREO_ANAGLYPH_GRAY_RC |
242 PR_STEREO_ANAGLYPH_GRAY_GM |
243 PR_STEREO_ANAGLYPH_GRAY_YB |
244 PR_STEREO_ANAGLYPH_DB_RC |
245 PR_STEREO_ANAGLYPH_DB_GM |
246 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
248 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
249 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
251 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
252 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
254 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
255 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
256 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
257 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
258 PR_STEREO_HALF = 1 << 20
259 } PixbufRendererStereoMode;
262 STEREO_PIXBUF_DEFAULT = 0,
263 STEREO_PIXBUF_SBS = 1,
264 STEREO_PIXBUF_CROSS = 2,
265 STEREO_PIXBUF_NONE = 3
269 BAR_SORT_MODE_FOLDER = 0,
270 BAR_SORT_MODE_COLLECTION,
278 BAR_SORT_ACTION_COUNT
282 BAR_SORT_SELECTION_IMAGE = 0,
283 BAR_SORT_SELECTION_SELECTED,
284 BAR_SORT_SELECTION_COUNT
287 #define MAX_SPLIT_IMAGES 4
291 SELECTION_SELECTED = 1 << 0,
292 SELECTION_PRELIGHT = 1 << 1,
293 SELECTION_FOCUS = 1 << 2
296 typedef struct _ImageLoader ImageLoader;
297 typedef struct _ThumbLoader ThumbLoader;
299 typedef struct _AnimationData AnimationData;
301 typedef struct _CollectInfo CollectInfo;
302 typedef struct _CollectionData CollectionData;
303 typedef struct _CollectTable CollectTable;
304 typedef struct _CollectWindow CollectWindow;
306 typedef struct _ImageWindow ImageWindow;
308 typedef struct _FileData FileData;
309 typedef struct _FileDataChangeInfo FileDataChangeInfo;
311 typedef struct _LayoutWindow LayoutWindow;
312 typedef struct _LayoutOptions LayoutOptions;
314 typedef struct _ViewDir ViewDir;
315 typedef struct _ViewDirInfoList ViewDirInfoList;
316 typedef struct _ViewDirInfoTree ViewDirInfoTree;
318 typedef struct _ViewFile ViewFile;
319 typedef struct _ViewFileInfoList ViewFileInfoList;
320 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
322 typedef struct _SlideShowData SlideShowData;
323 typedef struct _FullScreenData FullScreenData;
325 typedef struct _PixmapFolders PixmapFolders;
326 typedef struct _Histogram Histogram;
327 typedef struct _HistMap HistMap;
329 typedef struct _SecureSaveInfo SecureSaveInfo;
331 typedef struct _ExifData ExifData;
333 typedef struct _EditorDescription EditorDescription;
335 typedef struct _CommandLine CommandLine;
338 gint histogram_channel; /* drawing mode for histogram */
339 gint histogram_mode; /* logarithmical or not */
340 guint vgrid; /* number of vertical divisions, 0 for none */
341 guint hgrid; /* number of horizontal divisions, 0 for none */
347 } grid_color; /* grid color */
355 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
357 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
361 gboolean standard_loader;
364 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
366 gboolean cache_enable;
368 gdouble percent_done;
373 ThumbLoaderFunc func_done;
374 ThumbLoaderFunc func_error;
375 ThumbLoaderFunc func_progress;
379 guint idle_done_id; /* event source id */
382 struct _AnimationData
386 GdkPixbufAnimation *gpa;
387 GdkPixbufAnimationIter *iter;
392 GCancellable *cancellable;
394 GFileInputStream *gfstream;
404 struct _CollectionData
409 SortType sort_method;
411 ThumbLoader *thumb_loader;
412 CollectInfo *thumb_info;
414 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
415 gpointer info_updated_data;
426 /* contents changed since save flag */
429 GHashTable *existence;
442 CollectInfo *prev_selection;
444 CollectInfo *click_info;
446 GtkWidget *tip_window;
447 guint tip_delay_id; /* event source id */
448 CollectInfo *tip_info;
450 GdkWindow *marker_window;
451 CollectInfo *marker_info;
453 GtkWidget *status_label;
454 GtkWidget *extra_label;
458 CollectInfo *focus_info;
461 CollectInfo *drop_info;
464 guint sync_idle_id; /* event source id */
465 guint drop_idle_id; /* event source id */
470 /* file list for edit menu */
471 GList *editmenu_fd_list;
474 struct _CollectWindow
478 GtkWidget *status_box;
480 GtkWidget *close_dialog;
485 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
486 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
487 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
488 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
492 GtkWidget *widget; /* use this to add it and show it */
498 gboolean unknown; /* failed to load image */
500 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
501 sending callbacks to multiple ImageWindows in parallel */
503 gint has_frame; /* not boolean, see image_new() */
505 /* top level (not necessarily parent) window */
506 gboolean top_window_sync; /* resize top_window when image dimensions change */
507 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
508 gchar *title; /* window title to display left of file name */
509 gchar *title_right; /* window title to display right of file name */
510 gboolean title_show_zoom; /* option to include zoom in window title */
513 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
515 void (*func_update)(ImageWindow *imd, gpointer data);
516 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
517 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
518 ImageTileRequestFunc func_tile_request;
519 ImageTileDisposeFunc func_tile_dispose;
521 gpointer data_update;
522 gpointer data_complete;
526 /* button, scroll functions */
527 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
528 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
529 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
530 void (*func_focus_in)(ImageWindow *, gpointer);
532 gpointer data_button;
534 gpointer data_scroll;
535 gpointer data_focus_in;
537 /* scroll notification (for scroll bar implementation) */
538 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
540 gpointer data_scroll_notify;
542 /* collection info */
543 CollectionData *collection;
544 CollectInfo *collection_info;
547 gboolean color_profile_enable;
548 gint color_profile_input;
549 gboolean color_profile_use_image;
550 gint color_profile_from_image;
553 AlterType delay_alter_type;
555 FileData *read_ahead_fd;
556 ImageLoader *read_ahead_il;
560 gboolean auto_refresh;
565 gboolean overunderexposed;
568 gboolean mouse_wheel_mode;
571 #define FILEDATA_MARKS_SIZE 10
573 struct _FileDataChangeInfo {
574 FileDataChangeType type;
578 gboolean regroup_when_finished;
584 gchar *original_path; /* key to file_data_pool hash table */
587 const gchar *extension;
588 gchar *extended_extension;
589 FileFormatClass format_class;
590 gchar *collate_key_name;
591 gchar *collate_key_name_nocase;
595 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
596 gint sidecar_priority;
598 guint marks; /* each bit represents one mark */
599 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
602 GList *sidecar_files;
603 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
604 FileDataChangeInfo *change; /* for rename, move ... */
605 GdkPixbuf *thumb_pixbuf;
607 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
608 all FileData with non-NULL pixbuf are referenced by image_cache */
614 gint version; /* increased when any field in this structure is changed */
615 gboolean disable_grouping;
617 gint user_orientation;
618 gint exif_orientation;
622 time_t exifdate_digitized;
623 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
624 GList *cached_metadata;
626 gboolean metadata_in_idle_loaded;
632 SelectionType selected; // Used by view_file_icon.
638 struct _LayoutOptions
645 DirViewType dir_view_type;
646 FileViewType file_view_type;
648 gboolean show_thumbnails;
650 gboolean show_file_filter;
651 gboolean show_directory_date;
652 gboolean show_info_pixel;
683 gint histogram_channel;
694 gboolean tools_float;
695 gboolean tools_hidden;
696 gboolean toolbar_hidden;
701 gboolean tools_float;
702 gboolean tools_hidden;
709 StartUpPath startup_path;
711 gboolean exit_on_close;
715 SortActionType action;
717 SortSelectionType selection;
723 LayoutOptions options;
733 GtkWidget *group_box;
737 /* menus, path selector */
739 GtkActionGroup *action_group;
740 GtkActionGroup *action_group_editors;
742 GtkUIManager *ui_manager;
743 guint toolbar_merge_id[TOOLBAR_COUNT];
744 GList *toolbar_actions[TOOLBAR_COUNT];
746 GtkWidget *path_entry;
750 LayoutLocation image_location;
754 ImageWindow *split_images[MAX_SPLIT_IMAGES];
755 ImageSplitMode split_mode;
756 gint active_split_image;
758 GtkWidget *split_image_widget;
759 GtkSizeGroup *split_image_sizegroup;
761 /* tools window (float) */
764 GtkWidget *tools_pane;
767 // gint tools_hidden;
768 GtkWidget *menu_tool_bar; /*Combined menu and toolbar box */
769 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
772 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
773 // gint toolbar_hidden;
775 // GtkWidget *thumb_button;
776 // gint thumbs_enabled;
777 // gint marks_enabled;
779 GtkWidget *back_button;
783 LayoutLocation dir_location;
788 // DirViewType dir_view_type;
792 LayoutLocation file_location;
795 // FileViewType file_view_type;
797 GtkWidget *file_view;
799 SortType sort_method;
800 gboolean sort_ascend;
805 GtkWidget *info_progress_bar;
806 GtkWidget *info_sort;
807 GtkWidget *info_status;
808 GtkWidget *info_details;
809 GtkWidget *info_zoom;
810 GtkWidget *info_pixel;
814 SlideShowData *slideshow;
818 FullScreenData *full_screen;
828 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
829 GtkWidget *utility_paned; /* between image and bar */
833 gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
838 GtkWidget *exif_window;
839 GtkWidget *sar_window; /* Search and Run window */
841 AnimationData *animation;
843 GtkWidget *log_window;
860 guint drop_scroll_id; /* event source id */
863 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
864 gpointer select_data;
866 void (*dnd_drop_update_func)(ViewDir *vd);
867 void (*dnd_drop_leave_func)(ViewDir *vd);
869 LayoutWindow *layout;
876 struct _ViewDirInfoList
881 struct _ViewDirInfoTree
883 guint drop_expand_id; /* event source id */
891 // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
898 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
905 gboolean case_sensitive;
911 SortType sort_method;
912 gboolean sort_ascend;
915 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
916 gpointer data_thumb_status;
918 void (*func_status)(ViewFile *vf, gpointer data);
919 gpointer data_status;
921 LayoutWindow *layout;
926 gboolean thumbs_running;
927 ThumbLoader *thumbs_loader;
928 FileData *thumbs_filedata;
931 gboolean marks_enabled;
936 guint refresh_idle_id; /* event source id */
937 time_t time_refresh_set; /* time when refresh_idle_id was set */
939 /* file list for edit menu */
940 GList *editmenu_fd_list;
942 guint read_metadata_in_idle_id;
945 struct _ViewFileInfoList
950 gboolean thumbs_enabled;
952 guint select_idle_id; /* event source id */
955 struct _ViewFileInfoIcon
962 FileData *prev_selection;
964 GtkWidget *tip_window;
965 guint tip_delay_id; /* event source id */
977 struct _SlideShowData
979 LayoutWindow *lw; /* use this window to display the slideshow */
980 ImageWindow *imd; /* use this window only if lw is not available,
981 FIXME: it is probably required only by img-view.c and should be dropped with it */
993 guint timeout_id; /* event source id */
995 gboolean from_selection;
997 void (*stop_func)(SlideShowData *, gpointer);
1003 struct _FullScreenData
1008 GtkWidget *normal_window;
1009 ImageWindow *normal_imd;
1011 guint hide_mouse_id; /* event source id */
1012 guint busy_mouse_id; /* event source id */
1016 guint saver_block_id; /* event source id */
1018 void (*stop_func)(FullScreenData *, gpointer);
1021 gboolean same_region; /* the returned region will overlap the current location of widget. */
1024 struct _PixmapFolders
1033 struct _SecureSaveInfo {
1034 FILE *fp; /**< file stream pointer */
1035 gchar *file_name; /**< final file name */
1036 gchar *tmp_file_name; /**< temporary file name */
1037 gint err; /**< set to non-zero value in case of error */
1038 gboolean secure_save; /**< use secure save for this file, internal use only */
1039 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1040 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1041 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1048 gboolean startup_blank;
1049 gboolean startup_full_screen;
1050 gboolean startup_in_slideshow;
1051 gboolean startup_command_line_collection;
1052 gboolean tools_hide;
1053 gboolean tools_show;
1054 gboolean log_window_show;
1058 GList *collection_list;
1062 SecureSaveInfo *ssi;
1066 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */