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 *, GdkEventButton *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;
522 #define FILEDATA_MARKS_SIZE 6
524 struct _FileDataChangeInfo {
525 FileDataChangeType type;
529 gboolean regroup_when_finished;
535 gchar *original_path; /* key to file_data_pool hash table */
538 const gchar *extension;
539 gchar *collate_key_name;
540 gchar *collate_key_name_nocase;
544 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
545 gint sidecar_priority;
547 guint marks; /* each bit represents one mark */
548 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
551 GList *sidecar_files;
552 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
553 FileDataChangeInfo *change; /* for rename, move ... */
554 GdkPixbuf *thumb_pixbuf;
556 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
557 all FileData with non-NULL pixbuf are referenced by image_cache */
563 gint version; /* increased when any field in this structure is changed */
564 gboolean disable_grouping;
566 gint user_orientation;
567 gint exif_orientation;
571 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
572 GList *cached_metadata;
575 struct _LayoutOptions
582 DirViewType dir_view_type;
583 FileViewType file_view_type;
585 gboolean show_thumbnails;
587 gboolean show_directory_date;
588 gboolean show_info_pixel;
615 gint histogram_channel;
619 gboolean tools_float;
620 gboolean tools_hidden;
621 gboolean toolbar_hidden;
626 StartUpPath startup_path;
628 gboolean exit_on_close;
635 LayoutOptions options;
645 GtkWidget *group_box;
649 /* menus, path selector */
651 GtkActionGroup *action_group;
652 GtkActionGroup *action_group_editors;
654 GtkUIManager *ui_manager;
655 GList *toolbar_actions[TOOLBAR_COUNT];
657 GtkWidget *path_entry;
661 LayoutLocation image_location;
665 ImageWindow *split_images[MAX_SPLIT_IMAGES];
666 ImageSplitMode split_mode;
667 gint active_split_image;
669 GtkWidget *split_image_widget;
670 GtkSizeGroup *split_image_sizegroup;
672 /* tools window (float) */
675 GtkWidget *tools_pane;
678 // gint tools_hidden;
680 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
683 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
684 // gint toolbar_hidden;
686 // GtkWidget *thumb_button;
687 // gint thumbs_enabled;
688 // gint marks_enabled;
690 GtkWidget *back_button;
694 LayoutLocation dir_location;
699 // DirViewType dir_view_type;
703 LayoutLocation file_location;
706 // FileViewType file_view_type;
708 GtkWidget *file_view;
710 SortType sort_method;
711 gboolean sort_ascend;
716 GtkWidget *info_progress_bar;
717 GtkWidget *info_sort;
718 GtkWidget *info_status;
719 GtkWidget *info_details;
720 GtkWidget *info_zoom;
721 GtkWidget *info_pixel;
725 SlideShowData *slideshow;
729 FullScreenData *full_screen;
739 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
740 GtkWidget *utility_paned; /* between image and bar */
744 // gint bar_sort_enabled;
749 GtkWidget *exif_window;
751 AnimationData *animation;
768 guint drop_scroll_id; /* event source id */
771 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
772 gpointer select_data;
774 void (*dnd_drop_update_func)(ViewDir *vd);
775 void (*dnd_drop_leave_func)(ViewDir *vd);
777 LayoutWindow *layout;
784 struct _ViewDirInfoList
789 struct _ViewDirInfoTree
791 guint drop_expand_id; /* event source id */
805 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
810 SortType sort_method;
811 gboolean sort_ascend;
814 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
815 gpointer data_thumb_status;
817 void (*func_status)(ViewFile *vf, gpointer data);
818 gpointer data_status;
820 LayoutWindow *layout;
825 gboolean thumbs_running;
826 ThumbLoader *thumbs_loader;
827 FileData *thumbs_filedata;
830 gboolean marks_enabled;
835 guint refresh_idle_id; /* event source id */
836 time_t time_refresh_set; /* time when refresh_idle_id was set */
838 /* file list for edit menu */
839 GList *editmenu_fd_list;
842 struct _ViewFileInfoList
847 gboolean thumbs_enabled;
849 guint select_idle_id; /* event source id */
854 struct _ViewFileInfoIcon
861 struct _IconData *prev_selection;
863 GtkWidget *tip_window;
864 guint tip_delay_id; /* event source id */
865 struct _IconData *tip_id;
867 struct _IconData *click_id;
869 struct _IconData *focus_id;
876 struct _SlideShowData
878 LayoutWindow *lw; /* use this window to display the slideshow */
879 ImageWindow *imd; /* use this window only if lw is not available,
880 FIXME: it is probably required only by img-view.c and should be dropped with it */
892 guint timeout_id; /* event source id */
894 gboolean from_selection;
896 void (*stop_func)(SlideShowData *, gpointer);
902 struct _FullScreenData
907 GtkWidget *normal_window;
908 ImageWindow *normal_imd;
910 guint hide_mouse_id; /* event source id */
911 guint busy_mouse_id; /* event source id */
915 guint saver_block_id; /* event source id */
917 void (*stop_func)(FullScreenData *, gpointer);
920 gboolean same_region; /* the returned region will overlap the current location of widget. */
923 struct _PixmapFolders
931 struct _SecureSaveInfo {
932 FILE *fp; /**< file stream pointer */
933 gchar *file_name; /**< final file name */
934 gchar *tmp_file_name; /**< temporary file name */
935 gint err; /**< set to non-zero value in case of error */
936 gboolean secure_save; /**< use secure save for this file, internal use only */
937 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
938 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
939 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
946 gboolean startup_blank;
947 gboolean startup_full_screen;
948 gboolean startup_in_slideshow;
949 gboolean startup_command_line_collection;
955 GList *collection_list;
960 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */