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 _CollectInfo CollectInfo;
252 typedef struct _CollectionData CollectionData;
253 typedef struct _CollectTable CollectTable;
254 typedef struct _CollectWindow CollectWindow;
256 typedef struct _ImageWindow ImageWindow;
258 typedef struct _FileData FileData;
259 typedef struct _FileDataChangeInfo FileDataChangeInfo;
261 typedef struct _LayoutWindow LayoutWindow;
262 typedef struct _LayoutOptions LayoutOptions;
264 typedef struct _ViewDir ViewDir;
265 typedef struct _ViewDirInfoList ViewDirInfoList;
266 typedef struct _ViewDirInfoTree ViewDirInfoTree;
268 typedef struct _ViewFile ViewFile;
269 typedef struct _ViewFileInfoList ViewFileInfoList;
270 typedef struct _ViewFileInfoIcon ViewFileInfoIcon;
272 typedef struct _SlideShowData SlideShowData;
273 typedef struct _FullScreenData FullScreenData;
275 typedef struct _PixmapFolders PixmapFolders;
276 typedef struct _Histogram Histogram;
277 typedef struct _HistMap HistMap;
279 typedef struct _SecureSaveInfo SecureSaveInfo;
281 typedef struct _ExifData ExifData;
283 typedef struct _EditorDescription EditorDescription;
285 typedef struct _CommandLine CommandLine;
288 gint histogram_channel; /* drawing mode for histogram */
289 gint histogram_mode; /* logarithmical or not */
290 guint vgrid; /* number of vertical divisions, 0 for none */
291 guint hgrid; /* number of horizontal divisions, 0 for none */
297 } grid_color; /* grid color */
305 typedef void (* ThumbLoaderFunc)(ThumbLoader *tl, gpointer data);
307 typedef void (* FileUtilDoneFunc)(gboolean success, const gchar *done_path, gpointer data);
311 gboolean standard_loader;
314 FileData *fd; /* fd->pixbuf contains final (scaled) image when done */
316 gboolean cache_enable;
318 gdouble percent_done;
323 ThumbLoaderFunc func_done;
324 ThumbLoaderFunc func_error;
325 ThumbLoaderFunc func_progress;
329 guint idle_done_id; /* event source id */
339 struct _CollectionData
344 SortType sort_method;
346 ThumbLoader *thumb_loader;
347 CollectInfo *thumb_info;
349 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
350 gpointer info_updated_data;
361 /* contents changed since save flag */
364 GHashTable *existence;
377 CollectInfo *prev_selection;
379 CollectInfo *click_info;
381 GtkWidget *tip_window;
382 guint tip_delay_id; /* event source id */
383 CollectInfo *tip_info;
385 GdkWindow *marker_window;
386 CollectInfo *marker_info;
388 GtkWidget *status_label;
389 GtkWidget *extra_label;
393 CollectInfo *focus_info;
396 CollectInfo *drop_info;
399 guint sync_idle_id; /* event source id */
400 guint drop_idle_id; /* event source id */
404 /* file list for edit menu */
405 GList *editmenu_fd_list;
408 struct _CollectWindow
412 GtkWidget *status_box;
415 GtkWidget *close_dialog;
420 typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y,
421 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
422 typedef void (* ImageTileDisposeFunc)(ImageWindow *imd, gint x, gint y,
423 gint width, gint height, GdkPixbuf *pixbuf, gpointer);
427 GtkWidget *widget; /* use this to add it and show it */
433 gboolean unknown; /* failed to load image */
435 ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support
436 sending callbacks to multiple ImageWindows in parallel */
438 gint has_frame; /* not boolean, see image_new() */
440 /* top level (not necessarily parent) window */
441 gboolean top_window_sync; /* resize top_window when image dimensions change */
442 GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */
443 gchar *title; /* window title to display left of file name */
444 gchar *title_right; /* window title to display right of file name */
445 gboolean title_show_zoom; /* option to include zoom in window title */
448 ImageState state; /* mask of IMAGE_STATE_* flags about current image */
450 void (*func_update)(ImageWindow *imd, gpointer data);
451 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
452 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
453 ImageTileRequestFunc func_tile_request;
454 ImageTileDisposeFunc func_tile_dispose;
456 gpointer data_update;
457 gpointer data_complete;
461 /* button, scroll functions */
462 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
463 void (*func_drag)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer);
464 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
465 void (*func_focus_in)(ImageWindow *, gpointer);
467 gpointer data_button;
469 gpointer data_scroll;
470 gpointer data_focus_in;
472 /* scroll notification (for scroll bar implementation) */
473 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
475 gpointer data_scroll_notify;
477 /* collection info */
478 CollectionData *collection;
479 CollectInfo *collection_info;
482 gboolean color_profile_enable;
483 gint color_profile_input;
484 gboolean color_profile_use_image;
485 gint color_profile_from_image;
488 AlterType delay_alter_type;
490 FileData *read_ahead_fd;
491 ImageLoader *read_ahead_il;
495 gboolean auto_refresh;
503 #define FILEDATA_MARKS_SIZE 6
505 struct _FileDataChangeInfo {
506 FileDataChangeType type;
510 gboolean regroup_when_finished;
516 gchar *original_path; /* key to file_data_pool hash table */
519 const gchar *extension;
520 gchar *collate_key_name;
521 gchar *collate_key_name_nocase;
525 mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
526 gint sidecar_priority;
528 guint marks; /* each bit represents one mark */
529 guint valid_marks; /* zero bit means that the corresponding mark needs to be reread */
532 GList *sidecar_files;
533 FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
534 FileDataChangeInfo *change; /* for rename, move ... */
535 GdkPixbuf *thumb_pixbuf;
537 GdkPixbuf *pixbuf; /* full-size image, only complete images, NULL during loading
538 all FileData with non-NULL pixbuf are referenced by image_cache */
544 gint version; /* increased when any field in this structure is changed */
545 gboolean disable_grouping;
547 gint user_orientation;
548 gint exif_orientation;
552 GHashTable *modified_xmp; // hash table which contains unwritten xmp metadata in format: key->list of string values
553 GList *cached_metadata;
556 struct _LayoutOptions
563 DirViewType dir_view_type;
564 FileViewType file_view_type;
566 gboolean show_thumbnails;
568 gboolean show_directory_date;
569 gboolean show_info_pixel;
596 gint histogram_channel;
600 gboolean tools_float;
601 gboolean tools_hidden;
602 gboolean toolbar_hidden;
607 StartUpPath startup_path;
609 gboolean exit_on_close;
614 LayoutOptions options;
624 GtkWidget *group_box;
628 /* menus, path selector */
630 GtkActionGroup *action_group;
631 GtkActionGroup *action_group_editors;
633 GtkUIManager *ui_manager;
634 GList *toolbar_actions[TOOLBAR_COUNT];
636 GtkWidget *path_entry;
640 LayoutLocation image_location;
644 ImageWindow *split_images[MAX_SPLIT_IMAGES];
645 ImageSplitMode split_mode;
646 gint active_split_image;
648 GtkWidget *split_image_widget;
649 GtkSizeGroup *split_image_sizegroup;
651 /* tools window (float) */
654 GtkWidget *tools_pane;
657 // gint tools_hidden;
659 GtkWidget *menu_bar; /* referenced by lw, exist during whole lw lifetime */
662 GtkWidget *toolbar[TOOLBAR_COUNT]; /* referenced by lw, exist during whole lw lifetime */
663 // gint toolbar_hidden;
665 // GtkWidget *thumb_button;
666 // gint thumbs_enabled;
667 // gint marks_enabled;
669 GtkWidget *back_button;
673 LayoutLocation dir_location;
678 // DirViewType dir_view_type;
682 LayoutLocation file_location;
685 // FileViewType file_view_type;
687 GtkWidget *file_view;
689 SortType sort_method;
690 gboolean sort_ascend;
695 GtkWidget *info_progress_bar;
696 GtkWidget *info_sort;
697 GtkWidget *info_status;
698 GtkWidget *info_details;
699 GtkWidget *info_zoom;
700 GtkWidget *info_pixel;
704 SlideShowData *slideshow;
708 FullScreenData *full_screen;
718 GtkWidget *utility_box; /* referenced by lw, exist during whole lw lifetime */
719 GtkWidget *utility_paned; /* between image and bar */
723 // gint bar_sort_enabled;
728 GtkWidget *exif_window;
745 guint drop_scroll_id; /* event source id */
748 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
749 gpointer select_data;
751 void (*dnd_drop_update_func)(ViewDir *vd);
752 void (*dnd_drop_leave_func)(ViewDir *vd);
754 LayoutWindow *layout;
761 struct _ViewDirInfoList
766 struct _ViewDirInfoTree
768 guint drop_expand_id; /* event source id */
782 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
787 SortType sort_method;
788 gboolean sort_ascend;
791 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
792 gpointer data_thumb_status;
794 void (*func_status)(ViewFile *vf, gpointer data);
795 gpointer data_status;
797 LayoutWindow *layout;
802 gboolean thumbs_running;
803 ThumbLoader *thumbs_loader;
804 FileData *thumbs_filedata;
807 gboolean marks_enabled;
812 guint refresh_idle_id; /* event source id */
813 time_t time_refresh_set; /* time when refresh_idle_id was set */
815 /* file list for edit menu */
816 GList *editmenu_fd_list;
819 struct _ViewFileInfoList
824 gboolean thumbs_enabled;
826 guint select_idle_id; /* event source id */
831 struct _ViewFileInfoIcon
838 struct _IconData *prev_selection;
840 GtkWidget *tip_window;
841 guint tip_delay_id; /* event source id */
842 struct _IconData *tip_id;
844 struct _IconData *click_id;
846 struct _IconData *focus_id;
853 struct _SlideShowData
855 LayoutWindow *lw; /* use this window to display the slideshow */
856 ImageWindow *imd; /* use this window only if lw is not available,
857 FIXME: it is probably required only by img-view.c and should be dropped with it */
869 guint timeout_id; /* event source id */
871 gboolean from_selection;
873 void (*stop_func)(SlideShowData *, gpointer);
879 struct _FullScreenData
884 GtkWidget *normal_window;
885 ImageWindow *normal_imd;
887 guint hide_mouse_id; /* event source id */
888 guint busy_mouse_id; /* event source id */
892 guint saver_block_id; /* event source id */
894 void (*stop_func)(FullScreenData *, gpointer);
897 gboolean same_region; /* the returned region will overlap the current location of widget. */
900 struct _PixmapFolders
908 struct _SecureSaveInfo {
909 FILE *fp; /**< file stream pointer */
910 gchar *file_name; /**< final file name */
911 gchar *tmp_file_name; /**< temporary file name */
912 gint err; /**< set to non-zero value in case of error */
913 gboolean secure_save; /**< use secure save for this file, internal use only */
914 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
915 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
916 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
923 gboolean startup_blank;
924 gboolean startup_full_screen;
925 gboolean startup_in_slideshow;
926 gboolean startup_command_line_collection;
932 GList *collection_list;
937 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */