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,
82 /* drag and drop default action */
90 ALTER_NONE, /* do nothing */
92 ALTER_ROTATE_90_CC, /* counterclockwise */
100 LAYOUT_LEFT = 1 << 0,
101 LAYOUT_RIGHT = 1 << 1,
103 LAYOUT_BOTTOM = 1 << 3
108 IMAGE_STATE_NONE = 0,
109 IMAGE_STATE_IMAGE = 1 << 0,
110 IMAGE_STATE_LOADING = 1 << 1,
111 IMAGE_STATE_ERROR = 1 << 2,
112 IMAGE_STATE_COLOR_ADJ = 1 << 3,
113 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
114 IMAGE_STATE_ROTATE_USER = 1 << 5,
115 IMAGE_STATE_DELAY_FLIP = 1 << 6
126 FILEDATA_CHANGE_DELETE,
127 FILEDATA_CHANGE_MOVE,
128 FILEDATA_CHANGE_RENAME,
129 FILEDATA_CHANGE_COPY,
130 FILEDATA_CHANGE_UNSPECIFIED,
131 FILEDATA_CHANGE_WRITE_METADATA
132 } FileDataChangeType;
139 } MarkToSelectionMode;
145 } SelectionToMarkMode;
148 FORMAT_CLASS_UNKNOWN,
150 FORMAT_CLASS_RAWIMAGE,
153 FORMAT_CLASS_COLLECTION,
154 FORMAT_CLASS_DOCUMENT,
158 /* defined in preferences.c */
159 extern gchar *format_class_list[];
163 SS_ERR_DISABLED, /**< secsave is disabled. */
164 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
166 /* see err field in SecureSaveInfo */
177 NOTIFY_PRIORITY_HIGH = 0,
178 NOTIFY_PRIORITY_MEDIUM,
183 NOTIFY_MARKS = 1 << 1, /* changed marks */
184 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
185 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
186 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
187 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
188 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
189 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
190 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
195 CHANGE_WARN_DEST_EXISTS = 1 << 0,
196 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
197 CHANGE_WARN_SAME = 1 << 2,
198 CHANGE_WARN_CHANGED_EXT = 1 << 3,
199 CHANGE_WARN_UNSAVED_META = 1 << 4,
200 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
201 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
202 CHANGE_NO_READ_PERM = 1 << 8,
203 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
204 CHANGE_NO_DEST_DIR = 1 << 10,
205 CHANGE_DUPLICATE_DEST = 1 << 11,
206 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
207 CHANGE_DEST_EXISTS = 1 << 13,
208 CHANGE_NO_SRC = 1 << 14,
209 CHANGE_GENERIC_ERROR = 1 << 16
213 METADATA_PLAIN = 0, /* format that can be edited and written back */
214 METADATA_FORMATTED = 1 /* for display only */
218 STARTUP_PATH_CURRENT = 0,
230 PR_STEREO_NONE = 0, /* do nothing */
231 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
232 PR_STEREO_FIXED = 1 << 1, /* custom position */
233 PR_STEREO_HORIZ = 1 << 2, /* side by side */
234 PR_STEREO_VERT = 1 << 3, /* above below */
235 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
236 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
237 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
238 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
239 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
240 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
241 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
242 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
243 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
244 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
245 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
246 PR_STEREO_ANAGLYPH_GM |
247 PR_STEREO_ANAGLYPH_YB |
248 PR_STEREO_ANAGLYPH_GRAY_RC |
249 PR_STEREO_ANAGLYPH_GRAY_GM |
250 PR_STEREO_ANAGLYPH_GRAY_YB |
251 PR_STEREO_ANAGLYPH_DB_RC |
252 PR_STEREO_ANAGLYPH_DB_GM |
253 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
255 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
256 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
258 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
259 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
261 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
262 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
263 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
264 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
265 PR_STEREO_HALF = 1 << 20
266 } PixbufRendererStereoMode;
269 STEREO_PIXBUF_DEFAULT = 0,
270 STEREO_PIXBUF_SBS = 1,
271 STEREO_PIXBUF_CROSS = 2,
272 STEREO_PIXBUF_NONE = 3
276 BAR_SORT_MODE_FOLDER = 0,
277 BAR_SORT_MODE_COLLECTION,
285 BAR_SORT_ACTION_COUNT
289 BAR_SORT_SELECTION_IMAGE = 0,
290 BAR_SORT_SELECTION_SELECTED,
291 BAR_SORT_SELECTION_COUNT
294 #define MAX_SPLIT_IMAGES 4
298 SELECTION_SELECTED = 1 << 0,
299 SELECTION_PRELIGHT = 1 << 1,
300 SELECTION_FOCUS = 1 << 2
303 typedef struct _ImageLoader ImageLoader;
304 typedef struct _ThumbLoader ThumbLoader;
306 typedef struct _AnimationData AnimationData;
308 typedef struct _CollectInfo CollectInfo;
309 typedef struct _CollectionData CollectionData;
310 typedef struct _CollectTable CollectTable;
311 typedef struct _CollectWindow CollectWindow;
313 typedef struct _ImageWindow ImageWindow;
315 typedef struct _FileData FileData;
316 typedef struct _FileDataChangeInfo FileDataChangeInfo;
318 typedef struct _LayoutWindow LayoutWindow;
319 typedef struct _LayoutOptions LayoutOptions;
321 typedef struct _ViewDir ViewDir;
322 typedef struct _ViewDirInfoList ViewDirInfoList;
323 typedef struct _ViewDirInfoTree ViewDirInfoTree;
325 typedef struct _ViewFile ViewFile;
326 typedef struct _ViewFileInfoList ViewFileInfoList;
327 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
329 typedef struct _SlideShowData SlideShowData;
330 typedef struct _FullScreenData FullScreenData;
332 typedef struct _PixmapFolders PixmapFolders;
333 typedef struct _Histogram Histogram;
334 typedef struct _HistMap HistMap;
336 typedef struct _SecureSaveInfo SecureSaveInfo;
338 typedef struct _ExifData ExifData;
340 typedef struct _EditorDescription EditorDescription;
342 typedef struct _CommandLine CommandLine;
345 gint histogram_channel; /* drawing mode for histogram */
346 gint histogram_mode; /* logarithmical or not */
347 guint vgrid; /* number of vertical divisions, 0 for none */
348 guint hgrid; /* number of horizontal divisions, 0 for none */
354 } grid_color; /* grid color */
362 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
364 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
368 gboolean standard_loader;
371 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
373 gboolean cache_enable;
375 gdouble percent_done;
380 ThumbLoaderFunc func_done;
381 ThumbLoaderFunc func_error;
382 ThumbLoaderFunc func_progress;
386 guint idle_done_id; /* event source id */
389 struct _AnimationData
393 GdkPixbufAnimation *gpa;
394 GdkPixbufAnimationIter *iter;
399 GCancellable *cancellable;
401 GFileInputStream *gfstream;
411 struct _CollectionData
416 SortType sort_method;
418 ThumbLoader *thumb_loader;
419 CollectInfo *thumb_info;
421 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
422 gpointer info_updated_data;
433 /* contents changed since save flag */
436 GHashTable *existence;
449 CollectInfo *prev_selection;
451 CollectInfo *click_info;
453 GtkWidget *tip_window;
454 guint tip_delay_id; /* event source id */
455 CollectInfo *tip_info;
457 GdkWindow *marker_window;
458 CollectInfo *marker_info;
460 GtkWidget *status_label;
461 GtkWidget *extra_label;
465 CollectInfo *focus_info;
468 CollectInfo *drop_info;
471 guint sync_idle_id; /* event source id */
472 guint drop_idle_id; /* event source id */
477 /* file list for edit menu */
478 GList *editmenu_fd_list;
481 struct _CollectWindow
485 GtkWidget *status_box;
487 GtkWidget *close_dialog;
492 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
493 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
494 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
495 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
499 GtkWidget *widget; /* use this to add it and show it */
505 gboolean unknown; /* failed to load image */
507 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
508 sending callbacks to multiple ImageWindows in parallel */
510 gint has_frame; /* not boolean, see image_new() */
512 /* top level (not necessarily parent) window */
513 gboolean top_window_sync; /* resize top_window when image dimensions change */
514 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
515 gchar *title; /* window title to display left of file name */
516 gchar *title_right; /* window title to display right of file name */
517 gboolean title_show_zoom; /* option to include zoom in window title */
520 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
522 void (*func_update)(ImageWindow *imd, gpointer data);
523 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
524 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
525 ImageTileRequestFunc func_tile_request;
526 ImageTileDisposeFunc func_tile_dispose;
528 gpointer data_update;
529 gpointer data_complete;
533 /* button, scroll functions */
534 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
535 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
536 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
537 void (*func_focus_in)(ImageWindow *, gpointer);
539 gpointer data_button;
541 gpointer data_scroll;
542 gpointer data_focus_in;
544 /* scroll notification (for scroll bar implementation) */
545 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
547 gpointer data_scroll_notify;
549 /* collection info */
550 CollectionData *collection;
551 CollectInfo *collection_info;
554 gboolean color_profile_enable;
555 gint color_profile_input;
556 gboolean color_profile_use_image;
557 gint color_profile_from_image;
560 AlterType delay_alter_type;
562 FileData *read_ahead_fd;
563 ImageLoader *read_ahead_il;
567 gboolean auto_refresh;
572 gboolean overunderexposed;
575 gboolean mouse_wheel_mode;
578 #define FILEDATA_MARKS_SIZE 10
580 struct _FileDataChangeInfo {
581 FileDataChangeType type;
585 gboolean regroup_when_finished;
591 gchar *original_path; /* key to file_data_pool hash table */
594 const gchar *extension;
595 gchar *extended_extension;
596 FileFormatClass format_class;
597 gchar *collate_key_name;
598 gchar *collate_key_name_nocase;
602 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
603 gint sidecar_priority;
605 guint marks; /* each bit represents one mark */
606 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
609 GList *sidecar_files;
610 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
611 FileDataChangeInfo *change; /* for rename, move ... */
612 GdkPixbuf *thumb_pixbuf;
614 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
615 all FileData with non-NULL pixbuf are referenced by image_cache */
621 gint version; /* increased when any field in this structure is changed */
622 gboolean disable_grouping;
624 gint user_orientation;
625 gint exif_orientation;
629 time_t exifdate_digitized;
630 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
631 GList *cached_metadata;
633 gboolean metadata_in_idle_loaded;
639 SelectionType selected; // Used by view_file_icon.
645 struct _LayoutOptions
652 DirViewType dir_view_type;
653 FileViewType file_view_type;
658 } dir_view_list_sort;
660 gboolean show_thumbnails;
662 gboolean show_file_filter;
663 gboolean show_directory_date;
664 gboolean show_info_pixel;
695 gint histogram_channel;
706 gboolean tools_float;
707 gboolean tools_hidden;
708 gboolean toolbar_hidden;
713 gboolean tools_float;
714 gboolean tools_hidden;
721 StartUpPath startup_path;
723 gboolean exit_on_close;
727 SortActionType action;
729 SortSelectionType selection;
735 LayoutOptions options;
745 GtkWidget *group_box;
749 /* menus, path selector */
751 GtkActionGroup *action_group;
752 GtkActionGroup *action_group_editors;
754 GtkUIManager *ui_manager;
755 guint toolbar_merge_id[TOOLBAR_COUNT];
756 GList *toolbar_actions[TOOLBAR_COUNT];
758 GtkWidget *path_entry;
762 LayoutLocation image_location;
766 ImageWindow *split_images[MAX_SPLIT_IMAGES];
767 ImageSplitMode split_mode;
768 gint active_split_image;
770 GtkWidget *split_image_widget;
771 GtkSizeGroup *split_image_sizegroup;
773 /* tools window (float) */
776 GtkWidget *tools_pane;
779 // gint tools_hidden;
780 GtkWidget *menu_tool_bar; /*Combined menu and toolbar box */
781 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
784 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
785 // gint toolbar_hidden;
787 // GtkWidget *thumb_button;
788 // gint thumbs_enabled;
789 // gint marks_enabled;
791 GtkWidget *back_button;
795 LayoutLocation dir_location;
800 // DirViewType dir_view_type;
804 LayoutLocation file_location;
807 // FileViewType file_view_type;
809 GtkWidget *file_view;
811 SortType sort_method;
812 gboolean sort_ascend;
817 GtkWidget *info_progress_bar;
818 GtkWidget *info_sort;
819 GtkWidget *info_status;
820 GtkWidget *info_details;
821 GtkWidget *info_zoom;
822 GtkWidget *info_pixel;
826 SlideShowData *slideshow;
830 FullScreenData *full_screen;
840 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
841 GtkWidget *utility_paned; /* between image and bar */
845 gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
850 GtkWidget *exif_window;
851 GtkWidget *sar_window; /* Search and Run window */
853 AnimationData *animation;
855 GtkWidget *log_window;
872 guint drop_scroll_id; /* event source id */
875 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
876 gpointer select_data;
878 void (*dnd_drop_update_func)(ViewDir *vd);
879 void (*dnd_drop_leave_func)(ViewDir *vd);
881 LayoutWindow *layout;
888 struct _ViewDirInfoList
893 struct _ViewDirInfoTree
895 guint drop_expand_id; /* event source id */
903 // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
910 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
917 gboolean case_sensitive;
923 SortType sort_method;
924 gboolean sort_ascend;
927 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
928 gpointer data_thumb_status;
930 void (*func_status)(ViewFile *vf, gpointer data);
931 gpointer data_status;
933 LayoutWindow *layout;
938 gboolean thumbs_running;
939 ThumbLoader *thumbs_loader;
940 FileData *thumbs_filedata;
943 gboolean marks_enabled;
948 guint refresh_idle_id; /* event source id */
949 time_t time_refresh_set; /* time when refresh_idle_id was set */
951 /* file list for edit menu */
952 GList *editmenu_fd_list;
954 guint read_metadata_in_idle_id;
957 struct _ViewFileInfoList
962 gboolean thumbs_enabled;
964 guint select_idle_id; /* event source id */
967 struct _ViewFileInfoIcon
974 FileData *prev_selection;
976 GtkWidget *tip_window;
977 guint tip_delay_id; /* event source id */
989 struct _SlideShowData
991 LayoutWindow *lw; /* use this window to display the slideshow */
992 ImageWindow *imd; /* use this window only if lw is not available,
993 FIXME: it is probably required only by img-view.c and should be dropped with it */
1005 guint timeout_id; /* event source id */
1007 gboolean from_selection;
1009 void (*stop_func)(SlideShowData *, gpointer);
1015 struct _FullScreenData
1020 GtkWidget *normal_window;
1021 ImageWindow *normal_imd;
1023 guint hide_mouse_id; /* event source id */
1024 guint busy_mouse_id; /* event source id */
1028 guint saver_block_id; /* event source id */
1030 void (*stop_func)(FullScreenData *, gpointer);
1033 gboolean same_region; /* the returned region will overlap the current location of widget. */
1036 struct _PixmapFolders
1045 struct _SecureSaveInfo {
1046 FILE *fp; /**< file stream pointer */
1047 gchar *file_name; /**< final file name */
1048 gchar *tmp_file_name; /**< temporary file name */
1049 gint err; /**< set to non-zero value in case of error */
1050 gboolean secure_save; /**< use secure save for this file, internal use only */
1051 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1052 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1053 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1060 gboolean startup_blank;
1061 gboolean startup_full_screen;
1062 gboolean startup_in_slideshow;
1063 gboolean startup_command_line_collection;
1064 gboolean tools_hide;
1065 gboolean tools_show;
1066 gboolean log_window_show;
1070 GList *collection_list;
1074 SecureSaveInfo *ssi;
1075 gboolean new_instance;
1079 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */