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,
42 MOUSE_BUTTON_BACK = 8,
43 MOUSE_BUTTON_FORWARD = 9
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"
81 ALTER_NONE, /* do nothing */
83 ALTER_ROTATE_90_CC, /* counterclockwise */
92 LAYOUT_RIGHT = 1 << 1,
94 LAYOUT_BOTTOM = 1 << 3
100 IMAGE_STATE_IMAGE = 1 << 0,
101 IMAGE_STATE_LOADING = 1 << 1,
102 IMAGE_STATE_ERROR = 1 << 2,
103 IMAGE_STATE_COLOR_ADJ = 1 << 3,
104 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
105 IMAGE_STATE_ROTATE_USER = 1 << 5,
106 IMAGE_STATE_DELAY_FLIP = 1 << 6
117 FILEDATA_CHANGE_DELETE,
118 FILEDATA_CHANGE_MOVE,
119 FILEDATA_CHANGE_RENAME,
120 FILEDATA_CHANGE_COPY,
121 FILEDATA_CHANGE_UNSPECIFIED,
122 FILEDATA_CHANGE_WRITE_METADATA
123 } FileDataChangeType;
130 } MarkToSelectionMode;
136 } SelectionToMarkMode;
139 FORMAT_CLASS_UNKNOWN,
141 FORMAT_CLASS_RAWIMAGE,
149 SS_ERR_DISABLED, /**< secsave is disabled. */
150 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
152 /* see err field in SecureSaveInfo */
163 NOTIFY_PRIORITY_HIGH = 0,
164 NOTIFY_PRIORITY_MEDIUM,
169 NOTIFY_MARKS = 1 << 1, /* changed marks */
170 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
171 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
172 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
173 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
174 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
175 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
176 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
181 CHANGE_WARN_DEST_EXISTS = 1 << 0,
182 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
183 CHANGE_WARN_SAME = 1 << 2,
184 CHANGE_WARN_CHANGED_EXT = 1 << 3,
185 CHANGE_WARN_UNSAVED_META = 1 << 4,
186 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
187 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
188 CHANGE_NO_READ_PERM = 1 << 8,
189 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
190 CHANGE_NO_DEST_DIR = 1 << 10,
191 CHANGE_DUPLICATE_DEST = 1 << 11,
192 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
193 CHANGE_DEST_EXISTS = 1 << 13,
194 CHANGE_NO_SRC = 1 << 14,
195 CHANGE_GENERIC_ERROR = 1 << 16
199 METADATA_PLAIN = 0, /* format that can be edited and written back */
200 METADATA_FORMATTED = 1 /* for display only */
204 STARTUP_PATH_CURRENT = 0,
216 PR_STEREO_NONE = 0, /* do nothing */
217 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
218 PR_STEREO_FIXED = 1 << 1, /* custom position */
219 PR_STEREO_HORIZ = 1 << 2, /* side by side */
220 PR_STEREO_VERT = 1 << 3, /* above below */
221 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
222 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
223 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
224 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
225 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
226 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
227 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
228 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
229 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
230 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
231 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
232 PR_STEREO_ANAGLYPH_GM |
233 PR_STEREO_ANAGLYPH_YB |
234 PR_STEREO_ANAGLYPH_GRAY_RC |
235 PR_STEREO_ANAGLYPH_GRAY_GM |
236 PR_STEREO_ANAGLYPH_GRAY_YB |
237 PR_STEREO_ANAGLYPH_DB_RC |
238 PR_STEREO_ANAGLYPH_DB_GM |
239 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
241 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
242 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
244 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
245 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
247 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
248 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
249 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
250 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
251 PR_STEREO_HALF = 1 << 20
252 } PixbufRendererStereoMode;
255 STEREO_PIXBUF_DEFAULT = 0,
256 STEREO_PIXBUF_SBS = 1,
257 STEREO_PIXBUF_CROSS = 2,
258 STEREO_PIXBUF_NONE = 3
261 #define MAX_SPLIT_IMAGES 4
265 SELECTION_SELECTED = 1 << 0,
266 SELECTION_PRELIGHT = 1 << 1,
267 SELECTION_FOCUS = 1 << 2
270 typedef struct _ImageLoader ImageLoader;
271 typedef struct _ThumbLoader ThumbLoader;
273 typedef struct _AnimationData AnimationData;
275 typedef struct _CollectInfo CollectInfo;
276 typedef struct _CollectionData CollectionData;
277 typedef struct _CollectTable CollectTable;
278 typedef struct _CollectWindow CollectWindow;
280 typedef struct _ImageWindow ImageWindow;
282 typedef struct _FileData FileData;
283 typedef struct _FileDataChangeInfo FileDataChangeInfo;
285 typedef struct _LayoutWindow LayoutWindow;
286 typedef struct _LayoutOptions LayoutOptions;
288 typedef struct _ViewDir ViewDir;
289 typedef struct _ViewDirInfoList ViewDirInfoList;
290 typedef struct _ViewDirInfoTree ViewDirInfoTree;
292 typedef struct _ViewFile ViewFile;
293 typedef struct _ViewFileInfoList ViewFileInfoList;
294 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
296 typedef struct _SlideShowData SlideShowData;
297 typedef struct _FullScreenData FullScreenData;
299 typedef struct _PixmapFolders PixmapFolders;
300 typedef struct _Histogram Histogram;
301 typedef struct _HistMap HistMap;
303 typedef struct _SecureSaveInfo SecureSaveInfo;
305 typedef struct _ExifData ExifData;
307 typedef struct _EditorDescription EditorDescription;
309 typedef struct _CommandLine CommandLine;
312 gint histogram_channel; /* drawing mode for histogram */
313 gint histogram_mode; /* logarithmical or not */
314 guint vgrid; /* number of vertical divisions, 0 for none */
315 guint hgrid; /* number of horizontal divisions, 0 for none */
321 } grid_color; /* grid color */
329 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
331 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
335 gboolean standard_loader;
338 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
340 gboolean cache_enable;
342 gdouble percent_done;
347 ThumbLoaderFunc func_done;
348 ThumbLoaderFunc func_error;
349 ThumbLoaderFunc func_progress;
353 guint idle_done_id; /* event source id */
356 struct _AnimationData
359 GdkPixbufAnimation *gpa;
360 GdkPixbufAnimationIter *iter;
374 struct _CollectionData
379 SortType sort_method;
381 ThumbLoader *thumb_loader;
382 CollectInfo *thumb_info;
384 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
385 gpointer info_updated_data;
396 /* contents changed since save flag */
399 GHashTable *existence;
412 CollectInfo *prev_selection;
414 CollectInfo *click_info;
416 GtkWidget *tip_window;
417 guint tip_delay_id; /* event source id */
418 CollectInfo *tip_info;
420 GdkWindow *marker_window;
421 CollectInfo *marker_info;
423 GtkWidget *status_label;
424 GtkWidget *extra_label;
428 CollectInfo *focus_info;
431 CollectInfo *drop_info;
434 guint sync_idle_id; /* event source id */
435 guint drop_idle_id; /* event source id */
439 /* file list for edit menu */
440 GList *editmenu_fd_list;
443 struct _CollectWindow
447 GtkWidget *status_box;
449 GtkWidget *close_dialog;
454 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
455 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
456 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
457 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
461 GtkWidget *widget; /* use this to add it and show it */
467 gboolean unknown; /* failed to load image */
469 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
470 sending callbacks to multiple ImageWindows in parallel */
472 gint has_frame; /* not boolean, see image_new() */
474 /* top level (not necessarily parent) window */
475 gboolean top_window_sync; /* resize top_window when image dimensions change */
476 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
477 gchar *title; /* window title to display left of file name */
478 gchar *title_right; /* window title to display right of file name */
479 gboolean title_show_zoom; /* option to include zoom in window title */
482 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
484 void (*func_update)(ImageWindow *imd, gpointer data);
485 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
486 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
487 ImageTileRequestFunc func_tile_request;
488 ImageTileDisposeFunc func_tile_dispose;
490 gpointer data_update;
491 gpointer data_complete;
495 /* button, scroll functions */
496 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
497 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
498 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
499 void (*func_focus_in)(ImageWindow *, gpointer);
501 gpointer data_button;
503 gpointer data_scroll;
504 gpointer data_focus_in;
506 /* scroll notification (for scroll bar implementation) */
507 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
509 gpointer data_scroll_notify;
511 /* collection info */
512 CollectionData *collection;
513 CollectInfo *collection_info;
516 gboolean color_profile_enable;
517 gint color_profile_input;
518 gboolean color_profile_use_image;
519 gint color_profile_from_image;
522 AlterType delay_alter_type;
524 FileData *read_ahead_fd;
525 ImageLoader *read_ahead_il;
529 gboolean auto_refresh;
536 gboolean mouse_wheel_mode;
539 #define FILEDATA_MARKS_SIZE 10
541 struct _FileDataChangeInfo {
542 FileDataChangeType type;
546 gboolean regroup_when_finished;
552 gchar *original_path; /* key to file_data_pool hash table */
555 const gchar *extension;
556 gchar *extended_extension;
557 FileFormatClass format_class;
558 gchar *collate_key_name;
559 gchar *collate_key_name_nocase;
563 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
564 gint sidecar_priority;
566 guint marks; /* each bit represents one mark */
567 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
570 GList *sidecar_files;
571 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
572 FileDataChangeInfo *change; /* for rename, move ... */
573 GdkPixbuf *thumb_pixbuf;
575 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
576 all FileData with non-NULL pixbuf are referenced by image_cache */
582 gint version; /* increased when any field in this structure is changed */
583 gboolean disable_grouping;
585 gint user_orientation;
586 gint exif_orientation;
590 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
591 GList *cached_metadata;
594 SelectionType selected; // Used by view_file_icon.
597 struct _LayoutOptions
604 DirViewType dir_view_type;
605 FileViewType file_view_type;
607 gboolean show_thumbnails;
609 gboolean show_directory_date;
610 gboolean show_info_pixel;
641 gint histogram_channel;
652 gboolean tools_float;
653 gboolean tools_hidden;
654 gboolean toolbar_hidden;
659 gboolean tools_float;
660 gboolean tools_hidden;
667 StartUpPath startup_path;
669 gboolean exit_on_close;
676 LayoutOptions options;
686 GtkWidget *group_box;
690 /* menus, path selector */
692 GtkActionGroup *action_group;
693 GtkActionGroup *action_group_editors;
695 GtkUIManager *ui_manager;
696 guint toolbar_merge_id[TOOLBAR_COUNT];
697 GList *toolbar_actions[TOOLBAR_COUNT];
699 GtkWidget *path_entry;
703 LayoutLocation image_location;
707 ImageWindow *split_images[MAX_SPLIT_IMAGES];
708 ImageSplitMode split_mode;
709 gint active_split_image;
711 GtkWidget *split_image_widget;
712 GtkSizeGroup *split_image_sizegroup;
714 /* tools window (float) */
717 GtkWidget *tools_pane;
720 // gint tools_hidden;
722 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
725 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
726 // gint toolbar_hidden;
728 // GtkWidget *thumb_button;
729 // gint thumbs_enabled;
730 // gint marks_enabled;
732 GtkWidget *back_button;
736 LayoutLocation dir_location;
741 // DirViewType dir_view_type;
745 LayoutLocation file_location;
748 // FileViewType file_view_type;
750 GtkWidget *file_view;
752 SortType sort_method;
753 gboolean sort_ascend;
758 GtkWidget *info_progress_bar;
759 GtkWidget *info_sort;
760 GtkWidget *info_status;
761 GtkWidget *info_details;
762 GtkWidget *info_zoom;
763 GtkWidget *info_pixel;
767 SlideShowData *slideshow;
771 FullScreenData *full_screen;
781 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
782 GtkWidget *utility_paned; /* between image and bar */
786 gboolean bar_sort_enabled; /* Set during start-up, and checked when the editors have loaded */
791 GtkWidget *exif_window;
793 AnimationData *animation;
795 GtkWidget *log_window;
812 guint drop_scroll_id; /* event source id */
815 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
816 gpointer select_data;
818 void (*dnd_drop_update_func)(ViewDir *vd);
819 void (*dnd_drop_leave_func)(ViewDir *vd);
821 LayoutWindow *layout;
828 struct _ViewDirInfoList
833 struct _ViewDirInfoTree
835 guint drop_expand_id; /* event source id */
843 // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
850 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
855 SortType sort_method;
856 gboolean sort_ascend;
859 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
860 gpointer data_thumb_status;
862 void (*func_status)(ViewFile *vf, gpointer data);
863 gpointer data_status;
865 LayoutWindow *layout;
870 gboolean thumbs_running;
871 ThumbLoader *thumbs_loader;
872 FileData *thumbs_filedata;
875 gboolean marks_enabled;
880 guint refresh_idle_id; /* event source id */
881 time_t time_refresh_set; /* time when refresh_idle_id was set */
883 /* file list for edit menu */
884 GList *editmenu_fd_list;
887 struct _ViewFileInfoList
892 gboolean thumbs_enabled;
894 guint select_idle_id; /* event source id */
897 struct _ViewFileInfoIcon
904 FileData *prev_selection;
906 GtkWidget *tip_window;
907 guint tip_delay_id; /* event source id */
919 struct _SlideShowData
921 LayoutWindow *lw; /* use this window to display the slideshow */
922 ImageWindow *imd; /* use this window only if lw is not available,
923 FIXME: it is probably required only by img-view.c and should be dropped with it */
935 guint timeout_id; /* event source id */
937 gboolean from_selection;
939 void (*stop_func)(SlideShowData *, gpointer);
945 struct _FullScreenData
950 GtkWidget *normal_window;
951 ImageWindow *normal_imd;
953 guint hide_mouse_id; /* event source id */
954 guint busy_mouse_id; /* event source id */
958 guint saver_block_id; /* event source id */
960 void (*stop_func)(FullScreenData *, gpointer);
963 gboolean same_region; /* the returned region will overlap the current location of widget. */
966 struct _PixmapFolders
974 struct _SecureSaveInfo {
975 FILE *fp; /**< file stream pointer */
976 gchar *file_name; /**< final file name */
977 gchar *tmp_file_name; /**< temporary file name */
978 gint err; /**< set to non-zero value in case of error */
979 gboolean secure_save; /**< use secure save for this file, internal use only */
980 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
981 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
982 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
989 gboolean startup_blank;
990 gboolean startup_full_screen;
991 gboolean startup_in_slideshow;
992 gboolean startup_command_line_collection;
995 gboolean log_window_show;
999 GList *collection_list;
1003 SecureSaveInfo *ssi;
1007 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */