app: add GimpProjectable::bounds-changed signal
... and a corresponding gimp_projectable_bounds_changed() function.
This signal can be emitted by implementers of GimpProjectable,
instead of the GimpProjectable::structure-changed signal, when the
projectable's bounds change, but its content does not -- i.e., the
old content simply gets cropped to the new bounds.
(cherry picked from commit 460c3d1349
)
This commit is contained in:
@ -35,6 +35,7 @@ enum
|
||||
INVALIDATE,
|
||||
FLUSH,
|
||||
STRUCTURE_CHANGED,
|
||||
BOUNDS_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -82,6 +83,19 @@ gimp_projectable_default_init (GimpProjectableInterface *iface)
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
projectable_signals[BOUNDS_CHANGED] =
|
||||
g_signal_new ("bounds-changed",
|
||||
G_TYPE_FROM_CLASS (iface),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpProjectableInterface, bounds_changed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__INT_INT_INT_INT,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
}
|
||||
|
||||
|
||||
@ -118,6 +132,19 @@ gimp_projectable_structure_changed (GimpProjectable *projectable)
|
||||
g_signal_emit (projectable, projectable_signals[STRUCTURE_CHANGED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_projectable_bounds_changed (GimpProjectable *projectable,
|
||||
gint old_x,
|
||||
gint old_y,
|
||||
gint old_width,
|
||||
gint old_height)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
|
||||
|
||||
g_signal_emit (projectable, projectable_signals[BOUNDS_CHANGED], 0,
|
||||
old_x, old_y, old_width, old_height);
|
||||
}
|
||||
|
||||
GimpImage *
|
||||
gimp_projectable_get_image (GimpProjectable *projectable)
|
||||
{
|
||||
|
@ -43,6 +43,11 @@ struct _GimpProjectableInterface
|
||||
void (* flush) (GimpProjectable *projectable,
|
||||
gboolean invalidate_preview);
|
||||
void (* structure_changed) (GimpProjectable *projectable);
|
||||
void (* bounds_changed) (GimpProjectable *projectable,
|
||||
gint old_x,
|
||||
gint old_y,
|
||||
gint old_width,
|
||||
gint old_height);
|
||||
|
||||
/* virtual functions */
|
||||
GimpImage * (* get_image) (GimpProjectable *projectable);
|
||||
@ -70,6 +75,11 @@ void gimp_projectable_invalidate (GimpProjectable *projectable,
|
||||
void gimp_projectable_flush (GimpProjectable *projectable,
|
||||
gboolean preview_invalidated);
|
||||
void gimp_projectable_structure_changed (GimpProjectable *projectable);
|
||||
void gimp_projectable_bounds_changed (GimpProjectable *projectable,
|
||||
gint old_x,
|
||||
gint old_y,
|
||||
gint old_width,
|
||||
gint old_height);
|
||||
|
||||
GimpImage * gimp_projectable_get_image (GimpProjectable *projectable);
|
||||
const Babl * gimp_projectable_get_format (GimpProjectable *projectable);
|
||||
|
Reference in New Issue
Block a user