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
|
|
|
*/
|
|
|
|
#ifndef __GDISPLAY_H__
|
|
|
|
#define __GDISPLAY_H__
|
|
|
|
|
|
|
|
#include "gimage.h"
|
|
|
|
#include "info_dialog.h"
|
|
|
|
#include "selection.h"
|
|
|
|
|
1998-08-16 08:34:20 +08:00
|
|
|
#include "gdisplayF.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/*
|
|
|
|
* Global variables
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* 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) */
|
1998-12-06 05:48:37 +08:00
|
|
|
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : monitor_xres)
|
|
|
|
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : monitor_yres)
|
|
|
|
|
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
|
|
|
|
1998-10-01 19:53:20 +08:00
|
|
|
typedef struct _IdleRenderStruct
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int basex;
|
|
|
|
int basey;
|
|
|
|
guint idleid;
|
1998-10-04 04:14:00 +08:00
|
|
|
/*guint handlerid;*/
|
1998-10-01 19:53:20 +08:00
|
|
|
gboolean active;
|
1998-10-02 00:22:28 +08:00
|
|
|
GSList *update_areas; /* flushed update areas */
|
1998-10-01 19:53:20 +08:00
|
|
|
|
|
|
|
} IdleRenderStruct;
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _GDisplay
|
|
|
|
{
|
|
|
|
int ID; /* unique identifier for this gdisplay */
|
|
|
|
|
|
|
|
GtkWidget *shell; /* shell widget for this gdisplay */
|
|
|
|
GtkWidget *canvas; /* canvas widget for this gdisplay */
|
|
|
|
GtkWidget *hsb, *vsb; /* widgets for scroll bars */
|
1999-07-07 11:18:54 +08:00
|
|
|
GtkWidget *qmaskoff, *qmaskon; /* widgets for qmask buttons */
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *hrule, *vrule; /* widgets for rulers */
|
|
|
|
GtkWidget *origin; /* widgets for rulers */
|
|
|
|
GtkWidget *popup; /* widget for popup menu */
|
1998-10-01 19:53:20 +08:00
|
|
|
GtkWidget *statusarea; /* hbox holding the statusbar and stuff */
|
1998-06-15 10:25:27 +08:00
|
|
|
GtkWidget *statusbar; /* widget for statusbar */
|
|
|
|
GtkWidget *progressbar; /* widget for progressbar */
|
1998-07-16 11:23:14 +08:00
|
|
|
GtkWidget *cursor_label; /* widget for cursor position */
|
1999-02-28 02:09:56 +08:00
|
|
|
char cursor_format_str [CURSOR_FORMAT_LENGTH]; /* we need a variable format
|
|
|
|
* string because different
|
|
|
|
* units have different number
|
|
|
|
* of decimals */
|
1998-07-12 23:18:07 +08:00
|
|
|
GtkWidget *cancelbutton; /* widget for cancel button */
|
1998-06-15 10:25:27 +08:00
|
|
|
guint progressid; /* id of statusbar message for progress */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
InfoDialog *window_info_dialog; /* dialog box for image information */
|
1999-08-13 06:21:04 +08:00
|
|
|
InfoDialog *window_nav_dialog; /* dialog box for image navigation */
|
1999-09-02 06:39:44 +08:00
|
|
|
GtkWidget *nav_popup; /* widget for the popup navigation window */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
int color_type; /* is this an RGB or GRAY colormap */
|
|
|
|
|
|
|
|
GtkAdjustment *hsbdata; /* horizontal data information */
|
|
|
|
GtkAdjustment *vsbdata; /* vertical data information */
|
|
|
|
|
1998-06-29 08:24:44 +08:00
|
|
|
GimpImage *gimage; /* pointer to the associated gimage struct */
|
1997-11-25 06:05:25 +08:00
|
|
|
int instance; /* the instance # of this gdisplay as */
|
|
|
|
/* taken from the gimage at creation */
|
|
|
|
|
|
|
|
int depth; /* depth of our drawables */
|
|
|
|
int disp_width; /* width of drawing area in the window */
|
|
|
|
int disp_height; /* height of drawing area in the window */
|
|
|
|
int disp_xoffset;
|
|
|
|
int disp_yoffset;
|
|
|
|
|
|
|
|
int offset_x, offset_y; /* offset of display image into raw image */
|
|
|
|
int scale; /* scale factor from original raw image */
|
1998-12-06 05:48:37 +08:00
|
|
|
int dot_for_dot; /* is monitor resolution being ignored? */
|
1997-11-25 06:05:25 +08:00
|
|
|
short draw_guides; /* should the guides be drawn? */
|
|
|
|
short snap_to_guides; /* should the guides be snapped to? */
|
|
|
|
|
|
|
|
Selection *select; /* Selection object */
|
|
|
|
|
1998-10-01 19:53:20 +08:00
|
|
|
GdkGC *scroll_gc; /* GC for scrolling */
|
1997-12-18 14:30:11 +08:00
|
|
|
|
1998-01-29 16:03:27 +08:00
|
|
|
GSList *update_areas; /* Update areas list */
|
|
|
|
GSList *display_areas; /* Display areas list */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-05-05 17:10:35 +08:00
|
|
|
int current_cursor; /* Currently installed cursor */
|
1999-05-13 19:12:32 +08:00
|
|
|
|
1999-01-11 07:36:29 +08:00
|
|
|
GdkCursorType override_cursor; /* Overriding cursor (ie. hourglass) */
|
1998-06-06 11:49:01 +08:00
|
|
|
|
1999-01-11 07:36:29 +08:00
|
|
|
short draw_cursor; /* should we draw software cursor ? */
|
|
|
|
short using_override_cursor; /* is the cursor overridden? (ie. hourglass)*/
|
1998-10-01 19:53:20 +08:00
|
|
|
int cursor_x; /* software cursor X value */
|
|
|
|
int cursor_y; /* software cursor Y value */
|
1999-01-11 07:36:29 +08:00
|
|
|
short proximity; /* is a device in proximity of gdisplay ? */
|
1998-10-01 19:53:20 +08:00
|
|
|
short have_cursor; /* is cursor currently drawn ? */
|
1999-07-07 11:18:54 +08:00
|
|
|
|
1998-10-01 19:53:20 +08:00
|
|
|
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */
|
1999-07-29 07:00:08 +08:00
|
|
|
|
1999-08-29 06:40:37 +08:00
|
|
|
GList *cd_list; /* color display conversion stuff */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* member function declarations */
|
|
|
|
|
1998-06-29 08:24:44 +08:00
|
|
|
GDisplay * gdisplay_new (GimpImage *, unsigned int);
|
1999-01-12 09:31:49 +08:00
|
|
|
void gdisplay_reconnect (GDisplay *, GimpImage *);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplay_remove_and_delete (GDisplay *);
|
|
|
|
int gdisplay_mask_value (GDisplay *, int, int);
|
|
|
|
int gdisplay_mask_bounds (GDisplay *, int *, int *, int *, int *);
|
|
|
|
void gdisplay_transform_coords (GDisplay *, int, int, int *, int *, int);
|
|
|
|
void gdisplay_untransform_coords (GDisplay *, int, int, int *,
|
|
|
|
int *, int, int);
|
|
|
|
void gdisplay_transform_coords_f (GDisplay *, double, double, double *,
|
|
|
|
double *, int);
|
|
|
|
void gdisplay_untransform_coords_f (GDisplay *, double, double, double *,
|
|
|
|
double *, int);
|
|
|
|
void gdisplay_install_tool_cursor (GDisplay *, GdkCursorType);
|
1999-05-05 17:10:35 +08:00
|
|
|
void gdisplay_install_gimp_tool_cursor (GDisplay *, int);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplay_remove_tool_cursor (GDisplay *);
|
1999-01-11 07:36:29 +08:00
|
|
|
void gdisplay_install_override_cursor(GDisplay *, GdkCursorType);
|
|
|
|
void gdisplay_remove_override_cursor (GDisplay *);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplay_set_menu_sensitivity (GDisplay *);
|
|
|
|
void gdisplay_expose_area (GDisplay *, int, int, int, int);
|
|
|
|
void gdisplay_expose_guide (GDisplay *, Guide *);
|
|
|
|
void gdisplay_expose_full (GDisplay *);
|
|
|
|
void gdisplay_flush (GDisplay *);
|
1998-10-04 04:14:00 +08:00
|
|
|
void gdisplay_flush_now (GDisplay *);
|
1999-01-18 06:50:14 +08:00
|
|
|
void gdisplays_finish_draw (void);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplay_draw_guides (GDisplay *);
|
|
|
|
void gdisplay_draw_guide (GDisplay *, Guide *, int);
|
|
|
|
Guide* gdisplay_find_guide (GDisplay *, int, int);
|
1998-06-06 11:49:01 +08:00
|
|
|
void gdisplay_snap_point (GDisplay *, double , double, double *, double *);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplay_snap_rectangle (GDisplay *, int, int, int, int, int *, int *);
|
1998-06-06 11:49:01 +08:00
|
|
|
void gdisplay_update_cursor (GDisplay *, int, int);
|
1998-12-06 05:48:37 +08:00
|
|
|
void gdisplay_set_dot_for_dot (GDisplay *, int);
|
1998-11-20 04:20:46 +08:00
|
|
|
void gdisplay_resize_cursor_label (GDisplay *);
|
1999-03-06 07:50:24 +08:00
|
|
|
GDisplay * gdisplays_check_valid (GDisplay *, GimpImage *);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* function declarations */
|
|
|
|
|
|
|
|
GDisplay * gdisplay_active (void);
|
|
|
|
GDisplay * gdisplay_get_ID (int);
|
1999-02-07 02:31:33 +08:00
|
|
|
void gdisplay_update_title (GDisplay*);
|
1998-06-29 08:24:44 +08:00
|
|
|
void gdisplays_update_title (GimpImage*);
|
1998-12-14 02:52:34 +08:00
|
|
|
void gdisplays_resize_cursor_label (GimpImage*);
|
1998-06-29 08:24:44 +08:00
|
|
|
void gdisplays_update_area (GimpImage*, int, int, int, int);
|
|
|
|
void gdisplays_expose_guides (GimpImage*);
|
|
|
|
void gdisplays_expose_guide (GimpImage*, Guide *);
|
|
|
|
void gdisplays_update_full (GimpImage*);
|
|
|
|
void gdisplays_shrink_wrap (GimpImage*);
|
1997-11-25 06:05:25 +08:00
|
|
|
void gdisplays_expose_full (void);
|
1998-06-29 08:24:44 +08:00
|
|
|
void gdisplays_selection_visibility (GimpImage*, SelectionControl);
|
1997-11-25 06:05:25 +08:00
|
|
|
int gdisplays_dirty (void);
|
|
|
|
void gdisplays_delete (void);
|
|
|
|
void gdisplays_flush (void);
|
1998-10-02 00:22:28 +08:00
|
|
|
void gdisplays_flush_now (void);
|
1999-03-21 06:05:24 +08:00
|
|
|
void gdisplay_flush_displays_only (GDisplay *gdisp); /* no rerender! */
|
1999-09-05 06:27:20 +08:00
|
|
|
void gdisplays_nav_preview_resized (void);
|
1999-03-21 06:05:24 +08:00
|
|
|
|
1998-09-27 04:07:46 +08:00
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif /* __GDISPLAY_H__ */
|