1999-08-22 19:45:31 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
1998-06-28 18:39:58 +08:00
|
|
|
#ifndef __GIMPIMAGEP_H__
|
|
|
|
#define __GIMPIMAGEP_H__
|
|
|
|
|
|
|
|
#include "gimpobjectP.h"
|
1998-06-30 09:14:36 +08:00
|
|
|
#include "gimpimage.h"
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
#include "tile_manager.h"
|
|
|
|
#include "temp_buf.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "layer.h"
|
1998-10-30 18:21:33 +08:00
|
|
|
#include "parasitelistF.h"
|
1999-03-06 07:50:24 +08:00
|
|
|
#include "pathsP.h"
|
Honest, guv, it's not a feature - it's a tightly integrated package of
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
1999-09-21 01:15:20 +08:00
|
|
|
#include "undo_types.h"
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
#define MAX_CHANNELS 4
|
|
|
|
|
|
|
|
struct _GimpImage
|
|
|
|
{
|
|
|
|
GimpObject gobject;
|
1999-08-22 19:45:31 +08:00
|
|
|
|
|
|
|
gchar *filename; /* original filename */
|
|
|
|
gboolean has_filename; /* has a valid filename */
|
1998-10-27 17:26:38 +08:00
|
|
|
PlugInProcDef *save_proc; /* last PDB save proc used */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gint width, height; /* width and height attributes */
|
|
|
|
gdouble xresolution; /* image x-res, in dpi */
|
|
|
|
gdouble yresolution; /* image y-res, in dpi */
|
|
|
|
GUnit unit; /* image unit */
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
GimpImageBaseType base_type; /* base gimp_image type */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
guchar *cmap; /* colormap--for indexed */
|
|
|
|
int num_cols; /* number of cols--for indexed */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gint dirty; /* dirty flag -- # of ops */
|
|
|
|
gboolean undo_on; /* Is undo enabled? */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gint instance_count; /* number of instances */
|
|
|
|
gint ref_count; /* number of references */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
Tattoo tattoo_state; /* the next unique tattoo to use*/
|
1998-10-14 10:54:02 +08:00
|
|
|
|
1998-06-28 18:39:58 +08:00
|
|
|
TileManager *shadow; /* shadow buffer tiles */
|
|
|
|
|
|
|
|
/* Projection attributes */
|
1999-08-22 19:45:31 +08:00
|
|
|
gint construct_flag; /* flag for construction */
|
|
|
|
GimpImageType proj_type; /* type of the projection image */
|
|
|
|
gint proj_bytes; /* bpp in projection image */
|
|
|
|
gint proj_level; /* projection level */
|
|
|
|
TileManager *projection; /* The projection--layers & */
|
1998-06-28 18:39:58 +08:00
|
|
|
/* channels */
|
|
|
|
|
|
|
|
GList *guides; /* guides */
|
|
|
|
|
|
|
|
/* Layer/Channel attributes */
|
|
|
|
GSList *layers; /* the list of layers */
|
|
|
|
GSList *channels; /* the list of masks */
|
|
|
|
GSList *layer_stack; /* the layers in MRU order */
|
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
Layer *active_layer; /* ID of active layer */
|
|
|
|
Channel *active_channel; /* ID of active channel */
|
|
|
|
Layer *floating_sel; /* ID of fs layer */
|
|
|
|
Channel *selection_mask; /* selection mask channel */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
ParasiteList *parasites; /* Plug-in parasite data */
|
1998-10-08 16:15:21 +08:00
|
|
|
|
1999-03-06 07:50:24 +08:00
|
|
|
PathsList *paths; /* Paths data for this image */
|
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gint visible [MAX_CHANNELS]; /* visible channels */
|
|
|
|
gint active [MAX_CHANNELS]; /* active channels */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gboolean by_color_select; /* TRUE if there's an active */
|
1998-06-28 18:39:58 +08:00
|
|
|
/* "by color" selection dialog */
|
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gboolean qmask_state; /* TRUE if qmask is on */
|
|
|
|
gdouble qmask_opacity; /* opacity of the qmask channel */
|
|
|
|
guchar qmask_color[3]; /* rgb triplet of the color */
|
1999-07-07 11:18:54 +08:00
|
|
|
|
1998-06-28 18:39:58 +08:00
|
|
|
/* Undo apparatus */
|
|
|
|
GSList *undo_stack; /* stack for undo operations */
|
|
|
|
GSList *redo_stack; /* stack for redo operations */
|
1999-08-22 19:45:31 +08:00
|
|
|
gint undo_bytes; /* bytes in undo stack */
|
|
|
|
gint undo_levels; /* levels in undo stack */
|
1999-08-23 22:34:58 +08:00
|
|
|
gint group_count; /* nested undo groups */
|
1999-09-24 07:42:38 +08:00
|
|
|
UndoType pushing_undo_group; /* undo group status flag */
|
Honest, guv, it's not a feature - it's a tightly integrated package of
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
1999-09-21 01:15:20 +08:00
|
|
|
GtkWidget *undo_history; /* history viewer, or NULL */
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
/* Composite preview */
|
|
|
|
TempBuf *comp_preview; /* the composite preview */
|
1999-08-22 19:45:31 +08:00
|
|
|
gint comp_preview_valid[3]; /* preview valid-1/channel */
|
1998-06-28 18:39:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GimpImageClass
|
|
|
|
{
|
|
|
|
GimpObjectClass parent_class;
|
1999-08-22 19:45:31 +08:00
|
|
|
void (*dirty) (GtkObject*);
|
1998-06-28 18:39:58 +08:00
|
|
|
void (*repaint) (GtkObject*);
|
1999-08-22 19:45:31 +08:00
|
|
|
void (*rename) (GtkObject*);
|
1998-06-28 18:39:58 +08:00
|
|
|
};
|
|
|
|
typedef struct _GimpImageClass GimpImageClass;
|
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
#define GIMP_IMAGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_IMAGE, GimpImageClass)
|
1998-06-28 18:39:58 +08:00
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
#endif /* __GIMPIMAGEP_H__ */
|