2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#ifndef __GIMP_DISPLAY_SHELL_H__
|
|
|
|
#define __GIMP_DISPLAY_SHELL_H__
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#include <gtk/gtkwindow.h>
|
1999-03-12 11:44:59 +08:00
|
|
|
|
2005-09-26 01:03:03 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2004-03-21 05:59:41 +08:00
|
|
|
/* Apply to a float the same rounding mode used in the renderer */
|
2004-06-02 06:04:20 +08:00
|
|
|
#define PROJ_ROUND(coord) ((gint) ceil (coord))
|
2004-03-21 05:59:41 +08:00
|
|
|
|
2002-06-27 06:16:59 +08:00
|
|
|
/* finding the effective screen resolution (double) */
|
2005-09-26 01:03:03 +08:00
|
|
|
#define SCREEN_XRES(s) ((s)->dot_for_dot ? \
|
2006-03-29 01:55:52 +08:00
|
|
|
(s)->display->image->xresolution : (s)->monitor_xres)
|
2005-09-26 01:03:03 +08:00
|
|
|
#define SCREEN_YRES(s) ((s)->dot_for_dot ? \
|
2006-03-29 01:55:52 +08:00
|
|
|
(s)->display->image->yresolution : (s)->monitor_yres)
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
/* calculate scale factors (double) */
|
2005-09-26 01:03:03 +08:00
|
|
|
#define SCALEFACTOR_X(s) (gimp_zoom_model_get_factor ((s)->zoom) \
|
2006-03-29 01:55:52 +08:00
|
|
|
* SCREEN_XRES(s) / (s)->display->image->xresolution)
|
2005-09-26 01:03:03 +08:00
|
|
|
#define SCALEFACTOR_Y(s) (gimp_zoom_model_get_factor ((s)->zoom) \
|
2006-03-29 01:55:52 +08:00
|
|
|
* SCREEN_YRES(s) / (s)->display->image->yresolution)
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
/* scale values */
|
2005-09-26 01:03:03 +08:00
|
|
|
#define SCALEX(s,x) PROJ_ROUND ((x) * SCALEFACTOR_X(s))
|
|
|
|
#define SCALEY(s,y) PROJ_ROUND ((y) * SCALEFACTOR_Y(s))
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
/* unscale values */
|
2005-09-26 01:03:03 +08:00
|
|
|
#define UNSCALEX(s,x) ((gint) ((x) / SCALEFACTOR_X(s)))
|
|
|
|
#define UNSCALEY(s,y) ((gint) ((y) / SCALEFACTOR_Y(s)))
|
2002-06-27 06:16:59 +08:00
|
|
|
/* (and float-returning versions) */
|
2005-09-26 01:03:03 +08:00
|
|
|
#define FUNSCALEX(s,x) ((x) / SCALEFACTOR_X(s))
|
|
|
|
#define FUNSCALEY(s,y) ((y) / SCALEFACTOR_Y(s))
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#define GIMP_TYPE_DISPLAY_SHELL (gimp_display_shell_get_type ())
|
|
|
|
#define GIMP_DISPLAY_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShell))
|
|
|
|
#define GIMP_DISPLAY_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShellClass))
|
|
|
|
#define GIMP_IS_DISPLAY_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY_SHELL))
|
|
|
|
#define GIMP_IS_DISPLAY_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY_SHELL))
|
|
|
|
#define GIMP_DISPLAY_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShellClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpDisplayShellClass GimpDisplayShellClass;
|
|
|
|
|
|
|
|
struct _GimpDisplayShell
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GtkWindow parent_instance;
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2004-04-22 00:33:17 +08:00
|
|
|
GimpUIManager *menubar_manager;
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpUIManager *popup_manager;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2002-11-24 06:22:21 +08:00
|
|
|
gdouble monitor_xres;
|
|
|
|
gdouble monitor_yres;
|
|
|
|
|
2004-06-02 06:04:20 +08:00
|
|
|
GimpUnit unit;
|
|
|
|
|
2005-09-26 01:03:03 +08:00
|
|
|
GimpZoomModel *zoom;
|
2004-01-30 06:22:29 +08:00
|
|
|
gdouble other_scale; /* scale factor entered in Zoom->Other */
|
2002-06-27 06:16:59 +08:00
|
|
|
gboolean dot_for_dot; /* is monitor resolution being ignored? */
|
|
|
|
|
2001-11-02 17:31:21 +08:00
|
|
|
gint offset_x; /* offset of display image into raw image */
|
|
|
|
gint offset_y;
|
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
gint disp_width; /* width of drawing area */
|
|
|
|
gint disp_height; /* height of drawing area */
|
2001-11-02 17:31:21 +08:00
|
|
|
gint disp_xoffset;
|
|
|
|
gint disp_yoffset;
|
|
|
|
|
2004-06-23 00:31:27 +08:00
|
|
|
gboolean proximity; /* is a device in proximity */
|
2003-03-20 19:31:33 +08:00
|
|
|
gboolean snap_to_guides; /* should the guides be snapped to? */
|
2003-06-24 03:34:48 +08:00
|
|
|
gboolean snap_to_grid; /* should the grid be snapped to? */
|
2005-01-04 00:19:10 +08:00
|
|
|
gboolean snap_to_canvas; /* should the canvas be snapped to? */
|
|
|
|
gboolean snap_to_vectors; /* should the active path be snapped */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2006-09-05 01:18:38 +08:00
|
|
|
Selection *selection; /* Selection (marching ants) */
|
2001-11-11 07:03:22 +08:00
|
|
|
|
2003-11-10 07:24:40 +08:00
|
|
|
GtkWidget *canvas; /* GimpCanvas widget */
|
2004-04-04 23:53:21 +08:00
|
|
|
GdkGC *grid_gc; /* GC for grid drawing */
|
2005-08-06 19:18:26 +08:00
|
|
|
GdkGC *pen_gc; /* GC for felt pen drawing */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2004-06-23 00:31:27 +08:00
|
|
|
GtkAdjustment *hsbdata; /* adjustments */
|
|
|
|
GtkAdjustment *vsbdata;
|
2003-03-20 19:31:33 +08:00
|
|
|
GtkWidget *hsb; /* scroll bars */
|
2001-11-01 05:20:09 +08:00
|
|
|
GtkWidget *vsb;
|
2004-06-23 00:31:27 +08:00
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
GtkWidget *hrule; /* rulers */
|
2001-11-01 05:20:09 +08:00
|
|
|
GtkWidget *vrule;
|
2004-06-23 00:31:27 +08:00
|
|
|
|
|
|
|
GtkWidget *origin_button; /* NW: origin button */
|
2005-09-19 20:44:06 +08:00
|
|
|
GtkWidget *quick_mask_button; /* SW: quick mask button */
|
2004-06-23 00:31:27 +08:00
|
|
|
GtkWidget *zoom_button; /* NE: zoom toggle button */
|
|
|
|
GtkWidget *nav_ebox; /* SE: navigation event box */
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-05-17 21:38:03 +08:00
|
|
|
GtkWidget *menubar; /* menubar */
|
2003-03-20 19:31:33 +08:00
|
|
|
GtkWidget *statusbar; /* statusbar */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2001-12-01 02:23:49 +08:00
|
|
|
guchar *render_buf; /* buffer for rendering the image */
|
2004-06-23 00:31:27 +08:00
|
|
|
|
2003-02-26 03:01:10 +08:00
|
|
|
guint title_idle_id; /* title update idle ID */
|
2002-02-07 19:33:01 +08:00
|
|
|
|
2001-12-03 21:44:59 +08:00
|
|
|
gint icon_size; /* size of the icon pixmap */
|
2001-11-16 23:08:59 +08:00
|
|
|
guint icon_idle_id; /* ID of the idle-function */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2004-06-14 18:19:39 +08:00
|
|
|
GimpCursorFormat cursor_format; /* Currently used cursor format */
|
|
|
|
GimpCursorType current_cursor; /* Currently installed main cursor */
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpToolCursorType tool_cursor; /* Current Tool cursor */
|
|
|
|
GimpCursorModifier cursor_modifier; /* Cursor modifier (plus, minus, ...) */
|
|
|
|
|
2004-06-14 18:19:39 +08:00
|
|
|
GimpCursorType override_cursor; /* Overriding cursor */
|
2001-12-03 21:44:59 +08:00
|
|
|
gboolean using_override_cursor; /* is the cursor overridden? */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2001-12-03 21:44:59 +08:00
|
|
|
gboolean draw_cursor; /* should we draw software cursor ? */
|
|
|
|
gboolean have_cursor; /* is cursor currently drawn ? */
|
2001-11-16 23:08:59 +08:00
|
|
|
gint cursor_x; /* software cursor X value */
|
|
|
|
gint cursor_y; /* software cursor Y value */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2004-07-14 18:31:59 +08:00
|
|
|
GtkWidget *close_dialog; /* close dialog */
|
2003-04-04 16:32:51 +08:00
|
|
|
GtkWidget *scale_dialog; /* scale (zoom) dialog */
|
2002-05-08 00:23:14 +08:00
|
|
|
GtkWidget *nav_popup; /* navigation popup */
|
2003-06-24 03:34:48 +08:00
|
|
|
GtkWidget *grid_dialog; /* grid configuration dialog */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2004-07-14 18:31:59 +08:00
|
|
|
GimpColorDisplayStack *filter_stack; /* color display conversion stuff */
|
2003-11-22 06:52:36 +08:00
|
|
|
guint filter_idle_id;
|
2004-07-14 18:31:59 +08:00
|
|
|
GtkWidget *filters_dialog; /* color display filter dialog */
|
2002-05-16 00:28:41 +08:00
|
|
|
|
2003-09-12 06:24:30 +08:00
|
|
|
gint paused_count;
|
|
|
|
|
|
|
|
GQuark vectors_freeze_handler;
|
|
|
|
GQuark vectors_thaw_handler;
|
|
|
|
GQuark vectors_visible_handler;
|
2003-10-14 19:14:28 +08:00
|
|
|
|
2004-06-23 00:31:27 +08:00
|
|
|
GdkWindowState window_state; /* for fullscreen display */
|
|
|
|
gboolean zoom_on_resize;
|
|
|
|
gboolean show_transform_preview;
|
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
GimpDisplayOptions *fullscreen_options;
|
2003-10-14 19:14:28 +08:00
|
|
|
|
|
|
|
/* the state of gimp_display_shell_tool_events() */
|
|
|
|
gboolean space_pressed;
|
|
|
|
gboolean space_release_pending;
|
2006-09-08 21:42:00 +08:00
|
|
|
const gchar *space_shaded_tool;
|
2003-10-14 19:14:28 +08:00
|
|
|
gboolean scrolling;
|
|
|
|
gint scroll_start_x;
|
|
|
|
gint scroll_start_y;
|
|
|
|
gboolean button_press_before_focus;
|
2004-07-29 21:21:55 +08:00
|
|
|
guint32 last_motion_time;
|
2004-10-01 17:50:04 +08:00
|
|
|
|
|
|
|
GdkRectangle *highlight; /* in image coordinates, can be NULL */
|
2005-07-31 06:29:02 +08:00
|
|
|
GimpDrawable *mask;
|
2006-03-17 21:27:08 +08:00
|
|
|
GimpChannelType mask_color;
|
2005-07-31 02:19:54 +08:00
|
|
|
|
2005-01-03 04:42:31 +08:00
|
|
|
gpointer scroll_info;
|
2001-10-13 20:52:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GimpDisplayShellClass
|
|
|
|
{
|
|
|
|
GtkWindowClass parent_class;
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2002-09-28 00:17:31 +08:00
|
|
|
void (* scaled) (GimpDisplayShell *shell);
|
|
|
|
void (* scrolled) (GimpDisplayShell *shell);
|
|
|
|
void (* reconnect) (GimpDisplayShell *shell);
|
2001-10-13 20:52:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-09-05 01:18:38 +08:00
|
|
|
GType gimp_display_shell_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
GtkWidget * gimp_display_shell_new (GimpDisplay *display,
|
|
|
|
GimpUnit unit,
|
|
|
|
gdouble scale,
|
|
|
|
GimpMenuFactory *menu_factory,
|
|
|
|
GimpUIManager *popup_manager);
|
|
|
|
|
|
|
|
void gimp_display_shell_reconnect (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_scaled (GimpDisplayShell *shell);
|
|
|
|
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_set_unit (GimpDisplayShell *shell,
|
|
|
|
GimpUnit unit);
|
|
|
|
GimpUnit gimp_display_shell_get_unit (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
gboolean gimp_display_shell_snap_coords (GimpDisplayShell *shell,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GimpCoords *snapped_coords,
|
|
|
|
gint snap_offset_x,
|
|
|
|
gint snap_offset_y,
|
|
|
|
gint snap_width,
|
|
|
|
gint snap_height);
|
|
|
|
|
|
|
|
gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
|
|
|
|
gint *x1,
|
|
|
|
gint *y1,
|
|
|
|
gint *x2,
|
|
|
|
gint *y2);
|
|
|
|
|
|
|
|
void gimp_display_shell_expose_area (GimpDisplayShell *shell,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
void gimp_display_shell_expose_guide (GimpDisplayShell *shell,
|
|
|
|
GimpGuide *guide);
|
|
|
|
void gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
|
|
|
|
GimpSamplePoint *sample_point);
|
|
|
|
void gimp_display_shell_expose_full (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_flush (GimpDisplayShell *shell,
|
|
|
|
gboolean now);
|
|
|
|
|
|
|
|
void gimp_display_shell_pause (GimpDisplayShell *shell);
|
|
|
|
void gimp_display_shell_resume (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_shrink_wrap (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
void gimp_display_shell_set_highlight (GimpDisplayShell *shell,
|
|
|
|
const GdkRectangle *highlight);
|
|
|
|
void gimp_display_shell_set_mask (GimpDisplayShell *shell,
|
|
|
|
GimpDrawable *mask,
|
|
|
|
GimpChannelType color);
|
2005-07-31 18:40:54 +08:00
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
|
|
|
|
#endif /* __GIMP_DISPLAY_SHELL_H__ */
|