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,
36 enum ClipboardDestination {
37 CLIPBOARD_TEXT_PLAIN = 0,
38 CLIPBOARD_TEXT_URI_LIST = 1,
39 CLIPBOARD_X_SPECIAL_GNOME_COPIED_FILES = 2,
40 CLIPBOARD_UTF8_STRING = 3
43 enum ClipboardSelection {
44 CLIPBOARD_PRIMARY = 0,
45 CLIPBOARD_CLIPBOARD = 1,
50 MOUSE_BUTTON_LEFT = 1,
51 MOUSE_BUTTON_MIDDLE = 2,
52 MOUSE_BUTTON_RIGHT = 3,
53 MOUSE_BUTTON_WHEEL_UP = 4,
54 MOUSE_BUTTON_WHEEL_DOWN = 5,
63 DIRVIEW_LAST = DIRVIEW_TREE /**< Keep this up to date! */
70 FILEVIEW_LAST = FILEVIEW_ICON /**< Keep this up to date! */
73 #define CMD_COPY "geeqie-copy-command.desktop"
74 #define CMD_MOVE "geeqie-move-command.desktop"
75 #define CMD_RENAME "geeqie-rename-command.desktop"
76 #define CMD_DELETE "geeqie-delete-command.desktop"
77 #define CMD_FOLDER "geeqie-folder-command.desktop"
88 SORT_EXIFTIMEDIGITIZED,
95 * drag and drop default action
104 ALTER_NONE, /**< do nothing */
106 ALTER_ROTATE_90_CC, /**< counterclockwise */
112 enum LayoutLocation {
114 LAYOUT_LEFT = 1 << 0,
115 LAYOUT_RIGHT = 1 << 1,
117 LAYOUT_BOTTOM = 1 << 3
122 IMAGE_STATE_NONE = 0,
123 IMAGE_STATE_IMAGE = 1 << 0,
124 IMAGE_STATE_LOADING = 1 << 1,
125 IMAGE_STATE_ERROR = 1 << 2,
126 IMAGE_STATE_COLOR_ADJ = 1 << 3,
127 IMAGE_STATE_ROTATE_AUTO = 1 << 4,
128 IMAGE_STATE_ROTATE_USER = 1 << 5,
129 IMAGE_STATE_DELAY_FLIP = 1 << 6
132 enum ImageSplitMode {
140 enum FileDataChangeType {
141 FILEDATA_CHANGE_DELETE,
142 FILEDATA_CHANGE_MOVE,
143 FILEDATA_CHANGE_RENAME,
144 FILEDATA_CHANGE_COPY,
145 FILEDATA_CHANGE_UNSPECIFIED,
146 FILEDATA_CHANGE_WRITE_METADATA
149 enum MarkToSelectionMode {
156 enum SelectionToMarkMode {
162 enum FileFormatClass {
163 FORMAT_CLASS_UNKNOWN,
165 FORMAT_CLASS_RAWIMAGE,
168 FORMAT_CLASS_COLLECTION,
169 FORMAT_CLASS_DOCUMENT,
170 FORMAT_CLASS_ARCHIVE,
174 extern const gchar *format_class_list[]; /**< defined in preferences.cc */
177 * @enum SecureSaveErrno
178 * see err field in #SecureSaveInfo
180 enum SecureSaveErrno {
182 SS_ERR_DISABLED, /**< secsave is disabled. */
183 SS_ERR_OUT_OF_MEM, /**< memory allocation failure */
194 enum NotifyPriority {
195 NOTIFY_PRIORITY_HIGH = 0,
196 NOTIFY_PRIORITY_MEDIUM,
201 NOTIFY_MARKS = 1 << 1, /**< changed marks */
202 NOTIFY_PIXBUF = 1 << 2, /**< image was read into fd->pixbuf */
203 NOTIFY_HISTMAP = 1 << 3, /**< histmap was read into fd->histmap */
204 NOTIFY_ORIENTATION = 1 << 4, /**< image was rotated */
205 NOTIFY_METADATA = 1 << 5, /**< changed image metadata, not yet written */
206 NOTIFY_GROUPING = 1 << 6, /**< change in fd->sidecar_files or fd->parent */
207 NOTIFY_REREAD = 1 << 7, /**< changed file size, date, etc., file name remains unchanged */
208 NOTIFY_CHANGE = 1 << 8 /**< generic change described by fd->change */
213 CHANGE_WARN_DEST_EXISTS = 1 << 0,
214 CHANGE_WARN_NO_WRITE_PERM = 1 << 1,
215 CHANGE_WARN_SAME = 1 << 2,
216 CHANGE_WARN_CHANGED_EXT = 1 << 3,
217 CHANGE_WARN_UNSAVED_META = 1 << 4,
218 CHANGE_WARN_NO_WRITE_PERM_DEST_DIR = 1 << 5,
219 CHANGE_ERROR_MASK = ~0xff, /**< the values below are fatal errors */
220 CHANGE_NO_READ_PERM = 1 << 8,
221 CHANGE_NO_WRITE_PERM_DIR = 1 << 9,
222 CHANGE_NO_DEST_DIR = 1 << 10,
223 CHANGE_DUPLICATE_DEST = 1 << 11,
224 CHANGE_NO_WRITE_PERM_DEST = 1 << 12,
225 CHANGE_DEST_EXISTS = 1 << 13,
226 CHANGE_NO_SRC = 1 << 14,
227 CHANGE_GENERIC_ERROR = 1 << 16
230 enum MetadataFormat {
231 METADATA_PLAIN = 0, /**< format that can be edited and written back */
232 METADATA_FORMATTED = 1 /**< for display only */
236 STARTUP_PATH_CURRENT = 0,
247 enum PixbufRendererStereoMode {
248 PR_STEREO_NONE = 0, /**< do nothing */
249 PR_STEREO_DUAL = 1 << 0, /**< independent stereo buffers, for example nvidia opengl */
250 PR_STEREO_FIXED = 1 << 1, /**< custom position */
251 PR_STEREO_HORIZ = 1 << 2, /**< side by side */
252 PR_STEREO_VERT = 1 << 3, /**< above below */
253 PR_STEREO_RIGHT = 1 << 4, /**< render right buffer */
254 PR_STEREO_ANAGLYPH_RC = 1 << 5, /**< anaglyph red-cyan */
255 PR_STEREO_ANAGLYPH_GM = 1 << 6, /**< anaglyph green-magenta */
256 PR_STEREO_ANAGLYPH_YB = 1 << 7, /**< anaglyph yellow-blue */
257 PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /**< anaglyph gray red-cyan*/
258 PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /**< anaglyph gray green-magenta */
259 PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /**< anaglyph gray yellow-blue */
260 PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /**< anaglyph dubois red-cyan */
261 PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /**< anaglyph dubois green-magenta */
262 PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /**< anaglyph dubois yellow-blue */
263 PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC |
264 PR_STEREO_ANAGLYPH_GM |
265 PR_STEREO_ANAGLYPH_YB |
266 PR_STEREO_ANAGLYPH_GRAY_RC |
267 PR_STEREO_ANAGLYPH_GRAY_GM |
268 PR_STEREO_ANAGLYPH_GRAY_YB |
269 PR_STEREO_ANAGLYPH_DB_RC |
270 PR_STEREO_ANAGLYPH_DB_GM |
271 PR_STEREO_ANAGLYPH_DB_YB, /**< anaglyph mask */
273 PR_STEREO_MIRROR_LEFT = 1 << 14, /**< mirror */
274 PR_STEREO_FLIP_LEFT = 1 << 15, /**< flip */
276 PR_STEREO_MIRROR_RIGHT = 1 << 16, /**< mirror */
277 PR_STEREO_FLIP_RIGHT = 1 << 17, /**< flip */
279 PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /**< mirror mask*/
280 PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /**< flip mask*/
281 PR_STEREO_SWAP = 1 << 18, /**< swap left and right buffers */
282 PR_STEREO_TEMP_DISABLE = 1 << 19, /**< temporarily disable stereo mode if source image is not stereo */
283 PR_STEREO_HALF = 1 << 20
286 enum StereoPixbufData {
287 STEREO_PIXBUF_DEFAULT = 0,
288 STEREO_PIXBUF_SBS = 1,
289 STEREO_PIXBUF_CROSS = 2,
290 STEREO_PIXBUF_NONE = 3
294 BAR_SORT_MODE_FOLDER = 0,
295 BAR_SORT_MODE_COLLECTION,
299 enum SortActionType {
303 BAR_SORT_ACTION_COUNT
306 enum SortSelectionType {
307 BAR_SORT_SELECTION_IMAGE = 0,
308 BAR_SORT_SELECTION_SELECTED,
309 BAR_SORT_SELECTION_COUNT
312 #define MAX_SPLIT_IMAGES 4
316 SELECTION_SELECTED = 1 << 0,
317 SELECTION_PRELIGHT = 1 << 1,
318 SELECTION_FOCUS = 1 << 2
324 struct AnimationData;
327 struct CollectionData;
329 struct CollectWindow;
334 struct FileDataChangeInfo;
337 struct LayoutOptions;
340 struct ViewDirInfoList;
341 struct ViewDirInfoTree;
344 struct ViewFileInfoList;
345 struct ViewFileInfoIcon;
347 struct SlideShowData;
348 struct FullScreenData;
350 struct PixmapFolders;
354 struct SecureSaveInfo;
358 struct EditorDescription;
363 gint histogram_channel; /**< drawing mode for histogram */
364 gint histogram_mode; /**< logarithmical or not */
365 guint vgrid; /**< number of vertical divisions, 0 for none */
366 guint hgrid; /**< number of horizontal divisions, 0 for none */
372 } grid_color; /**< grid color */
380 using ThumbLoaderFunc = void (*)(ThumbLoader *, gpointer);
382 using FileUtilDoneFunc = void (*)(gboolean, const gchar *, gpointer);
386 gboolean standard_loader;
389 FileData *fd; /**< fd->pixbuf contains final (scaled) image when done */
391 gboolean cache_enable;
393 gdouble percent_done;
398 ThumbLoaderFunc func_done;
399 ThumbLoaderFunc func_error;
400 ThumbLoaderFunc func_progress;
404 guint idle_done_id; /**< event source id */
411 GdkPixbufAnimation *gpa;
412 GdkPixbufAnimationIter *iter;
417 GCancellable *cancellable;
419 GFileInputStream *gfstream;
429 struct CollectionData
434 SortType sort_method;
436 ThumbLoader *thumb_loader;
437 CollectInfo *thumb_info;
439 void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
440 gpointer info_updated_data;
451 gboolean changed; /**< contents changed since save flag */
453 GHashTable *existence;
466 CollectInfo *prev_selection;
468 CollectInfo *click_info;
470 GtkWidget *tip_window;
471 guint tip_delay_id; /**< event source id */
472 CollectInfo *tip_info;
474 GdkWindow *marker_window;
475 CollectInfo *marker_info;
477 GtkWidget *status_label;
478 GtkWidget *extra_label;
482 CollectInfo *focus_info;
485 CollectInfo *drop_info;
488 guint sync_idle_id; /**< event source id */
489 guint drop_idle_id; /**< event source id */
494 GList *editmenu_fd_list; /**< file list for edit menu */
501 GtkWidget *status_box;
503 GtkWidget *close_dialog;
508 using ImageTileRequestFunc = gint (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
509 using ImageTileDisposeFunc = void (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
513 GtkWidget *widget; /**< use this to add it and show it */
519 gboolean unknown; /**< failed to load image */
521 ImageLoader *il; /**< @FIXME image loader should probably go to FileData, but it must first support
522 sending callbacks to multiple ImageWindows in parallel */
524 gint has_frame; /**< not boolean, see image_new() */
526 /* top level (not necessarily parent) window */
527 gboolean top_window_sync; /**< resize top_window when image dimensions change */
528 GtkWidget *top_window; /**< window that gets title, and window to resize when 'fitting' */
529 gchar *title; /**< window title to display left of file name */
530 gchar *title_right; /**< window title to display right of file name */
531 gboolean title_show_zoom; /**< option to include zoom in window title */
534 ImageState state; /**< mask of IMAGE_STATE_* flags about current image */
536 void (*func_update)(ImageWindow *imd, gpointer data);
537 void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
538 void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
539 ImageTileRequestFunc func_tile_request;
540 ImageTileDisposeFunc func_tile_dispose;
542 gpointer data_update;
543 gpointer data_complete;
547 /* button, scroll functions */
548 void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
549 void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
550 void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
551 void (*func_focus_in)(ImageWindow *, gpointer);
553 gpointer data_button;
555 gpointer data_scroll;
556 gpointer data_focus_in;
559 * @headerfile func_scroll_notify
560 * scroll notification (for scroll bar implementation)
562 void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
564 gpointer data_scroll_notify;
566 /* collection info */
567 CollectionData *collection;
568 CollectInfo *collection_info;
571 gboolean color_profile_enable;
572 gint color_profile_input;
573 gboolean color_profile_use_image;
574 gint color_profile_from_image;
577 AlterType delay_alter_type;
579 FileData *read_ahead_fd;
580 ImageLoader *read_ahead_il;
584 gboolean auto_refresh;
589 gboolean overunderexposed;
592 gboolean mouse_wheel_mode;
595 #define FILEDATA_MARKS_SIZE 10
597 struct FileDataChangeInfo {
598 FileDataChangeType type;
602 gboolean regroup_when_finished;
608 gchar *original_path; /**< key to file_data_pool hash table */
611 const gchar *extension;
612 gchar *extended_extension;
613 FileFormatClass format_class;
614 gchar *format_name; /**< set by the image loader */
615 gchar *collate_key_name;
616 gchar *collate_key_name_nocase;
617 gchar *collate_key_name_natural;
618 gchar *collate_key_name_nocase_natural;
622 mode_t mode; /**< this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
623 gint sidecar_priority;
625 guint marks; /**< each bit represents one mark */
626 guint valid_marks; /**< zero bit means that the corresponding mark needs to be reread */
629 GList *sidecar_files;
630 FileData *parent; /**< parent file if this is a sidecar file, NULL otherwise */
631 FileDataChangeInfo *change; /**< for rename, move ... */
632 GdkPixbuf *thumb_pixbuf;
634 GdkPixbuf *pixbuf; /**< full-size image, only complete images, NULL during loading
635 all FileData with non-NULL pixbuf are referenced by image_cache */
641 gint version; /**< increased when any field in this structure is changed */
642 gboolean disable_grouping;
644 gint user_orientation;
645 gint exif_orientation;
649 time_t exifdate_digitized;
650 GHashTable *modified_xmp; /**< hash table which contains unwritten xmp metadata in format: key->list of string values */
651 GList *cached_metadata;
653 gboolean metadata_in_idle_loaded;
659 SelectionType selected; /**< Used by view-file-icon. */
672 DirViewType dir_view_type;
673 FileViewType file_view_type;
678 gboolean case_sensitive;
679 } dir_view_list_sort;
684 gboolean case_sensitive;
685 } file_view_list_sort;
687 gboolean show_thumbnails;
689 gboolean show_file_filter;
690 gboolean show_directory_date;
691 gboolean show_info_pixel;
692 gboolean split_pane_sync;
693 gboolean ignore_alpha;
724 gint histogram_channel;
741 } preferences_window;
762 } advanced_exif_window;
764 gboolean tools_float;
765 gboolean tools_hidden;
766 gboolean toolbar_hidden;
771 gboolean tools_float;
772 gboolean tools_hidden;
779 StartUpPath startup_path;
784 SortActionType action;
786 SortSelectionType selection;
792 LayoutOptions options;
802 GtkWidget *group_box;
806 /* menus, path selector */
808 GtkActionGroup *action_group;
809 GtkActionGroup *action_group_editors;
811 GtkUIManager *ui_manager;
812 guint toolbar_merge_id[TOOLBAR_COUNT];
813 GList *toolbar_actions[TOOLBAR_COUNT];
815 GtkWidget *path_entry;
819 LayoutLocation image_location;
823 ImageWindow *split_images[MAX_SPLIT_IMAGES];
824 ImageSplitMode split_mode;
825 gint active_split_image;
827 GtkWidget *split_image_widget;
828 GtkSizeGroup *split_image_sizegroup;
830 /* tools window (float) */
833 GtkWidget *tools_pane;
835 GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
836 GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
839 GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
841 GtkWidget *back_button;
845 LayoutLocation dir_location;
852 LayoutLocation file_location;
856 GtkWidget *file_view;
858 GtkWidget *info_box; /**< status bar */
859 GtkWidget *info_progress_bar; /**< status bar */
860 GtkWidget *info_sort; /**< status bar */
861 GtkWidget *info_status; /**< status bar */
862 GtkWidget *info_details; /**< status bar */
863 GtkWidget *info_zoom; /**< status bar */
864 GtkWidget *info_pixel; /**< status bar */
868 SlideShowData *slideshow;
872 FullScreenData *full_screen;
876 GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
877 GtkWidget *utility_paned; /**< between image and bar */
881 gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
883 GtkWidget *exif_window;
884 GtkWidget *sar_window; /**< Search and Run window */
886 AnimationData *animation;
888 GtkWidget *log_window;
905 guint drop_scroll_id; /**< event source id */
908 void (*select_func)(ViewDir *vd, FileData *fd, gpointer data);
909 gpointer select_data;
911 void (*dnd_drop_update_func)(ViewDir *vd);
912 void (*dnd_drop_leave_func)(ViewDir *vd);
914 LayoutWindow *layout;
921 struct ViewDirInfoList
926 struct ViewDirInfoTree
928 guint drop_expand_id; /**< event source id */
935 FileViewType type; /**< @todo (xsdg): Turn this into a union (see VFLIST and VFICON from view-file.h). */
943 GtkWidget *filter_check[FILEDATA_MARKS_SIZE];
950 gboolean case_sensitive;
956 SortType sort_method;
957 gboolean sort_ascend;
961 void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data);
962 gpointer data_thumb_status;
964 void (*func_status)(ViewFile *vf, gpointer data);
965 gpointer data_status;
967 LayoutWindow *layout;
972 gboolean thumbs_running;
973 ThumbLoader *thumbs_loader;
974 FileData *thumbs_filedata;
977 gboolean marks_enabled;
982 FileData *stars_filedata;
986 guint refresh_idle_id; /**< event source id */
987 time_t time_refresh_set; /**< time when refresh_idle_id was set */
989 GList *editmenu_fd_list; /**< file list for edit menu */
991 guint read_metadata_in_idle_id;
994 struct ViewFileInfoList
999 gboolean thumbs_enabled;
1001 guint select_idle_id; /**< event source id */
1004 struct ViewFileInfoIcon
1011 FileData *prev_selection;
1013 GtkWidget *tip_window;
1014 guint tip_delay_id; /**< event source id */
1026 struct SlideShowData
1028 LayoutWindow *lw; /**< use this window to display the slideshow */
1029 ImageWindow *imd; /**< use this window only if lw is not available,
1030 @FIXME it is probably required only by img-view.cc and should be dropped with it */
1042 guint timeout_id; /**< event source id */
1044 gboolean from_selection;
1046 void (*stop_func)(SlideShowData *, gpointer);
1052 struct FullScreenData
1057 GtkWidget *normal_window;
1058 ImageWindow *normal_imd;
1060 guint hide_mouse_id; /**< event source id */
1061 guint busy_mouse_id; /**< event source id */
1065 guint saver_block_id; /**< event source id */
1067 void (*stop_func)(FullScreenData *, gpointer);
1070 gboolean same_region; /**< the returned region will overlap the current location of widget. */
1073 struct PixmapFolders
1080 GdkPixbuf *read_only;
1083 struct SecureSaveInfo {
1084 FILE *fp; /**< file stream pointer */
1085 gchar *file_name; /**< final file name */
1086 gchar *tmp_file_name; /**< temporary file name */
1087 gint err; /**< set to non-zero value in case of error */
1088 gboolean secure_save; /**< use secure save for this file, internal use only */
1089 gboolean preserve_perms; /**< whether to preserve perms, TRUE by default */
1090 gboolean preserve_mtime; /**< whether to preserve mtime, FALSE by default */
1091 gboolean unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */
1098 gboolean startup_blank;
1099 gboolean startup_full_screen;
1100 gboolean startup_in_slideshow;
1101 gboolean startup_command_line_collection;
1102 gboolean tools_hide;
1103 gboolean tools_show;
1104 gboolean log_window_show;
1108 GList *collection_list;
1112 SecureSaveInfo *ssi;
1113 gboolean new_instance;
1117 * @struct hard_coded_window_keys
1118 * @brief hard coded window shortcut keys
1120 * Used for two purposes:\n
1121 * to display the shortcuts keys in popup menus\n
1122 * used by ./doc/create-shortcuts-xml.sh to generate shortcut documentation in the Help files
1125 struct hard_coded_window_keys {
1126 GdkModifierType mask; /**< modifier key mask */
1127 guint key_value; /**< GDK_keyval */
1128 const gchar *text; /**< menu item label - NULL if end of list */
1132 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */