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 MOUSE_BUTTON_LEFT = 1,
33 MOUSE_BUTTON_MIDDLE = 2,
34 MOUSE_BUTTON_RIGHT = 3,
35 MOUSE_BUTTON_WHEEL_UP = 4,
36 MOUSE_BUTTON_WHEEL_DOWN = 5
43 // Keep this up to date!
44 DIRVIEW_LAST = DIRVIEW_TREE
51 // Keep this up to date!
52 FILEVIEW_LAST = FILEVIEW_ICON
55 #define CMD_COPY "geeqie-copy-command.desktop"
56 #define CMD_MOVE "geeqie-move-command.desktop"
57 #define CMD_RENAME "geeqie-rename-command.desktop"
58 #define CMD_DELETE "geeqie-delete-command.desktop"
59 #define CMD_FOLDER "geeqie-folder-command.desktop"
73 ALTER_NONE, /* do nothing */
75 ALTER_ROTATE_90_CC, /* counterclockwise */
84 LAYOUT_RIGHT = 1 << 1,
86 LAYOUT_BOTTOM = 1 << 3
92 IMAGE_STATE_IMAGE = 1 << 0,
93 IMAGE_STATE_LOADING = 1 << 1,
94 IMAGE_STATE_ERROR = 1 << 2,
95 IMAGE_STATE_COLOR_ADJ = 1 << 3,
96 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
97 IMAGE_STATE_ROTATE_USER = 1 << 5,
98 IMAGE_STATE_DELAY_FLIP = 1 << 6
109 FILEDATA_CHANGE_DELETE,
110 FILEDATA_CHANGE_MOVE,
111 FILEDATA_CHANGE_RENAME,
112 FILEDATA_CHANGE_COPY,
113 FILEDATA_CHANGE_UNSPECIFIED,
114 FILEDATA_CHANGE_WRITE_METADATA
115 } FileDataChangeType;
122 } MarkToSelectionMode;
128 } SelectionToMarkMode;
131 FORMAT_CLASS_UNKNOWN,
133 FORMAT_CLASS_RAWIMAGE,
140 SS_ERR_DISABLED, /**< secsave is disabled. */
141 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
143 /* see err field in SecureSaveInfo */
154 NOTIFY_PRIORITY_HIGH = 0,
155 NOTIFY_PRIORITY_MEDIUM,
160 NOTIFY_MARKS = 1 << 1, /* changed marks */
161 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
162 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
163 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
164 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
165 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
166 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
167 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
172 CHANGE_WARN_DEST_EXISTS = 1 << 0,
173 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
174 CHANGE_WARN_SAME = 1 << 2,
175 CHANGE_WARN_CHANGED_EXT = 1 << 3,
176 CHANGE_WARN_UNSAVED_META = 1 << 4,
177 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
178 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
179 CHANGE_NO_READ_PERM = 1 << 8,
180 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
181 CHANGE_NO_DEST_DIR = 1 << 10,
182 CHANGE_DUPLICATE_DEST = 1 << 11,
183 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
184 CHANGE_DEST_EXISTS = 1 << 13,
185 CHANGE_NO_SRC = 1 << 14,
186 CHANGE_GENERIC_ERROR = 1 << 16
190 METADATA_PLAIN = 0, /* format that can be edited and written back */
191 METADATA_FORMATTED = 1 /* for display only */
195 STARTUP_PATH_CURRENT = 0,
207 PR_STEREO_NONE = 0, /* do nothing */
208 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
209 PR_STEREO_FIXED = 1 << 1, /* custom position */
210 PR_STEREO_HORIZ = 1 << 2, /* side by side */
211 PR_STEREO_VERT = 1 << 3, /* above below */
212 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
213 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
214 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
215 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
216 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
217 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
218 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
219 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
220 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
221 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
222 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
223 PR_STEREO_ANAGLYPH_GM |
224 PR_STEREO_ANAGLYPH_YB |
225 PR_STEREO_ANAGLYPH_GRAY_RC |
226 PR_STEREO_ANAGLYPH_GRAY_GM |
227 PR_STEREO_ANAGLYPH_GRAY_YB |
228 PR_STEREO_ANAGLYPH_DB_RC |
229 PR_STEREO_ANAGLYPH_DB_GM |
230 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
232 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
233 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
235 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
236 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
238 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
239 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
240 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
241 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
242 PR_STEREO_HALF = 1 << 20
243 } PixbufRendererStereoMode;
246 STEREO_PIXBUF_DEFAULT = 0,
247 STEREO_PIXBUF_SBS = 1,
248 STEREO_PIXBUF_CROSS = 2,
249 STEREO_PIXBUF_NONE = 3
252 #define MAX_SPLIT_IMAGES 4
254 typedef struct _ImageLoader ImageLoader;
255 typedef struct _ThumbLoader ThumbLoader;
257 typedef struct _AnimationData AnimationData;
259 typedef struct _CollectInfo CollectInfo;
260 typedef struct _CollectionData CollectionData;
261 typedef struct _CollectTable CollectTable;
262 typedef struct _CollectWindow CollectWindow;
264 typedef struct _ImageWindow ImageWindow;
266 typedef struct _FileData FileData;
267 typedef struct _FileDataChangeInfo FileDataChangeInfo;
269 typedef struct _LayoutWindow LayoutWindow;
270 typedef struct _LayoutOptions LayoutOptions;
272 typedef struct _ViewDir ViewDir;
273 typedef struct _ViewDirInfoList ViewDirInfoList;
274 typedef struct _ViewDirInfoTree ViewDirInfoTree;
276 typedef struct _ViewFile ViewFile;
277 typedef struct _ViewFileInfoList ViewFileInfoList;
278 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
280 typedef struct _SlideShowData SlideShowData;
281 typedef struct _FullScreenData FullScreenData;
283 typedef struct _PixmapFolders PixmapFolders;
284 typedef struct _Histogram Histogram;
285 typedef struct _HistMap HistMap;
287 typedef struct _SecureSaveInfo SecureSaveInfo;
289 typedef struct _ExifData ExifData;
291 typedef struct _EditorDescription EditorDescription;
293 typedef struct _CommandLine CommandLine;
296 gint histogram_channel; /* drawing mode for histogram */
297 gint histogram_mode; /* logarithmical or not */
298 guint vgrid; /* number of vertical divisions, 0 for none */
299 guint hgrid; /* number of horizontal divisions, 0 for none */
305 } grid_color; /* grid color */
313 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
315 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
319 gboolean standard_loader;
322 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
324 gboolean cache_enable;
326 gdouble percent_done;
331 ThumbLoaderFunc func_done;
332 ThumbLoaderFunc func_error;
333 ThumbLoaderFunc func_progress;
337 guint idle_done_id; /* event source id */
340 struct _AnimationData
343 GdkPixbufAnimation *gpa;
344 GdkPixbufAnimationIter *iter;
358 struct _CollectionData
363 SortType sort_method;
365 ThumbLoader *thumb_loader;
366 CollectInfo *thumb_info;
368 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
369 gpointer info_updated_data;
380 /* contents changed since save flag */
383 GHashTable *existence;
396 CollectInfo *prev_selection;
398 CollectInfo *click_info;
400 GtkWidget *tip_window;
401 guint tip_delay_id; /* event source id */
402 CollectInfo *tip_info;
404 GdkWindow *marker_window;
405 CollectInfo *marker_info;
407 GtkWidget *status_label;
408 GtkWidget *extra_label;
412 CollectInfo *focus_info;
415 CollectInfo *drop_info;
418 guint sync_idle_id; /* event source id */
419 guint drop_idle_id; /* event source id */
423 /* file list for edit menu */
424 GList *editmenu_fd_list;
427 struct _CollectWindow
431 GtkWidget *status_box;
434 GtkWidget *close_dialog;
439 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
440 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
441 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
442 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
446 GtkWidget *widget; /* use this to add it and show it */
452 gboolean unknown; /* failed to load image */
454 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
455 sending callbacks to multiple ImageWindows in parallel */
457 gint has_frame; /* not boolean, see image_new() */
459 /* top level (not necessarily parent) window */
460 gboolean top_window_sync; /* resize top_window when image dimensions change */
461 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
462 gchar *title; /* window title to display left of file name */
463 gchar *title_right; /* window title to display right of file name */
464 gboolean title_show_zoom; /* option to include zoom in window title */
467 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
469 void (*func_update)(ImageWindow *imd, gpointer data);
470 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
471 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
472 ImageTileRequestFunc func_tile_request;
473 ImageTileDisposeFunc func_tile_dispose;
475 gpointer data_update;
476 gpointer data_complete;
480 /* button, scroll functions */
481 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
482 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
483 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
484 void (*func_focus_in)(ImageWindow *, gpointer);
486 gpointer data_button;
488 gpointer data_scroll;
489 gpointer data_focus_in;
491 /* scroll notification (for scroll bar implementation) */
492 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
494 gpointer data_scroll_notify;
496 /* collection info */
497 CollectionData *collection;
498 CollectInfo *collection_info;
501 gboolean color_profile_enable;
502 gint color_profile_input;
503 gboolean color_profile_use_image;
504 gint color_profile_from_image;
507 AlterType delay_alter_type;
509 FileData *read_ahead_fd;
510 ImageLoader *read_ahead_il;
514 gboolean auto_refresh;
521 gboolean mouse_wheel_mode;
524 #define FILEDATA_MARKS_SIZE 6
526 struct _FileDataChangeInfo {
527 FileDataChangeType type;
531 gboolean regroup_when_finished;
537 gchar *original_path; /* key to file_data_pool hash table */
540 const gchar *extension;
541 gchar *extended_extension;
542 gchar *collate_key_name;
543 gchar *collate_key_name_nocase;
547 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
548 gint sidecar_priority;
550 guint marks; /* each bit represents one mark */
551 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
554 GList *sidecar_files;
555 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
556 FileDataChangeInfo *change; /* for rename, move ... */
557 GdkPixbuf *thumb_pixbuf;
559 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
560 all FileData with non-NULL pixbuf are referenced by image_cache */
566 gint version; /* increased when any field in this structure is changed */
567 gboolean disable_grouping;
569 gint user_orientation;
570 gint exif_orientation;
574 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
575 GList *cached_metadata;
578 struct _LayoutOptions
585 DirViewType dir_view_type;
586 FileViewType file_view_type;
588 gboolean show_thumbnails;
590 gboolean show_directory_date;
591 gboolean show_info_pixel;
622 gint histogram_channel;
626 gboolean tools_float;
627 gboolean tools_hidden;
628 gboolean toolbar_hidden;
633 StartUpPath startup_path;
635 gboolean exit_on_close;
642 LayoutOptions options;
652 GtkWidget *group_box;
656 /* menus, path selector */
658 GtkActionGroup *action_group;
659 GtkActionGroup *action_group_editors;
661 GtkUIManager *ui_manager;
662 GList *toolbar_actions[TOOLBAR_COUNT];
664 GtkWidget *path_entry;
668 LayoutLocation image_location;
672 ImageWindow *split_images[MAX_SPLIT_IMAGES];
673 ImageSplitMode split_mode;
674 gint active_split_image;
676 GtkWidget *split_image_widget;
677 GtkSizeGroup *split_image_sizegroup;
679 /* tools window (float) */
682 GtkWidget *tools_pane;
685 // gint tools_hidden;
687 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
690 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
691 // gint toolbar_hidden;
693 // GtkWidget *thumb_button;
694 // gint thumbs_enabled;
695 // gint marks_enabled;
697 GtkWidget *back_button;
701 LayoutLocation dir_location;
706 // DirViewType dir_view_type;
710 LayoutLocation file_location;
713 // FileViewType file_view_type;
715 GtkWidget *file_view;
717 SortType sort_method;
718 gboolean sort_ascend;
723 GtkWidget *info_progress_bar;
724 GtkWidget *info_sort;
725 GtkWidget *info_status;
726 GtkWidget *info_details;
727 GtkWidget *info_zoom;
728 GtkWidget *info_pixel;
732 SlideShowData *slideshow;
736 FullScreenData *full_screen;
746 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
747 GtkWidget *utility_paned; /* between image and bar */
751 // gint bar_sort_enabled;
756 GtkWidget *exif_window;
758 AnimationData *animation;
775 guint drop_scroll_id; /* event source id */
778 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
779 gpointer select_data;
781 void (*dnd_drop_update_func)(ViewDir *vd);
782 void (*dnd_drop_leave_func)(ViewDir *vd);
784 LayoutWindow *layout;
791 struct _ViewDirInfoList
796 struct _ViewDirInfoTree
798 guint drop_expand_id; /* event source id */
812 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
817 SortType sort_method;
818 gboolean sort_ascend;
821 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
822 gpointer data_thumb_status;
824 void (*func_status)(ViewFile *vf, gpointer data);
825 gpointer data_status;
827 LayoutWindow *layout;
832 gboolean thumbs_running;
833 ThumbLoader *thumbs_loader;
834 FileData *thumbs_filedata;
837 gboolean marks_enabled;
842 guint refresh_idle_id; /* event source id */
843 time_t time_refresh_set; /* time when refresh_idle_id was set */
845 /* file list for edit menu */
846 GList *editmenu_fd_list;
849 struct _ViewFileInfoList
854 gboolean thumbs_enabled;
856 guint select_idle_id; /* event source id */
861 SELECTION_SELECTED = 1 << 0,
862 SELECTION_PRELIGHT = 1 << 1,
863 SELECTION_FOCUS = 1 << 2
866 typedef struct _IconData IconData;
869 SelectionType selected;
873 struct _ViewFileInfoIcon
880 struct _IconData *prev_selection;
882 GtkWidget *tip_window;
883 guint tip_delay_id; /* event source id */
884 struct _IconData *tip_id;
886 struct _IconData *click_id;
888 struct _IconData *focus_id;
895 struct _SlideShowData
897 LayoutWindow *lw; /* use this window to display the slideshow */
898 ImageWindow *imd; /* use this window only if lw is not available,
899 FIXME: it is probably required only by img-view.c and should be dropped with it */
911 guint timeout_id; /* event source id */
913 gboolean from_selection;
915 void (*stop_func)(SlideShowData *, gpointer);
921 struct _FullScreenData
926 GtkWidget *normal_window;
927 ImageWindow *normal_imd;
929 guint hide_mouse_id; /* event source id */
930 guint busy_mouse_id; /* event source id */
934 guint saver_block_id; /* event source id */
936 void (*stop_func)(FullScreenData *, gpointer);
939 gboolean same_region; /* the returned region will overlap the current location of widget. */
942 struct _PixmapFolders
950 struct _SecureSaveInfo {
951 FILE *fp; /**< file stream pointer */
952 gchar *file_name; /**< final file name */
953 gchar *tmp_file_name; /**< temporary file name */
954 gint err; /**< set to non-zero value in case of error */
955 gboolean secure_save; /**< use secure save for this file, internal use only */
956 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
957 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
958 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
965 gboolean startup_blank;
966 gboolean startup_full_screen;
967 gboolean startup_in_slideshow;
968 gboolean startup_command_line_collection;
974 GList *collection_list;
979 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */