Commit 5f63e079 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Chopped up the display stuff (beware: unfinished)...

2001-10-31  Michael Natterer  <mitch@gimp.org>

	Chopped up the display stuff (beware: unfinished)...

	The plan is that GimpDisplay is the object which collects
	updates from the image, compresses them and waits for the GIMP
	to be idle to actually paint them. It should be a non-GUI object
	which is the model for the actual widget to connect to.

	GimpDisplayShell has all the widgets and handles painting and
	exposing of the result. Nobody should actually be required to
	update ot look at it as it should be a view on the GimpDisplay
	object.

	Much stuff is still in the wrong place and the functions don't
	follow their files' filename namespace any more. More to come...

	* app/display/Makefile.am
	* app/display/gimpdisplay-ops.[ch]: removed. It's functions didn't
	belong together anyway.

	* app/display/gimpdisplay-area.[ch]: new files: the GimpArea
	functions.

	* app/display/gimpdisplay-handlers.[ch]: new files: signal
	handlers for GimpImage signals. Mostly from app/gui.c.

	* app/display/gimpdisplay.[ch]: removed all widgets and other
	GUI stuff. There is still much undecided here...

	* app/display/gimpdisplayshell.[ch]: actually use the object and
	filled it with all the stuff from GimpDisplay.

	* app/display/gimpdisplay-callbacks.[ch]
	* app/display/gimpdisplay-foreach.[ch]
	* app/display/gimpdisplay-render.c
	* app/display/gimpdisplay-scale.[ch]
	* app/display/gimpdisplay-scroll.[ch]
	* app/display/gimpdisplay-selection.c: changed accordingly.

	* app/core/gimp.[ch]: return a GimpObject from
	gimp_create_display() so it can be used as single GUI independent
	point to create displays, require the initial scale as parameter.

	* app/core/gimpcontext.c: changed the ugly EEKWrapper according to
	the GimpDisplay structure changes. Bugfix: set the image to NULL
	in gimp_context_display_destroyed().

	* app/core/gimpedit.c
	* app/core/gimpimage-new.c: changed gimp_create_display() calls
	accordingly.

	* app/core/gimpimage-convert.c: invalidate the layer & image
	previews here, not in the caller.

	* app/core/gimpimage-crop.c: update the whole image after cropping.

	* app/core/gimpimage.[ch]: added gimp_image_find_guide(),
	gimp_image_snap_point() and gimp_image_snap_rectangle(). Added
	"resolution_changed" and "unit_changed" signals and corresp.
	public convenience functions to emit them.

	* app/core/gimplayer.c: emit the image's "alpha_changed" signal
	when adding alpha to the bottom (and only) layer of the image.

	* app/gimpprogress.c
	* app/image_map.c
	* app/nav_window.c
	* app/qmask.c
	* app/undo.c
	* app/user_install.c: changed accordingly.

	* app/gui/edit-commands.c
	* app/gui/file-commands.c
	* app/gui/file-open-dialog.c
	* app/gui/image-commands.c
	* app/gui/info-window.c
	* app/gui/preferences-dialog.c
	* app/gui/toolbox.c
	* app/gui/view-commands.c: ditto.

	* app/gui/gui.[ch]: removed most gimp->images handlers as the
	displays connect to them themselves now. chaged gui_display_new()
	according to the gimp_create_display() changes.
	Added gui_get_screen_resolution().

	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpdrawtool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimppainttool.c
	* app/tools/gimppathtool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimpselectiontool.c
	* app/tools/gimptexttool.c
	* app/tools/gimptool.c
	* app/tools/gimptransformtool.c
	* app/tools/xinput_airbrush.c: lots of changes because GimpDisplay
	has become two objects. Lots of gdisp->shell casting uglyness
	added. This is fine because exactly these parts will have to go
	away.

	(GimpDisplay will provide methods for XOR drawing upon the display
	in image coordinates without the need to transform coordinates all
	the time. Also the tools shouldn't see GdkEvents but get more
	useful virtual functions which speak in image coordinates too).

	* app/widgets/gimpcomponentlistitem.c: removed a now useless image
	update.

	* tools/pdbgen/pdb/display.pdb: use gimp_create_display().

	* app/pdb/display_cmds.c: regenerated.
parent 4158715b
2001-10-31 Michael Natterer <mitch@gimp.org>
Chopped up the display stuff (beware: unfinished)...
The plan is that GimpDisplay is the object which collects
updates from the image, compresses them and waits for the GIMP
to be idle to actually paint them. It should be a non-GUI object
which is the model for the actual widget to connect to.
GimpDisplayShell has all the widgets and handles painting and
exposing of the result. Nobody should actually be required to
update ot look at it as it should be a view on the GimpDisplay
object.
Much stuff is still in the wrong place and the functions don't
follow their files' filename namespace any more. More to come...
* app/display/Makefile.am
* app/display/gimpdisplay-ops.[ch]: removed. It's functions didn't
belong together anyway.
* app/display/gimpdisplay-area.[ch]: new files: the GimpArea
functions.
* app/display/gimpdisplay-handlers.[ch]: new files: signal
handlers for GimpImage signals. Mostly from app/gui.c.
* app/display/gimpdisplay.[ch]: removed all widgets and other
GUI stuff. There is still much undecided here...
* app/display/gimpdisplayshell.[ch]: actually use the object and
filled it with all the stuff from GimpDisplay.
* app/display/gimpdisplay-callbacks.[ch]
* app/display/gimpdisplay-foreach.[ch]
* app/display/gimpdisplay-render.c
* app/display/gimpdisplay-scale.[ch]
* app/display/gimpdisplay-scroll.[ch]
* app/display/gimpdisplay-selection.c: changed accordingly.
* app/core/gimp.[ch]: return a GimpObject from
gimp_create_display() so it can be used as single GUI independent
point to create displays, require the initial scale as parameter.
* app/core/gimpcontext.c: changed the ugly EEKWrapper according to
the GimpDisplay structure changes. Bugfix: set the image to NULL
in gimp_context_display_destroyed().
* app/core/gimpedit.c
* app/core/gimpimage-new.c: changed gimp_create_display() calls
accordingly.
* app/core/gimpimage-convert.c: invalidate the layer & image
previews here, not in the caller.
* app/core/gimpimage-crop.c: update the whole image after cropping.
* app/core/gimpimage.[ch]: added gimp_image_find_guide(),
gimp_image_snap_point() and gimp_image_snap_rectangle(). Added
"resolution_changed" and "unit_changed" signals and corresp.
public convenience functions to emit them.
* app/core/gimplayer.c: emit the image's "alpha_changed" signal
when adding alpha to the bottom (and only) layer of the image.
* app/gimpprogress.c
* app/image_map.c
* app/nav_window.c
* app/qmask.c
* app/undo.c
* app/user_install.c: changed accordingly.
* app/gui/edit-commands.c
* app/gui/file-commands.c
* app/gui/file-open-dialog.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/toolbox.c
* app/gui/view-commands.c: ditto.
* app/gui/gui.[ch]: removed most gimp->images handlers as the
displays connect to them themselves now. chaged gui_display_new()
according to the gimp_create_display() changes.
Added gui_get_screen_resolution().
* app/tools/gimpbezierselecttool.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpdrawtool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmagnifytool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimppainttool.c
* app/tools/gimppathtool.c
* app/tools/gimprectselecttool.c
* app/tools/gimpselectiontool.c
* app/tools/gimptexttool.c
* app/tools/gimptool.c
* app/tools/gimptransformtool.c
* app/tools/xinput_airbrush.c: lots of changes because GimpDisplay
has become two objects. Lots of gdisp->shell casting uglyness
added. This is fine because exactly these parts will have to go
away.
(GimpDisplay will provide methods for XOR drawing upon the display
in image coordinates without the need to transform coordinates all
the time. Also the tools shouldn't see GdkEvents but get more
useful virtual functions which speak in image coordinates too).
* app/widgets/gimpcomponentlistitem.c: removed a now useless image
update.
* tools/pdbgen/pdb/display.pdb: use gimp_create_display().
* app/pdb/display_cmds.c: regenerated.
2001-10-30 Simon Budig <simon@gimp.org>
* app/pdb/tools_cmds.c
......
......@@ -37,6 +37,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "widgets/gimpcolorpanel.h"
......@@ -115,31 +116,35 @@ qmask_removed_callback (GtkObject *qmask,
void
qmask_buttons_update (GimpDisplay *gdisp)
{
GimpDisplayShell *shell;
g_assert (gdisp);
g_assert (gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON (gdisp->qmaskon)->active)
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON (shell->qmaskon)->active)
{
/* Disable toggle from doing anything */
g_signal_handlers_block_by_func (G_OBJECT (gdisp->qmaskoff),
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskoff),
qmask_deactivate_callback,
gdisp);
g_signal_handlers_block_by_func (G_OBJECT (gdisp->qmaskon),
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskon),
qmask_activate_callback,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskon),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskoff),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskoff),
! gdisp->gimage->qmask_state);
/* Enable toggle again */
g_signal_handlers_unblock_by_func (G_OBJECT (gdisp->qmaskoff),
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskoff),
qmask_deactivate_callback,
gdisp);
g_signal_handlers_unblock_by_func (G_OBJECT (gdisp->qmaskon),
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskon),
qmask_activate_callback,
gdisp);
}
......
......@@ -37,6 +37,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "widgets/gimpcolorpanel.h"
......@@ -115,31 +116,35 @@ qmask_removed_callback (GtkObject *qmask,
void
qmask_buttons_update (GimpDisplay *gdisp)
{
GimpDisplayShell *shell;
g_assert (gdisp);
g_assert (gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON (gdisp->qmaskon)->active)
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON (shell->qmaskon)->active)
{
/* Disable toggle from doing anything */
g_signal_handlers_block_by_func (G_OBJECT (gdisp->qmaskoff),
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskoff),
qmask_deactivate_callback,
gdisp);
g_signal_handlers_block_by_func (G_OBJECT (gdisp->qmaskon),
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskon),
qmask_activate_callback,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskon),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskoff),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskoff),
! gdisp->gimage->qmask_state);
/* Enable toggle again */
g_signal_handlers_unblock_by_func (G_OBJECT (gdisp->qmaskoff),
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskoff),
qmask_deactivate_callback,
gdisp);
g_signal_handlers_unblock_by_func (G_OBJECT (gdisp->qmaskon),
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskon),
qmask_activate_callback,
gdisp);
}
......
......@@ -265,7 +265,9 @@ gimp_edit_paste_as_new (Gimp *gimp,
gimp_image_undo_enable (gimage);
gimp_create_display (gimp, gimage);
gimp_create_display (gimp, gimage, 0x0101);
g_object_unref (G_OBJECT (gimage));
return gimage;
}
......
......@@ -450,7 +450,7 @@ gimp_restore (Gimp *gimp,
(* status_callback) (NULL, _("Gradients"), 0.72);
gimp_data_factory_data_init (gimp->gradient_factory, no_data);
/* initialize the global parasite table */
/* initialize the document history */
(* status_callback) (NULL, _("Documents"), 0.90);
gimp_documents_load (gimp);
......@@ -557,18 +557,20 @@ gimp_create_image (Gimp *gimp,
return gimage;
}
void
GimpObject *
gimp_create_display (Gimp *gimp,
GimpImage *gimage)
GimpImage *gimage,
guint scale)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimp->create_display_func)
{
gimp->create_display_func (gimage);
g_object_unref (G_OBJECT (gimage));
return gimp->create_display_func (gimage, scale);
}
return NULL;
}
/*
......@@ -602,7 +604,7 @@ gimp_open_file (Gimp *gimp,
gimp_image_clean_all (gimage);
if (with_display)
gimp_create_display (gimage->gimp, gimage);
gimp_create_display (gimage->gimp, gimage, 0x0101);
absolute = file_open_absolute_filename (filename);
......
......@@ -24,9 +24,10 @@
#include "gimpimage-new.h"
typedef void (* GimpCreateDisplayFunc) (GimpImage *gimage);
typedef void (* GimpSetBusyFunc) (Gimp *gimp);
typedef void (* GimpUnsetBusyFunc) (Gimp *gimp);
typedef GimpObject * (* GimpCreateDisplayFunc) (GimpImage *gimage,
guint scale);
typedef void (* GimpSetBusyFunc) (Gimp *gimp);
typedef void (* GimpUnsetBusyFunc) (Gimp *gimp);
#define GIMP_TYPE_GIMP (gimp_get_type ())
......@@ -142,8 +143,9 @@ GimpImage * gimp_create_image (Gimp *gimp,
GimpImageBaseType type,
gboolean attach_comment);
void gimp_create_display (Gimp *gimp,
GimpImage *gimage);
GimpObject * gimp_create_display (Gimp *gimp,
GimpImage *gimage,
guint scale);
/*
void gimp_open_file (Gimp *gimp,
......
......@@ -1302,6 +1302,9 @@ gimp_context_display_destroy (GObject *disp_shell,
GimpContext *context)
{
context->display = NULL;
gimp_context_real_set_image (context, NULL);
gimp_context_display_changed (context);
}
......@@ -1309,11 +1312,16 @@ static void
gimp_context_real_set_display (GimpContext *context,
gpointer display)
{
#ifdef __GNUC__
#warning FIXME: EEKWrapper
#endif
typedef struct
{
GimpObject foobar;
GObject *shell;
GimpObject foo;
gint bar;
GimpImage *gimage;
gint baz;
GObject *shell;
} EEKWrapper;
EEKWrapper *eek_wrapper;
......
......@@ -265,7 +265,9 @@ gimp_edit_paste_as_new (Gimp *gimp,
gimp_image_undo_enable (gimage);
gimp_create_display (gimp, gimage);
gimp_create_display (gimp, gimage, 0x0101);
g_object_unref (G_OBJECT (gimage));
return gimage;
}
......
......@@ -935,6 +935,8 @@ gimp_image_convert (GimpImage *gimage,
undo_push_group_end (gimage);
gimp_image_invalidate_layer_previews (gimage);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
gimp_image_mode_changed (gimage);
gimp_unset_busy (gimage->gimp);
......
......@@ -222,6 +222,11 @@ gimp_image_crop (GimpImage *gimage,
gimp_image_crop_adjust_guides (gimage, x1, y1, x2, y2);
}
gimp_image_update (gimage,
0, 0,
gimage->width,
gimage->height);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
gimp_unset_busy (gimage->gimp);
......
......@@ -63,6 +63,8 @@
#define TRC(x)
#endif
#define GUIDE_EPSILON 5
/* Local function declarations */
static void gimp_image_class_init (GimpImageClass *klass);
......@@ -171,6 +173,8 @@ enum
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
RESOLUTION_CHANGED,
UNIT_CHANGED,
SELECTION_CONTROL,
CLEAN,
......@@ -302,6 +306,24 @@ gimp_image_class_init (GimpImageClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_image_signals[RESOLUTION_CHANGED] =
g_signal_new ("resolution_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, resolution_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_image_signals[UNIT_CHANGED] =
g_signal_new ("unit_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, unit_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_image_signals[SELECTION_CONTROL] =
g_signal_new ("selection_control",
G_TYPE_FROM_CLASS (klass),
......@@ -763,22 +785,22 @@ gimp_image_set_resolution (GimpImage *gimage,
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
if ((ABS (gimage->xresolution - xresolution) >= 1e-5) ||
(ABS (gimage->yresolution - yresolution) >= 1e-5))
{
undo_push_resolution (gimage);
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
gimp_image_resolution_changed (gimage);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
}
}
void
......@@ -799,9 +821,14 @@ gimp_image_set_unit (GimpImage *gimage,
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
if (gimage->unit != unit)
{
undo_push_resolution (gimage);
gimage->unit = unit;
gimage->unit = unit;
gimp_image_unit_changed (gimage);
}
}
GimpUnit
......@@ -1609,6 +1636,152 @@ gimp_image_delete_guide (GimpImage *gimage,
}
}
GimpGuide *
gimp_image_find_guide (GimpImage *gimage,
gint x,
gint y)
{
GList *list;
GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (x < 0 || x >= gimage->width ||
y < 0 || y >= gimage->height)
{
return NULL;
}
for (list = gimage->guides; list; list = g_list_next (list))
{
guide = (GimpGuide *) list->data;
if (guide->position < 0)
continue;
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
if (ABS (guide->position - y) < GUIDE_EPSILON)
return guide;
break;
case ORIENTATION_VERTICAL:
if (ABS (guide->position - x) < GUIDE_EPSILON)
return guide;
break;
default:
break;
}
}
return NULL;
}
gboolean
gimp_image_snap_point (GimpImage *gimage,
gint x,
gint y,
gint *tx,
gint *ty)
{
GList *list;
GimpGuide *guide;
gint minxdist, minydist;
gint dist;
gboolean snapped = FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (tx != NULL, FALSE);
g_return_val_if_fail (ty != NULL, FALSE);
*tx = x;
*ty = y;
if (x < 0 || x >= gimage->width ||
y < 0 || y >= gimage->height)
{
return FALSE;
}
minxdist = G_MAXINT;
minydist = G_MAXINT;
for (list = gimage->guides; list; list = g_list_next (list))
{
guide = (GimpGuide *) list->data;
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
dist = ABS (guide->position - y);
if (dist < MIN (GUIDE_EPSILON, minydist))
{
minydist = dist;
*ty = guide->position;
snapped = TRUE;
}
break;
case ORIENTATION_VERTICAL:
dist = ABS (guide->position - x);
if (dist < MIN (GUIDE_EPSILON, minxdist))
{
minxdist = dist;
*tx = guide->position;
snapped = TRUE;
}
break;
default:
break;
}
}
return snapped;
}
gboolean
gimp_image_snap_rectangle (GimpImage *gimage,
gint x1,
gint y1,
gint x2,
gint y2,
gint *tx1,
gint *ty1)
{
gint nx1, ny1;
gint nx2, ny2;
gboolean snap1, snap2;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (tx1 != NULL, FALSE);
g_return_val_if_fail (ty1 != NULL, FALSE);
*tx1 = x1;
*ty1 = y1;
snap1 = gimp_image_snap_point (gimage, x1, y1, &nx1, &ny1);
snap2 = gimp_image_snap_point (gimage, x2, y2, &nx2, &ny2);
if (snap1 || snap2)
{
if (x1 != nx1)
*tx1 = nx1;
else if (x2 != nx2)
*tx1 = x1 + (nx2 - x2);
if (y1 != ny1)
*ty1 = ny1;
else if (y2 != ny2)
*ty1 = y1 + (ny2 - y2);
}
return snap1 || snap2;
}
GimpParasite *
gimp_image_parasite_find (const GimpImage *gimage,
......@@ -1835,6 +2008,22 @@ gimp_image_mask_changed (GimpImage *gimage)
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[MASK_CHANGED], 0);
}
void
gimp_image_resolution_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[RESOLUTION_CHANGED], 0);
}
void
gimp_image_unit_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UNIT_CHANGED], 0);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......@@ -2726,6 +2915,8 @@ gimp_image_set_component_visible (GimpImage *gimage,
g_signal_emit (G_OBJECT (gimage),
gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0,
type);
gimp_image_update (gimage, 0, 0, gimage->width, gimage->height);
}
}
......
......@@ -139,6 +139,8 @@ struct _GimpImageClass
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* resolution_changed) (GimpImage *gimage);
void (* unit_changed) (GimpImage *gimage);
void (* selection_control) (GimpImage *gimage,
GimpSelectionControl control);
......@@ -161,110 +163,125 @@ struct _GimpImageClass
/* function declarations */
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,
gint height,
GimpImageBaseType base_type);
gint gimp_image_get_ID (GimpImage *gimage);
GimpImage * gimp_image_get_by_ID (Gimp *gimp,
gint id);
void gimp_image_set_filename (GimpImage *gimage,
const gchar *filename);
void gimp_image_set_resolution (GimpImage *gimage,
gdouble xres,
gdouble yres);
void gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution);
void gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit);
GimpUnit gimp_image_get_unit (const GimpImage *gimage);
void gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc);
PlugInProcDef * gimp_image_get_save_proc (const GimpImage *gimage);
gint gimp_image_get_width (const GimpImage *gimage);
gint gimp_image_get_height (const GimpImage *gimage);
void gimp_image_resize (GimpImage *gimage,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
void gimp_image_scale (GimpImage *gimage,
gint new_width,
gint new_height);
gboolean gimp_image_check_scaling (const GimpImage *gimage,
gint new_width,
gint new_height);
TileManager * gimp_image_shadow (GimpImage *gimage,
gint width,
gint height,
gint bpp);
void gimp_image_free_shadow (GimpImage *gimage);
void gimp_image_apply_image (GimpImage *gimage,
GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean undo,
gint opacity,
LayerModeEffects mode,
TileManager *src1_tiles,
gint x,
gint y);
void gimp_image_replace_image (GimpImage *gimage,
GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean undo,
gint opacity,
PixelRegion *maskPR,
gint x,
gint y);
void gimp_image_get_foreground (const GimpImage *gimage,
const GimpDrawable *drawable,
guchar *fg);
void gimp_image_get_background (const GimpImage *gimage,
const GimpDrawable *drawable,