Use util_clip_triangle() in pan_item_tri_new()
[geeqie.git] / src / image.h
index e7d088d..eed97a5 100644 (file)
 #ifndef IMAGE_H
 #define IMAGE_H
 
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk/gdk.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "typedefs.h"
+
+struct CollectInfo;
+struct CollectionData;
+struct FileData;
+struct ImageLoader;
+
+enum ImageState {
+       IMAGE_STATE_NONE        = 0,
+       IMAGE_STATE_IMAGE       = 1 << 0,
+       IMAGE_STATE_LOADING     = 1 << 1,
+       IMAGE_STATE_ERROR       = 1 << 2,
+       IMAGE_STATE_COLOR_ADJ   = 1 << 3,
+       IMAGE_STATE_ROTATE_AUTO = 1 << 4,
+       IMAGE_STATE_ROTATE_USER = 1 << 5,
+       IMAGE_STATE_DELAY_FLIP  = 1 << 6
+};
+
+struct ImageWindow
+{
+       GtkWidget *widget;      /**< use this to add it and show it */
+       GtkWidget *pr;
+       GtkWidget *frame;
+
+       FileData *image_fd;
+
+       gboolean unknown;               /**< failed to load image */
+
+       ImageLoader *il;        /**< @FIXME image loader should probably go to FileData, but it must first support
+                                  sending callbacks to multiple ImageWindows in parallel */
+
+       gint has_frame;  /**< not boolean, see image_new() */
+
+       /* top level (not necessarily parent) window */
+       gboolean top_window_sync;       /**< resize top_window when image dimensions change */
+       GtkWidget *top_window;  /**< window that gets title, and window to resize when 'fitting' */
+       gchar *title;           /**< window title to display left of file name */
+       gchar *title_right;     /**< window title to display right of file name */
+       gboolean title_show_zoom;       /**< option to include zoom in window title */
+
+       gboolean completed;
+       ImageState state;       /**< mask of IMAGE_STATE_* flags about current image */
+
+       void (*func_update)(ImageWindow *imd, gpointer data);
+       void (*func_complete)(ImageWindow *imd, gint preload, gpointer data);
+       void (*func_state)(ImageWindow *imd, ImageState state, gpointer data);
+
+       using TileRequestFunc = gint (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
+       TileRequestFunc func_tile_request;
+
+       using TileDisposeFunc = void (*)(ImageWindow *, gint, gint, gint, gint, GdkPixbuf *, gpointer);
+       TileDisposeFunc func_tile_dispose;
+
+       gpointer data_update;
+       gpointer data_complete;
+       gpointer data_state;
+       gpointer data_tile;
+
+       /* button, scroll functions */
+       void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
+       void (*func_drag)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer);
+       void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
+       void (*func_focus_in)(ImageWindow *, gpointer);
+
+       gpointer data_button;
+       gpointer data_drag;
+       gpointer data_scroll;
+       gpointer data_focus_in;
+
+       /**
+        * @headerfile func_scroll_notify
+        * scroll notification (for scroll bar implementation)
+        */
+       void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);
+
+       gpointer data_scroll_notify;
+
+       /* collection info */
+       CollectionData *collection;
+       CollectInfo *collection_info;
+
+       /* color profiles */
+       gboolean color_profile_enable;
+       gint color_profile_input;
+       gboolean color_profile_use_image;
+       gint color_profile_from_image;
+       gpointer cm;
+
+       AlterType delay_alter_type;
+
+       FileData *read_ahead_fd;
+       ImageLoader *read_ahead_il;
+
+       gint prev_color_row;
+
+       gboolean auto_refresh;
+
+       gboolean delay_flip;
+       gint orientation;
+       gboolean desaturate;
+       gboolean overunderexposed;
+       gint user_stereo;
+
+       gboolean mouse_wheel_mode;
+};
 
 void image_set_frame(ImageWindow *imd, gboolean frame);
 ImageWindow *image_new(gboolean frame);
@@ -44,9 +154,6 @@ void image_set_scroll_func(ImageWindow *imd,
 void image_set_focus_in_func(ImageWindow *imd,
        void (*func)(ImageWindow *, gpointer),
        gpointer data);
-void image_set_scroll_notify_func(ImageWindow *imd,
-                                 void (*func)(ImageWindow *imd, gint x, gint y, gint width, gint height, gpointer data),
-                                 gpointer data);
 void image_set_complete_func(ImageWindow *imd,
                             void (*func)(ImageWindow *imd, gint preload, gpointer data),
                             gpointer data);
@@ -64,7 +171,7 @@ const gchar *image_get_name(ImageWindow *imd);
 FileData *image_get_fd(ImageWindow *imd);
 
 /**
- * \headerfile image_set_fd
+ * @headerfile image_set_fd
  * merely changes path string, does not change the image!
  */
 void image_set_fd(ImageWindow *imd, FileData *fd);
@@ -92,7 +199,6 @@ void image_alter_orientation(ImageWindow *imd, FileData *fd, AlterType type);
 void image_set_desaturate(ImageWindow *imd, gboolean desaturate);
 gboolean image_get_desaturate(ImageWindow *imd);
 void image_set_overunderexposed(ImageWindow *imd, gboolean overunderexposed);
-gboolean image_get_overunderexposed(ImageWindow *imd);
 void image_set_ignore_alpha(ImageWindow *imd, gboolean ignore_alpha);
 
 /* zoom */
@@ -107,33 +213,31 @@ gchar *image_zoom_get_as_text(ImageWindow *imd);
 gdouble image_zoom_get_default(ImageWindow *imd);
 
 /* stereo */
-gint image_stereo_get(ImageWindow *imd);
 void image_stereo_set(ImageWindow *imd, gint stereo_mode);
-void image_stereo_swap(ImageWindow *imd);
 
 StereoPixbufData image_stereo_pixbuf_get(ImageWindow *imd);
 void image_stereo_pixbuf_set(ImageWindow *imd, StereoPixbufData stereo_mode);
 
 /**
- * \headerfile image_prebuffer_set
+ * @headerfile image_prebuffer_set
  * read ahead, pass NULL to cancel
  */
 void image_prebuffer_set(ImageWindow *imd, FileData *fd);
 
 /**
- * \headerfile image_auto_refresh_enable
+ * @headerfile image_auto_refresh_enable
  * auto refresh
  */
 void image_auto_refresh_enable(ImageWindow *imd, gboolean enable);
 
 /**
- * \headerfile image_top_window_set_sync
+ * @headerfile image_top_window_set_sync
  * allow top window to be resized ?
  */
 void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync);
 
 /* background of image */
-void image_background_set_color(ImageWindow *imd, GdkColor *color);
+void image_background_set_color(ImageWindow *imd, GdkRGBA *color);
 void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen);
 
 /* color profiles */
@@ -148,13 +252,13 @@ gboolean image_color_profile_get_use(ImageWindow *imd);
 gboolean image_color_profile_get_status(ImageWindow *imd, gchar **image_profile, gchar **screen_profile);
 
 /**
- * \headerfile image_set_delay_flip
+ * @headerfile image_set_delay_flip
  * set delayed page flipping
  */
 void image_set_delay_flip(ImageWindow *imd, gint delay);
 
 /**
- * \headerfile image_to_root_window
+ * @headerfile image_to_root_window
  * wallpaper util
  */
 void image_to_root_window(ImageWindow *imd, gboolean scaled);
@@ -163,16 +267,16 @@ void image_to_root_window(ImageWindow *imd, gboolean scaled);
 
 void image_set_image_as_tiles(ImageWindow *imd, gint width, gint height,
                              gint tile_width, gint tile_height, gint cache_size,
-                             ImageTileRequestFunc func_tile_request,
-                             ImageTileDisposeFunc func_tile_dispose,
+                             ImageWindow::TileRequestFunc func_tile_request,
+                             ImageWindow::TileDisposeFunc func_tile_dispose,
                              gpointer data,
                              gdouble zoom);
 
 /**
- * \headerfile image_options_sync
+ * @headerfile image_options_sync
  * reset default options
  */
-void image_options_sync(void);
+void image_options_sync();
 
 void image_get_rectangle(gint *x1, gint *y1, gint *x2, gint *y2);
 void image_update_title(ImageWindow *imd);