1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifndef __GDISPLAY_H__
|
|
|
|
#define __GDISPLAY_H__
|
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
|
2001-09-26 01:44:03 +08:00
|
|
|
#include "core/gimpobject.h"
|
2001-08-17 22:27:31 +08:00
|
|
|
|
2001-05-14 05:51:20 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
/* FIXME move all GTK stuff to gimpdisplayshell */
|
|
|
|
#include "gui/gui-types.h"
|
1998-08-16 08:34:20 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* some useful macros */
|
|
|
|
|
1998-12-06 05:48:37 +08:00
|
|
|
/* unpacking the user scale level (char) */
|
1997-11-25 06:05:25 +08:00
|
|
|
#define SCALESRC(g) (g->scale & 0x00ff)
|
|
|
|
#define SCALEDEST(g) (g->scale >> 8)
|
1998-12-06 05:48:37 +08:00
|
|
|
|
1999-05-23 01:56:35 +08:00
|
|
|
/* finding the effective screen resolution (double) */
|
2001-06-04 04:40:50 +08:00
|
|
|
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : gimprc.monitor_xres)
|
|
|
|
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : gimprc.monitor_yres)
|
1998-12-06 05:48:37 +08:00
|
|
|
|
1999-05-23 01:56:35 +08:00
|
|
|
/* calculate scale factors (double) */
|
1998-12-06 05:48:37 +08:00
|
|
|
#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \
|
|
|
|
(SCALESRC(g) * g->gimage->xresolution))
|
|
|
|
#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \
|
|
|
|
(SCALESRC(g) * g->gimage->yresolution))
|
|
|
|
|
|
|
|
/* scale values */
|
1999-11-06 22:32:21 +08:00
|
|
|
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g)))
|
|
|
|
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g)))
|
1998-12-06 05:48:37 +08:00
|
|
|
|
|
|
|
/* unscale values */
|
1999-11-06 22:32:21 +08:00
|
|
|
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g)))
|
|
|
|
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g)))
|
1999-01-26 05:11:44 +08:00
|
|
|
/* (and float-returning versions) */
|
|
|
|
#define FUNSCALEX(g,x) ((x / SCALEFACTOR_X(g)))
|
|
|
|
#define FUNSCALEY(g,y) ((y / SCALEFACTOR_Y(g)))
|
|
|
|
|
1998-12-06 05:48:37 +08:00
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
#define LOWPASS(x) ((x>0) ? x : 0)
|
1998-07-25 02:52:03 +08:00
|
|
|
/* #define HIGHPASS(x,y) ((x>y) ? y : x) */ /* unused - == MIN */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
1998-11-15 22:09:16 +08:00
|
|
|
/* maximal width of the string holding the cursor-coordinates for
|
1998-11-14 06:11:37 +08:00
|
|
|
the status line */
|
|
|
|
#define CURSOR_STR_LENGTH 256
|
|
|
|
|
1999-02-28 02:09:56 +08:00
|
|
|
/* maximal length of the format string for the cursor-coordinates */
|
1999-03-17 05:33:56 +08:00
|
|
|
#define CURSOR_FORMAT_LENGTH 32
|
1999-02-28 02:09:56 +08:00
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
|
|
|
|
typedef struct _IdleRenderStruct IdleRenderStruct;
|
|
|
|
|
|
|
|
struct _IdleRenderStruct
|
1998-10-01 19:53:20 +08:00
|
|
|
{
|
2001-05-14 01:25:12 +08:00
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint basex;
|
|
|
|
gint basey;
|
|
|
|
guint idleid;
|
|
|
|
gboolean active;
|
|
|
|
GSList *update_areas; /* flushed update areas */
|
|
|
|
};
|
1998-10-01 19:53:20 +08:00
|
|
|
|
|
|
|
|
2001-09-26 01:44:03 +08:00
|
|
|
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
|
|
|
|
#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay))
|
|
|
|
#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
|
|
|
#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY))
|
|
|
|
#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY))
|
|
|
|
#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpDisplayClass GimpDisplayClass;
|
|
|
|
|
|
|
|
struct _GimpDisplay
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-09-26 01:44:03 +08:00
|
|
|
GimpObject parent_instance;
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GtkWidget *shell; /* shell widget for this gdisplay */
|
|
|
|
GimpImage *gimage; /* pointer to the associated gimage struct */
|
|
|
|
/*
|
|
|
|
* these need to be first in the sturuct
|
|
|
|
* because of an ugly hack in
|
|
|
|
* core/gimpcontext.c
|
|
|
|
*/
|
|
|
|
|
2000-02-10 22:23:11 +08:00
|
|
|
gint ID; /* unique identifier for this gdisplay */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-21 00:27:44 +08:00
|
|
|
GtkItemFactory *ifactory; /* factory for popup menu */
|
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
GtkWidget *canvas; /* canvas widget for this gdisplay */
|
2001-06-18 21:10:03 +08:00
|
|
|
GtkWidget *hsb; /* widgets for scroll bars */
|
|
|
|
GtkWidget *vsb;
|
2001-05-14 01:25:12 +08:00
|
|
|
GtkWidget *qmaskoff; /* widgets for qmask buttons */
|
|
|
|
GtkWidget *qmaskon;
|
|
|
|
GtkWidget *hrule; /* widgets for rulers */
|
|
|
|
GtkWidget *vrule;
|
|
|
|
GtkWidget *origin; /* widgets for rulers */
|
|
|
|
GtkWidget *statusarea; /* hbox holding the statusbar and stuff */
|
|
|
|
GtkWidget *statusbar; /* widget for statusbar */
|
|
|
|
GtkWidget *progressbar; /* widget for progressbar */
|
|
|
|
GtkWidget *cursor_label; /* widget for cursor position */
|
|
|
|
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
|
|
|
/* we need a variable format string because
|
|
|
|
* different units have different number
|
|
|
|
* of decimals
|
|
|
|
*/
|
|
|
|
GtkWidget *cancelbutton; /* widget for cancel button */
|
|
|
|
guint progressid; /* id of statusbar message for progress */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
InfoDialog *window_info_dialog; /* dialog box for image information */
|
|
|
|
NavigationDialog *window_nav_dialog; /* dialog box for image navigation */
|
|
|
|
NavigationDialog *nav_popup; /* the popup navigation window */
|
|
|
|
GtkWidget *warning_dialog; /* "Changes were made to %s. Close anyway?" */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
GtkAdjustment *hsbdata; /* horizontal data information */
|
|
|
|
GtkAdjustment *vsbdata; /* vertical data information */
|
|
|
|
|
2001-02-20 23:15:30 +08:00
|
|
|
GdkPixmap *icon; /* Pixmap for the icon */
|
|
|
|
GdkBitmap *iconmask; /* Bitmap for the icon mask */
|
|
|
|
guint iconsize; /* The size of the icon pixmap */
|
2001-06-18 21:10:03 +08:00
|
|
|
gboolean icon_needs_update; /* Do we need to render a new icon? */
|
|
|
|
guint icon_timeout_id; /* The ID of the timeout-function */
|
|
|
|
guint icon_idle_id; /* The ID of the idle-function */
|
2001-02-20 23:15:30 +08:00
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
gint instance; /* the instance # of this gdisplay as */
|
1997-11-25 06:05:25 +08:00
|
|
|
/* taken from the gimage at creation */
|
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
gint disp_width; /* width of drawing area in the window */
|
|
|
|
gint disp_height; /* height of drawing area in the window */
|
|
|
|
gint disp_xoffset;
|
|
|
|
gint disp_yoffset;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
gint offset_x; /* offset of display image into raw image */
|
|
|
|
gint offset_y;
|
|
|
|
gint scale; /* scale factor from original raw image */
|
|
|
|
gboolean dot_for_dot; /* is monitor resolution being ignored? */
|
|
|
|
gboolean draw_guides; /* should the guides be drawn? */
|
|
|
|
gboolean snap_to_guides; /* should the guides be snapped to? */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
Selection *select; /* Selection object */
|
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
GdkGC *scroll_gc; /* GC for scrolling */
|
1997-12-18 14:30:11 +08:00
|
|
|
|
2001-05-14 01:25:12 +08:00
|
|
|
GSList *update_areas; /* Update areas list */
|
|
|
|
GSList *display_areas; /* Display areas list */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-25 03:29:47 +08:00
|
|
|
GdkCursorType current_cursor; /* Currently installed main cursor */
|
|
|
|
GimpToolCursorType tool_cursor; /* Current Tool cursor */
|
|
|
|
GimpCursorModifier cursor_modifier; /* Cursor modifier (plus, minus, ...) */
|
1999-05-13 19:12:32 +08:00
|
|
|
|
1999-01-11 07:36:29 +08:00
|
|
|
GdkCursorType override_cursor; /* Overriding cursor (ie. hourglass) */
|
2000-06-09 20:31:19 +08:00
|
|
|
gboolean using_override_cursor; /* is the cursor overridden? (ie. hourglass)*/
|
1998-06-06 11:49:01 +08:00
|
|
|
|
2000-02-10 22:23:11 +08:00
|
|
|
gboolean draw_cursor; /* should we draw software cursor ? */
|
2001-02-25 03:29:47 +08:00
|
|
|
gint cursor_x; /* software cursor X value */
|
|
|
|
gint cursor_y; /* software cursor Y value */
|
2000-02-10 22:23:11 +08:00
|
|
|
gboolean proximity; /* is a device in proximity of gdisplay ? */
|
|
|
|
gboolean have_cursor; /* is cursor currently drawn ? */
|
2001-05-14 01:25:12 +08:00
|
|
|
|
1998-10-01 19:53:20 +08:00
|
|
|
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */
|
2001-05-14 01:25:12 +08:00
|
|
|
|
2000-12-25 04:27:04 +08:00
|
|
|
#ifdef DISPLAY_FILTERS
|
2000-06-09 20:31:19 +08:00
|
|
|
GList *cd_list; /* color display conversion stuff */
|
2000-01-03 15:49:19 +08:00
|
|
|
GtkWidget *cd_ui; /* color display filter dialog */
|
2000-12-25 04:27:04 +08:00
|
|
|
#endif /* DISPLAY_FILTERS */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2001-09-26 01:44:03 +08:00
|
|
|
struct _GimpDisplayClass
|
|
|
|
{
|
|
|
|
GimpObjectClass parent_class;
|
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* member function declarations */
|
|
|
|
|
2001-09-26 01:44:03 +08:00
|
|
|
GType gimp_display_get_type (void);
|
|
|
|
|
|
|
|
GimpDisplay * gdisplay_new (GimpImage *gimage,
|
|
|
|
guint scale);
|
|
|
|
void gdisplay_reconnect (GimpDisplay *gdisp,
|
|
|
|
GimpImage *gimage);
|
|
|
|
void gdisplay_remove_and_delete (GimpDisplay *gdisp);
|
|
|
|
gint gdisplay_mask_value (GimpDisplay *gdisp,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
gint gdisplay_mask_bounds (GimpDisplay *gdisp,
|
|
|
|
gint *x1,
|
|
|
|
gint *y1,
|
|
|
|
gint *x2,
|
|
|
|
gint *y2);
|
|
|
|
void gdisplay_transform_coords (GimpDisplay *gdisp,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint *nx,
|
|
|
|
gint *ny,
|
|
|
|
gboolean use_offsets);
|
|
|
|
void gdisplay_untransform_coords (GimpDisplay *gdisp,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint *nx,
|
|
|
|
gint *ny,
|
|
|
|
gboolean round,
|
|
|
|
gboolean use_offsets);
|
|
|
|
void gdisplay_transform_coords_f (GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gdouble *nx,
|
|
|
|
gdouble *ny,
|
|
|
|
gboolean use_offsets);
|
|
|
|
void gdisplay_untransform_coords_f (GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gdouble *nx,
|
|
|
|
gdouble *ny,
|
|
|
|
gboolean use_offsets);
|
|
|
|
|
|
|
|
void gdisplay_real_install_tool_cursor (GimpDisplay *gdisp,
|
|
|
|
GdkCursorType cursor_type,
|
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier,
|
|
|
|
gboolean always_install);
|
|
|
|
void gdisplay_install_tool_cursor (GimpDisplay *gdisp,
|
|
|
|
GdkCursorType cursor_type,
|
|
|
|
GimpToolCursorType tool_cursor,
|
|
|
|
GimpCursorModifier modifier);
|
|
|
|
void gdisplay_remove_tool_cursor (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_install_override_cursor (GimpDisplay *gdisp,
|
|
|
|
GdkCursorType cursor_type);
|
|
|
|
void gdisplay_remove_override_cursor (GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
void gdisplay_set_menu_sensitivity (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_expose_area (GimpDisplay *gdisp,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
void gdisplay_expose_guide (GimpDisplay *gdisp,
|
|
|
|
GimpGuide *guide);
|
|
|
|
void gdisplay_expose_full (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_selection_visibility (GimpDisplay *gdisp,
|
|
|
|
GimpSelectionControl control);
|
|
|
|
void gdisplay_flush (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_flush_now (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_update_icon (GimpDisplay *gdisp);
|
|
|
|
gboolean gdisplay_update_icon_timer (gpointer data);
|
|
|
|
gboolean gdisplay_update_icon_invoker (gpointer data);
|
|
|
|
void gdisplay_update_icon_scheduler (GimpImage *gimage,
|
|
|
|
gpointer data);
|
|
|
|
void gdisplay_draw_guides (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_draw_guide (GimpDisplay *gdisp,
|
|
|
|
GimpGuide *guide,
|
|
|
|
gboolean active);
|
|
|
|
GimpGuide * gdisplay_find_guide (GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
double y);
|
|
|
|
gboolean gdisplay_snap_point (GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
gdouble *tx,
|
|
|
|
gdouble *ty);
|
|
|
|
void gdisplay_snap_rectangle (GimpDisplay *gdisp,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2,
|
|
|
|
gdouble *tx1,
|
|
|
|
gdouble *ty1);
|
|
|
|
void gdisplay_update_cursor (GimpDisplay *gdisp,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
void gdisplay_set_dot_for_dot (GimpDisplay *gdisp,
|
|
|
|
gboolean dot_for_dot);
|
|
|
|
void gdisplay_resize_cursor_label (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_update_title (GimpDisplay *gdisp);
|
|
|
|
void gdisplay_flush_displays_only (GimpDisplay *gdisp); /* no rerender! */
|
|
|
|
|
|
|
|
GimpDisplay * gdisplay_active (void);
|
|
|
|
GimpDisplay * gdisplay_get_by_ID (Gimp *gimp,
|
|
|
|
gint ID);
|
2000-03-21 11:19:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* function declarations */
|
|
|
|
|
2001-09-26 01:44:03 +08:00
|
|
|
GimpDisplay * gdisplays_check_valid (GimpDisplay *gdisp,
|
|
|
|
GimpImage *gimage);
|
|
|
|
void gdisplays_reconnect (GimpImage *old,
|
|
|
|
GimpImage *new);
|
|
|
|
void gdisplays_update_title (GimpImage *gimage);
|
|
|
|
void gdisplays_resize_cursor_label (GimpImage *gimage);
|
|
|
|
void gdisplays_setup_scale (GimpImage *gimage);
|
|
|
|
void gdisplays_update_area (GimpImage *gimage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
void gdisplays_expose_guides (GimpImage *gimage);
|
|
|
|
void gdisplays_expose_guide (GimpImage *gimage,
|
|
|
|
GimpGuide *guide);
|
|
|
|
void gdisplays_update_full (GimpImage *gimage);
|
|
|
|
void gdisplays_shrink_wrap (GimpImage *gimage);
|
|
|
|
void gdisplays_expose_full (void);
|
|
|
|
void gdisplays_selection_visibility (GimpImage *gimage,
|
|
|
|
GimpSelectionControl control);
|
|
|
|
gboolean gdisplays_dirty (void);
|
|
|
|
void gdisplays_delete (void);
|
|
|
|
void gdisplays_flush (void);
|
|
|
|
void gdisplays_flush_now (void);
|
|
|
|
void gdisplays_finish_draw (void);
|
|
|
|
void gdisplays_nav_preview_resized (void);
|
|
|
|
void gdisplays_foreach (GFunc func,
|
|
|
|
gpointer user_data);
|
2001-05-14 01:25:12 +08:00
|
|
|
|
1998-09-27 04:07:46 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif /* __GDISPLAY_H__ */
|