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
49 #define CMD_COPY "geeqie-copy-command.desktop"
50 #define CMD_MOVE "geeqie-move-command.desktop"
51 #define CMD_RENAME "geeqie-rename-command.desktop"
52 #define CMD_DELETE "geeqie-delete-command.desktop"
53 #define CMD_FOLDER "geeqie-folder-command.desktop"
67 ALTER_NONE, /* do nothing */
69 ALTER_ROTATE_90_CC, /* counterclockwise */
78 LAYOUT_RIGHT = 1 << 1,
80 LAYOUT_BOTTOM = 1 << 3
86 IMAGE_STATE_IMAGE = 1 << 0,
87 IMAGE_STATE_LOADING = 1 << 1,
88 IMAGE_STATE_ERROR = 1 << 2,
89 IMAGE_STATE_COLOR_ADJ = 1 << 3,
90 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
91 IMAGE_STATE_ROTATE_USER = 1 << 5,
92 IMAGE_STATE_DELAY_FLIP = 1 << 6
103 FILEDATA_CHANGE_DELETE,
104 FILEDATA_CHANGE_MOVE,
105 FILEDATA_CHANGE_RENAME,
106 FILEDATA_CHANGE_COPY,
107 FILEDATA_CHANGE_UNSPECIFIED,
108 FILEDATA_CHANGE_WRITE_METADATA
109 } FileDataChangeType;
116 } MarkToSelectionMode;
122 } SelectionToMarkMode;
125 FORMAT_CLASS_UNKNOWN,
127 FORMAT_CLASS_RAWIMAGE,
134 SS_ERR_DISABLED, /**< secsave is disabled. */
135 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
137 /* see err field in SecureSaveInfo */
148 NOTIFY_PRIORITY_HIGH = 0,
149 NOTIFY_PRIORITY_MEDIUM,
154 NOTIFY_MARKS = 1 << 1, /* changed marks */
155 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
156 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
157 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
158 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
159 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
160 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
161 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
166 CHANGE_WARN_DEST_EXISTS = 1 << 0,
167 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
168 CHANGE_WARN_SAME = 1 << 2,
169 CHANGE_WARN_CHANGED_EXT = 1 << 3,
170 CHANGE_WARN_UNSAVED_META = 1 << 4,
171 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
172 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
173 CHANGE_NO_READ_PERM = 1 << 8,
174 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
175 CHANGE_NO_DEST_DIR = 1 << 10,
176 CHANGE_DUPLICATE_DEST = 1 << 11,
177 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
178 CHANGE_DEST_EXISTS = 1 << 13,
179 CHANGE_NO_SRC = 1 << 14,
180 CHANGE_GENERIC_ERROR = 1 << 16
184 METADATA_PLAIN = 0, /* format that can be edited and written back */
185 METADATA_FORMATTED = 1 /* for display only */
189 STARTUP_PATH_CURRENT = 0,
201 PR_STEREO_NONE = 0, /* do nothing */
202 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
203 PR_STEREO_FIXED = 1 << 1, /* custom position */
204 PR_STEREO_HORIZ = 1 << 2, /* side by side */
205 PR_STEREO_VERT = 1 << 3, /* above below */
206 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
207 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
208 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
209 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
210 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
211 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
212 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
213 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
214 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
215 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
216 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
217 PR_STEREO_ANAGLYPH_GM |
218 PR_STEREO_ANAGLYPH_YB |
219 PR_STEREO_ANAGLYPH_GRAY_RC |
220 PR_STEREO_ANAGLYPH_GRAY_GM |
221 PR_STEREO_ANAGLYPH_GRAY_YB |
222 PR_STEREO_ANAGLYPH_DB_RC |
223 PR_STEREO_ANAGLYPH_DB_GM |
224 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
226 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
227 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
229 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
230 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
232 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
233 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
234 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
235 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
236 PR_STEREO_HALF = 1 << 20
237 } PixbufRendererStereoMode;
240 STEREO_PIXBUF_DEFAULT = 0,
241 STEREO_PIXBUF_SBS = 1,
242 STEREO_PIXBUF_CROSS = 2,
243 STEREO_PIXBUF_NONE = 3
246 #define MAX_SPLIT_IMAGES 4
248 typedef struct _ImageLoader ImageLoader;
249 typedef struct _ThumbLoader ThumbLoader;
251 typedef struct _AnimationData AnimationData;
253 typedef struct _CollectInfo CollectInfo;
254 typedef struct _CollectionData CollectionData;
255 typedef struct _CollectTable CollectTable;
256 typedef struct _CollectWindow CollectWindow;
258 typedef struct _ImageWindow ImageWindow;
260 typedef struct _FileData FileData;
261 typedef struct _FileDataChangeInfo FileDataChangeInfo;
263 typedef struct _LayoutWindow LayoutWindow;
264 typedef struct _LayoutOptions LayoutOptions;
266 typedef struct _ViewDir ViewDir;
267 typedef struct _ViewDirInfoList ViewDirInfoList;
268 typedef struct _ViewDirInfoTree ViewDirInfoTree;
270 typedef struct _ViewFile ViewFile;
271 typedef struct _ViewFileInfoList ViewFileInfoList;
272 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
274 typedef struct _SlideShowData SlideShowData;
275 typedef struct _FullScreenData FullScreenData;
277 typedef struct _PixmapFolders PixmapFolders;
278 typedef struct _Histogram Histogram;
279 typedef struct _HistMap HistMap;
281 typedef struct _SecureSaveInfo SecureSaveInfo;
283 typedef struct _ExifData ExifData;
285 typedef struct _EditorDescription EditorDescription;
287 typedef struct _CommandLine CommandLine;
290 gint histogram_channel; /* drawing mode for histogram */
291 gint histogram_mode; /* logarithmical or not */
292 guint vgrid; /* number of vertical divisions, 0 for none */
293 guint hgrid; /* number of horizontal divisions, 0 for none */
299 } grid_color; /* grid color */
307 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
309 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
313 gboolean standard_loader;
316 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
318 gboolean cache_enable;
320 gdouble percent_done;
325 ThumbLoaderFunc func_done;
326 ThumbLoaderFunc func_error;
327 ThumbLoaderFunc func_progress;
331 guint idle_done_id; /* event source id */
334 struct _AnimationData
337 GdkPixbufAnimation *gpa;
338 GdkPixbufAnimationIter *iter;
352 struct _CollectionData
357 SortType sort_method;
359 ThumbLoader *thumb_loader;
360 CollectInfo *thumb_info;
362 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
363 gpointer info_updated_data;
374 /* contents changed since save flag */
377 GHashTable *existence;
390 CollectInfo *prev_selection;
392 CollectInfo *click_info;
394 GtkWidget *tip_window;
395 guint tip_delay_id; /* event source id */
396 CollectInfo *tip_info;
398 GdkWindow *marker_window;
399 CollectInfo *marker_info;
401 GtkWidget *status_label;
402 GtkWidget *extra_label;
406 CollectInfo *focus_info;
409 CollectInfo *drop_info;
412 guint sync_idle_id; /* event source id */
413 guint drop_idle_id; /* event source id */
417 /* file list for edit menu */
418 GList *editmenu_fd_list;
421 struct _CollectWindow
425 GtkWidget *status_box;
428 GtkWidget *close_dialog;
433 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
434 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
435 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
436 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
440 GtkWidget *widget; /* use this to add it and show it */
446 gboolean unknown; /* failed to load image */
448 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
449 sending callbacks to multiple ImageWindows in parallel */
451 gint has_frame; /* not boolean, see image_new() */
453 /* top level (not necessarily parent) window */
454 gboolean top_window_sync; /* resize top_window when image dimensions change */
455 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
456 gchar *title; /* window title to display left of file name */
457 gchar *title_right; /* window title to display right of file name */
458 gboolean title_show_zoom; /* option to include zoom in window title */
461 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
463 void (*func_update)(ImageWindow *imd, gpointer data);
464 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
465 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
466 ImageTileRequestFunc func_tile_request;
467 ImageTileDisposeFunc func_tile_dispose;
469 gpointer data_update;
470 gpointer data_complete;
474 /* button, scroll functions */
475 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
476 void (*func_drag)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer);
477 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
478 void (*func_focus_in)(ImageWindow *, gpointer);
480 gpointer data_button;
482 gpointer data_scroll;
483 gpointer data_focus_in;
485 /* scroll notification (for scroll bar implementation) */
486 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
488 gpointer data_scroll_notify;
490 /* collection info */
491 CollectionData *collection;
492 CollectInfo *collection_info;
495 gboolean color_profile_enable;
496 gint color_profile_input;
497 gboolean color_profile_use_image;
498 gint color_profile_from_image;
501 AlterType delay_alter_type;
503 FileData *read_ahead_fd;
504 ImageLoader *read_ahead_il;
508 gboolean auto_refresh;
516 #define FILEDATA_MARKS_SIZE 6
518 struct _FileDataChangeInfo {
519 FileDataChangeType type;
523 gboolean regroup_when_finished;
529 gchar *original_path; /* key to file_data_pool hash table */
532 const gchar *extension;
533 gchar *collate_key_name;
534 gchar *collate_key_name_nocase;
538 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
539 gint sidecar_priority;
541 guint marks; /* each bit represents one mark */
542 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
545 GList *sidecar_files;
546 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
547 FileDataChangeInfo *change; /* for rename, move ... */
548 GdkPixbuf *thumb_pixbuf;
550 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
551 all FileData with non-NULL pixbuf are referenced by image_cache */
557 gint version; /* increased when any field in this structure is changed */
558 gboolean disable_grouping;
560 gint user_orientation;
561 gint exif_orientation;
565 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
566 GList *cached_metadata;
569 struct _LayoutOptions
576 DirViewType dir_view_type;
577 FileViewType file_view_type;
579 gboolean show_thumbnails;
581 gboolean show_directory_date;
582 gboolean show_info_pixel;
609 gint histogram_channel;
613 gboolean tools_float;
614 gboolean tools_hidden;
615 gboolean toolbar_hidden;
620 StartUpPath startup_path;
622 gboolean exit_on_close;
629 LayoutOptions options;
639 GtkWidget *group_box;
643 /* menus, path selector */
645 GtkActionGroup *action_group;
646 GtkActionGroup *action_group_editors;
648 GtkUIManager *ui_manager;
649 GList *toolbar_actions[TOOLBAR_COUNT];
651 GtkWidget *path_entry;
655 LayoutLocation image_location;
659 ImageWindow *split_images[MAX_SPLIT_IMAGES];
660 ImageSplitMode split_mode;
661 gint active_split_image;
663 GtkWidget *split_image_widget;
664 GtkSizeGroup *split_image_sizegroup;
666 /* tools window (float) */
669 GtkWidget *tools_pane;
672 // gint tools_hidden;
674 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
677 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
678 // gint toolbar_hidden;
680 // GtkWidget *thumb_button;
681 // gint thumbs_enabled;
682 // gint marks_enabled;
684 GtkWidget *back_button;
688 LayoutLocation dir_location;
693 // DirViewType dir_view_type;
697 LayoutLocation file_location;
700 // FileViewType file_view_type;
702 GtkWidget *file_view;
704 SortType sort_method;
705 gboolean sort_ascend;
710 GtkWidget *info_progress_bar;
711 GtkWidget *info_sort;
712 GtkWidget *info_status;
713 GtkWidget *info_details;
714 GtkWidget *info_zoom;
715 GtkWidget *info_pixel;
719 SlideShowData *slideshow;
723 FullScreenData *full_screen;
733 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
734 GtkWidget *utility_paned; /* between image and bar */
738 // gint bar_sort_enabled;
743 GtkWidget *exif_window;
745 AnimationData *animation;
762 guint drop_scroll_id; /* event source id */
765 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
766 gpointer select_data;
768 void (*dnd_drop_update_func)(ViewDir *vd);
769 void (*dnd_drop_leave_func)(ViewDir *vd);
771 LayoutWindow *layout;
778 struct _ViewDirInfoList
783 struct _ViewDirInfoTree
785 guint drop_expand_id; /* event source id */
799 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
804 SortType sort_method;
805 gboolean sort_ascend;
808 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
809 gpointer data_thumb_status;
811 void (*func_status)(ViewFile *vf, gpointer data);
812 gpointer data_status;
814 LayoutWindow *layout;
819 gboolean thumbs_running;
820 ThumbLoader *thumbs_loader;
821 FileData *thumbs_filedata;
824 gboolean marks_enabled;
829 guint refresh_idle_id; /* event source id */
830 time_t time_refresh_set; /* time when refresh_idle_id was set */
832 /* file list for edit menu */
833 GList *editmenu_fd_list;
836 struct _ViewFileInfoList
841 gboolean thumbs_enabled;
843 guint select_idle_id; /* event source id */
848 SELECTION_SELECTED = 1 << 0,
849 SELECTION_PRELIGHT = 1 << 1,
850 SELECTION_FOCUS = 1 << 2
853 typedef struct _IconData IconData;
856 SelectionType selected;
860 struct _ViewFileInfoIcon
867 struct _IconData *prev_selection;
869 GtkWidget *tip_window;
870 guint tip_delay_id; /* event source id */
871 struct _IconData *tip_id;
873 struct _IconData *click_id;
875 struct _IconData *focus_id;
882 struct _SlideShowData
884 LayoutWindow *lw; /* use this window to display the slideshow */
885 ImageWindow *imd; /* use this window only if lw is not available,
886 FIXME: it is probably required only by img-view.c and should be dropped with it */
898 guint timeout_id; /* event source id */
900 gboolean from_selection;
902 void (*stop_func)(SlideShowData *, gpointer);
908 struct _FullScreenData
913 GtkWidget *normal_window;
914 ImageWindow *normal_imd;
916 guint hide_mouse_id; /* event source id */
917 guint busy_mouse_id; /* event source id */
921 guint saver_block_id; /* event source id */
923 void (*stop_func)(FullScreenData *, gpointer);
926 gboolean same_region; /* the returned region will overlap the current location of widget. */
929 struct _PixmapFolders
937 struct _SecureSaveInfo {
938 FILE *fp; /**< file stream pointer */
939 gchar *file_name; /**< final file name */
940 gchar *tmp_file_name; /**< temporary file name */
941 gint err; /**< set to non-zero value in case of error */
942 gboolean secure_save; /**< use secure save for this file, internal use only */
943 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
944 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
945 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
952 gboolean startup_blank;
953 gboolean startup_full_screen;
954 gboolean startup_in_slideshow;
955 gboolean startup_command_line_collection;
961 GList *collection_list;
966 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */