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;
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 *extended_extension;
540 gchar *collate_key_name;
541 gchar *collate_key_name_nocase;
545 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
546 gint sidecar_priority;
548 guint marks; /* each bit represents one mark */
549 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
552 GList *sidecar_files;
553 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
554 FileDataChangeInfo *change; /* for rename, move ... */
555 GdkPixbuf *thumb_pixbuf;
557 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
558 all FileData with non-NULL pixbuf are referenced by image_cache */
564 gint version; /* increased when any field in this structure is changed */
565 gboolean disable_grouping;
567 gint user_orientation;
568 gint exif_orientation;
572 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
573 GList *cached_metadata;
576 struct _LayoutOptions
583 DirViewType dir_view_type;
584 FileViewType file_view_type;
586 gboolean show_thumbnails;
588 gboolean show_directory_date;
589 gboolean show_info_pixel;
620 gint histogram_channel;
624 gboolean tools_float;
625 gboolean tools_hidden;
626 gboolean toolbar_hidden;
631 StartUpPath startup_path;
633 gboolean exit_on_close;
640 LayoutOptions options;
650 GtkWidget *group_box;
654 /* menus, path selector */
656 GtkActionGroup *action_group;
657 GtkActionGroup *action_group_editors;
659 GtkUIManager *ui_manager;
660 GList *toolbar_actions[TOOLBAR_COUNT];
662 GtkWidget *path_entry;
666 LayoutLocation image_location;
670 ImageWindow *split_images[MAX_SPLIT_IMAGES];
671 ImageSplitMode split_mode;
672 gint active_split_image;
674 GtkWidget *split_image_widget;
675 GtkSizeGroup *split_image_sizegroup;
677 /* tools window (float) */
680 GtkWidget *tools_pane;
683 // gint tools_hidden;
685 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
688 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
689 // gint toolbar_hidden;
691 // GtkWidget *thumb_button;
692 // gint thumbs_enabled;
693 // gint marks_enabled;
695 GtkWidget *back_button;
699 LayoutLocation dir_location;
704 // DirViewType dir_view_type;
708 LayoutLocation file_location;
711 // FileViewType file_view_type;
713 GtkWidget *file_view;
715 SortType sort_method;
716 gboolean sort_ascend;
721 GtkWidget *info_progress_bar;
722 GtkWidget *info_sort;
723 GtkWidget *info_status;
724 GtkWidget *info_details;
725 GtkWidget *info_zoom;
726 GtkWidget *info_pixel;
730 SlideShowData *slideshow;
734 FullScreenData *full_screen;
744 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
745 GtkWidget *utility_paned; /* between image and bar */
749 // gint bar_sort_enabled;
754 GtkWidget *exif_window;
756 AnimationData *animation;
773 guint drop_scroll_id; /* event source id */
776 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
777 gpointer select_data;
779 void (*dnd_drop_update_func)(ViewDir *vd);
780 void (*dnd_drop_leave_func)(ViewDir *vd);
782 LayoutWindow *layout;
789 struct _ViewDirInfoList
794 struct _ViewDirInfoTree
796 guint drop_expand_id; /* event source id */
810 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
815 SortType sort_method;
816 gboolean sort_ascend;
819 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
820 gpointer data_thumb_status;
822 void (*func_status)(ViewFile *vf, gpointer data);
823 gpointer data_status;
825 LayoutWindow *layout;
830 gboolean thumbs_running;
831 ThumbLoader *thumbs_loader;
832 FileData *thumbs_filedata;
835 gboolean marks_enabled;
840 guint refresh_idle_id; /* event source id */
841 time_t time_refresh_set; /* time when refresh_idle_id was set */
843 /* file list for edit menu */
844 GList *editmenu_fd_list;
847 struct _ViewFileInfoList
852 gboolean thumbs_enabled;
854 guint select_idle_id; /* event source id */
859 SELECTION_SELECTED = 1 << 0,
860 SELECTION_PRELIGHT = 1 << 1,
861 SELECTION_FOCUS = 1 << 2
864 typedef struct _IconData IconData;
867 SelectionType selected;
871 struct _ViewFileInfoIcon
878 struct _IconData *prev_selection;
880 GtkWidget *tip_window;
881 guint tip_delay_id; /* event source id */
882 struct _IconData *tip_id;
884 struct _IconData *click_id;
886 struct _IconData *focus_id;
893 struct _SlideShowData
895 LayoutWindow *lw; /* use this window to display the slideshow */
896 ImageWindow *imd; /* use this window only if lw is not available,
897 FIXME: it is probably required only by img-view.c and should be dropped with it */
909 guint timeout_id; /* event source id */
911 gboolean from_selection;
913 void (*stop_func)(SlideShowData *, gpointer);
919 struct _FullScreenData
924 GtkWidget *normal_window;
925 ImageWindow *normal_imd;
927 guint hide_mouse_id; /* event source id */
928 guint busy_mouse_id; /* event source id */
932 guint saver_block_id; /* event source id */
934 void (*stop_func)(FullScreenData *, gpointer);
937 gboolean same_region; /* the returned region will overlap the current location of widget. */
940 struct _PixmapFolders
948 struct _SecureSaveInfo {
949 FILE *fp; /**< file stream pointer */
950 gchar *file_name; /**< final file name */
951 gchar *tmp_file_name; /**< temporary file name */
952 gint err; /**< set to non-zero value in case of error */
953 gboolean secure_save; /**< use secure save for this file, internal use only */
954 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
955 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
956 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
963 gboolean startup_blank;
964 gboolean startup_full_screen;
965 gboolean startup_in_slideshow;
966 gboolean startup_command_line_collection;
972 GList *collection_list;
977 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */