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"
74 ALTER_NONE, /* do nothing */
76 ALTER_ROTATE_90_CC, /* counterclockwise */
85 LAYOUT_RIGHT = 1 << 1,
87 LAYOUT_BOTTOM = 1 << 3
93 IMAGE_STATE_IMAGE = 1 << 0,
94 IMAGE_STATE_LOADING = 1 << 1,
95 IMAGE_STATE_ERROR = 1 << 2,
96 IMAGE_STATE_COLOR_ADJ = 1 << 3,
97 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
98 IMAGE_STATE_ROTATE_USER = 1 << 5,
99 IMAGE_STATE_DELAY_FLIP = 1 << 6
110 FILEDATA_CHANGE_DELETE,
111 FILEDATA_CHANGE_MOVE,
112 FILEDATA_CHANGE_RENAME,
113 FILEDATA_CHANGE_COPY,
114 FILEDATA_CHANGE_UNSPECIFIED,
115 FILEDATA_CHANGE_WRITE_METADATA
116 } FileDataChangeType;
123 } MarkToSelectionMode;
129 } SelectionToMarkMode;
132 FORMAT_CLASS_UNKNOWN,
134 FORMAT_CLASS_RAWIMAGE,
141 SS_ERR_DISABLED, /**< secsave is disabled. */
142 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
144 /* see err field in SecureSaveInfo */
155 NOTIFY_PRIORITY_HIGH = 0,
156 NOTIFY_PRIORITY_MEDIUM,
161 NOTIFY_MARKS = 1 << 1, /* changed marks */
162 NOTIFY_PIXBUF = 1 << 2, /* image was read into fd->pixbuf */
163 NOTIFY_HISTMAP = 1 << 3, /* histmap was read into fd->histmap */
164 NOTIFY_ORIENTATION = 1 << 4, /* image was rotated */
165 NOTIFY_METADATA = 1 << 5, /* changed image metadata, not yet written */
166 NOTIFY_GROUPING = 1 << 6, /* change in fd->sidecar_files or fd->parent */
167 NOTIFY_REREAD = 1 << 7, /* changed file size, date, etc., file name remains unchanged */
168 NOTIFY_CHANGE = 1 << 8 /* generic change described by fd->change */
173 CHANGE_WARN_DEST_EXISTS = 1 << 0,
174 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
175 CHANGE_WARN_SAME = 1 << 2,
176 CHANGE_WARN_CHANGED_EXT = 1 << 3,
177 CHANGE_WARN_UNSAVED_META = 1 << 4,
178 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
179 CHANGE_ERROR_MASK = (~0U) << 8, /* the values below are fatal errors */
180 CHANGE_NO_READ_PERM = 1 << 8,
181 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
182 CHANGE_NO_DEST_DIR = 1 << 10,
183 CHANGE_DUPLICATE_DEST = 1 << 11,
184 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
185 CHANGE_DEST_EXISTS = 1 << 13,
186 CHANGE_NO_SRC = 1 << 14,
187 CHANGE_GENERIC_ERROR = 1 << 16
191 METADATA_PLAIN = 0, /* format that can be edited and written back */
192 METADATA_FORMATTED = 1 /* for display only */
196 STARTUP_PATH_CURRENT = 0,
208 PR_STEREO_NONE = 0, /* do nothing */
209 PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
210 PR_STEREO_FIXED = 1 << 1, /* custom position */
211 PR_STEREO_HORIZ = 1 << 2, /* side by side */
212 PR_STEREO_VERT = 1 << 3, /* above below */
213 PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
214 PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */
215 PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */
216 PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */
217 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/
218 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */
219 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */
220 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */
221 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */
222 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */
223 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
224 PR_STEREO_ANAGLYPH_GM |
225 PR_STEREO_ANAGLYPH_YB |
226 PR_STEREO_ANAGLYPH_GRAY_RC |
227 PR_STEREO_ANAGLYPH_GRAY_GM |
228 PR_STEREO_ANAGLYPH_GRAY_YB |
229 PR_STEREO_ANAGLYPH_DB_RC |
230 PR_STEREO_ANAGLYPH_DB_GM |
231 PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */
233 PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */
234 PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */
236 PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */
237 PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */
239 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
240 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
241 PR_STEREO_SWAP = 1 << 18, /* swap left and right buffers */
242 PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */
243 PR_STEREO_HALF = 1 << 20
244 } PixbufRendererStereoMode;
247 STEREO_PIXBUF_DEFAULT = 0,
248 STEREO_PIXBUF_SBS = 1,
249 STEREO_PIXBUF_CROSS = 2,
250 STEREO_PIXBUF_NONE = 3
253 #define MAX_SPLIT_IMAGES 4
255 typedef struct _ImageLoader ImageLoader;
256 typedef struct _ThumbLoader ThumbLoader;
258 typedef struct _AnimationData AnimationData;
260 typedef struct _CollectInfo CollectInfo;
261 typedef struct _CollectionData CollectionData;
262 typedef struct _CollectTable CollectTable;
263 typedef struct _CollectWindow CollectWindow;
265 typedef struct _ImageWindow ImageWindow;
267 typedef struct _FileData FileData;
268 typedef struct _FileDataChangeInfo FileDataChangeInfo;
270 typedef struct _LayoutWindow LayoutWindow;
271 typedef struct _LayoutOptions LayoutOptions;
273 typedef struct _ViewDir ViewDir;
274 typedef struct _ViewDirInfoList ViewDirInfoList;
275 typedef struct _ViewDirInfoTree ViewDirInfoTree;
277 typedef struct _ViewFile ViewFile;
278 typedef struct _ViewFileInfoList ViewFileInfoList;
279 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
281 typedef struct _SlideShowData SlideShowData;
282 typedef struct _FullScreenData FullScreenData;
284 typedef struct _PixmapFolders PixmapFolders;
285 typedef struct _Histogram Histogram;
286 typedef struct _HistMap HistMap;
288 typedef struct _SecureSaveInfo SecureSaveInfo;
290 typedef struct _ExifData ExifData;
292 typedef struct _EditorDescription EditorDescription;
294 typedef struct _CommandLine CommandLine;
297 gint histogram_channel; /* drawing mode for histogram */
298 gint histogram_mode; /* logarithmical or not */
299 guint vgrid; /* number of vertical divisions, 0 for none */
300 guint hgrid; /* number of horizontal divisions, 0 for none */
306 } grid_color; /* grid color */
314 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
316 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
320 gboolean standard_loader;
323 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
325 gboolean cache_enable;
327 gdouble percent_done;
332 ThumbLoaderFunc func_done;
333 ThumbLoaderFunc func_error;
334 ThumbLoaderFunc func_progress;
338 guint idle_done_id; /* event source id */
341 struct _AnimationData
344 GdkPixbufAnimation *gpa;
345 GdkPixbufAnimationIter *iter;
359 struct _CollectionData
364 SortType sort_method;
366 ThumbLoader *thumb_loader;
367 CollectInfo *thumb_info;
369 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
370 gpointer info_updated_data;
381 /* contents changed since save flag */
384 GHashTable *existence;
397 CollectInfo *prev_selection;
399 CollectInfo *click_info;
401 GtkWidget *tip_window;
402 guint tip_delay_id; /* event source id */
403 CollectInfo *tip_info;
405 GdkWindow *marker_window;
406 CollectInfo *marker_info;
408 GtkWidget *status_label;
409 GtkWidget *extra_label;
413 CollectInfo *focus_info;
416 CollectInfo *drop_info;
419 guint sync_idle_id; /* event source id */
420 guint drop_idle_id; /* event source id */
424 /* file list for edit menu */
425 GList *editmenu_fd_list;
428 struct _CollectWindow
432 GtkWidget *status_box;
435 GtkWidget *close_dialog;
440 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
441 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
442 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
443 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
447 GtkWidget *widget; /* use this to add it and show it */
453 gboolean unknown; /* failed to load image */
455 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
456 sending callbacks to multiple ImageWindows in parallel */
458 gint has_frame; /* not boolean, see image_new() */
460 /* top level (not necessarily parent) window */
461 gboolean top_window_sync; /* resize top_window when image dimensions change */
462 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
463 gchar *title; /* window title to display left of file name */
464 gchar *title_right; /* window title to display right of file name */
465 gboolean title_show_zoom; /* option to include zoom in window title */
468 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
470 void (*func_update)(ImageWindow *imd, gpointer data);
471 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
472 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
473 ImageTileRequestFunc func_tile_request;
474 ImageTileDisposeFunc func_tile_dispose;
476 gpointer data_update;
477 gpointer data_complete;
481 /* button, scroll functions */
482 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
483 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
484 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
485 void (*func_focus_in)(ImageWindow *, gpointer);
487 gpointer data_button;
489 gpointer data_scroll;
490 gpointer data_focus_in;
492 /* scroll notification (for scroll bar implementation) */
493 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
495 gpointer data_scroll_notify;
497 /* collection info */
498 CollectionData *collection;
499 CollectInfo *collection_info;
502 gboolean color_profile_enable;
503 gint color_profile_input;
504 gboolean color_profile_use_image;
505 gint color_profile_from_image;
508 AlterType delay_alter_type;
510 FileData *read_ahead_fd;
511 ImageLoader *read_ahead_il;
515 gboolean auto_refresh;
522 gboolean mouse_wheel_mode;
525 #define FILEDATA_MARKS_SIZE 6
527 struct _FileDataChangeInfo {
528 FileDataChangeType type;
532 gboolean regroup_when_finished;
538 gchar *original_path; /* key to file_data_pool hash table */
541 const gchar *extension;
542 gchar *extended_extension;
543 gchar *collate_key_name;
544 gchar *collate_key_name_nocase;
548 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
549 gint sidecar_priority;
551 guint marks; /* each bit represents one mark */
552 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
555 GList *sidecar_files;
556 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
557 FileDataChangeInfo *change; /* for rename, move ... */
558 GdkPixbuf *thumb_pixbuf;
560 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
561 all FileData with non-NULL pixbuf are referenced by image_cache */
567 gint version; /* increased when any field in this structure is changed */
568 gboolean disable_grouping;
570 gint user_orientation;
571 gint exif_orientation;
575 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
576 GList *cached_metadata;
579 SelectionType selected; // Used by view_file_icon.
582 struct _LayoutOptions
589 DirViewType dir_view_type;
590 FileViewType file_view_type;
592 gboolean show_thumbnails;
594 gboolean show_directory_date;
595 gboolean show_info_pixel;
626 gint histogram_channel;
638 gboolean tools_float;
639 gboolean tools_hidden;
640 gboolean toolbar_hidden;
645 gboolean tools_float;
646 gboolean tools_hidden;
653 StartUpPath startup_path;
655 gboolean exit_on_close;
662 LayoutOptions options;
672 GtkWidget *group_box;
676 /* menus, path selector */
678 GtkActionGroup *action_group;
679 GtkActionGroup *action_group_editors;
681 GtkUIManager *ui_manager;
682 GList *toolbar_actions[TOOLBAR_COUNT];
684 GtkWidget *path_entry;
688 LayoutLocation image_location;
692 ImageWindow *split_images[MAX_SPLIT_IMAGES];
693 ImageSplitMode split_mode;
694 gint active_split_image;
696 GtkWidget *split_image_widget;
697 GtkSizeGroup *split_image_sizegroup;
699 /* tools window (float) */
702 GtkWidget *tools_pane;
705 // gint tools_hidden;
707 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
710 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
711 // gint toolbar_hidden;
713 // GtkWidget *thumb_button;
714 // gint thumbs_enabled;
715 // gint marks_enabled;
717 GtkWidget *back_button;
721 LayoutLocation dir_location;
726 // DirViewType dir_view_type;
730 LayoutLocation file_location;
733 // FileViewType file_view_type;
735 GtkWidget *file_view;
737 SortType sort_method;
738 gboolean sort_ascend;
743 GtkWidget *info_progress_bar;
744 GtkWidget *info_sort;
745 GtkWidget *info_status;
746 GtkWidget *info_details;
747 GtkWidget *info_zoom;
748 GtkWidget *info_pixel;
752 SlideShowData *slideshow;
756 FullScreenData *full_screen;
766 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
767 GtkWidget *utility_paned; /* between image and bar */
771 // gint bar_sort_enabled;
776 GtkWidget *exif_window;
778 AnimationData *animation;
780 GtkWidget *log_window;
797 guint drop_scroll_id; /* event source id */
800 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
801 gpointer select_data;
803 void (*dnd_drop_update_func)(ViewDir *vd);
804 void (*dnd_drop_leave_func)(ViewDir *vd);
806 LayoutWindow *layout;
813 struct _ViewDirInfoList
818 struct _ViewDirInfoTree
820 guint drop_expand_id; /* event source id */
828 // TODO(xsdg): Turn this into a union (see VFLIST and VFICON from view_file.h).
835 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
840 SortType sort_method;
841 gboolean sort_ascend;
844 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
845 gpointer data_thumb_status;
847 void (*func_status)(ViewFile *vf, gpointer data);
848 gpointer data_status;
850 LayoutWindow *layout;
855 gboolean thumbs_running;
856 ThumbLoader *thumbs_loader;
857 FileData *thumbs_filedata;
860 gboolean marks_enabled;
865 guint refresh_idle_id; /* event source id */
866 time_t time_refresh_set; /* time when refresh_idle_id was set */
868 /* file list for edit menu */
869 GList *editmenu_fd_list;
872 struct _ViewFileInfoList
877 gboolean thumbs_enabled;
879 guint select_idle_id; /* event source id */
884 SELECTION_SELECTED = 1 << 0,
885 SELECTION_PRELIGHT = 1 << 1,
886 SELECTION_FOCUS = 1 << 2
889 struct _ViewFileInfoIcon
896 FileData *prev_selection;
898 GtkWidget *tip_window;
899 guint tip_delay_id; /* event source id */
911 struct _SlideShowData
913 LayoutWindow *lw; /* use this window to display the slideshow */
914 ImageWindow *imd; /* use this window only if lw is not available,
915 FIXME: it is probably required only by img-view.c and should be dropped with it */
927 guint timeout_id; /* event source id */
929 gboolean from_selection;
931 void (*stop_func)(SlideShowData *, gpointer);
937 struct _FullScreenData
942 GtkWidget *normal_window;
943 ImageWindow *normal_imd;
945 guint hide_mouse_id; /* event source id */
946 guint busy_mouse_id; /* event source id */
950 guint saver_block_id; /* event source id */
952 void (*stop_func)(FullScreenData *, gpointer);
955 gboolean same_region; /* the returned region will overlap the current location of widget. */
958 struct _PixmapFolders
966 struct _SecureSaveInfo {
967 FILE *fp; /**< file stream pointer */
968 gchar *file_name; /**< final file name */
969 gchar *tmp_file_name; /**< temporary file name */
970 gint err; /**< set to non-zero value in case of error */
971 gboolean secure_save; /**< use secure save for this file, internal use only */
972 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
973 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
974 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
981 gboolean startup_blank;
982 gboolean startup_full_screen;
983 gboolean startup_in_slideshow;
984 gboolean startup_command_line_collection;
987 gboolean log_window_show;
991 GList *collection_list;
999 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */