[gimp] app: update drawable filter upon alpha-lock change
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: update drawable filter upon alpha-lock change
- Date: Thu, 17 Jan 2019 19:20:42 +0000 (UTC)
commit de4e7b477054803419d1648da49e3075102d24b8
Author: Ell <ell_se yahoo com>
Date: Thu Jan 17 14:17:57 2019 -0500
app: update drawable filter upon alpha-lock change
In GimpDrawableFilter, when operating on a layer, update the filter
when the layer's lock-alpha flag changes.
app/core/gimpdrawablefilter.c | 99 +++++++++++++++++++++++++++----------------
1 file changed, 62 insertions(+), 37 deletions(-)
---
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index a675ab4098..740497d918 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -44,6 +44,7 @@
#include "gimpdrawable-filters.h"
#include "gimpdrawablefilter.h"
#include "gimpimage.h"
+#include "gimplayer.h"
#include "gimpmarshal.h"
#include "gimpprogress.h"
@@ -91,43 +92,45 @@ struct _GimpDrawableFilter
};
-static void gimp_drawable_filter_dispose (GObject *object);
-static void gimp_drawable_filter_finalize (GObject *object);
-
-static void gimp_drawable_filter_sync_region (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_crop (GimpDrawableFilter *filter,
- gboolean old_crop_enabled,
- const GeglRectangle *old_crop_rect,
- gboolean old_preview_enabled,
- GimpAlignmentType old_preview_alignment,
- gdouble old_preview_position,
- gboolean update);
-static void gimp_drawable_filter_sync_opacity (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_mode (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_affect (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_format (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_mask (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter);
-static void gimp_drawable_filter_sync_gamma_hack (GimpDrawableFilter *filter);
-
-static gboolean gimp_drawable_filter_is_filtering (GimpDrawableFilter *filter);
-static gboolean gimp_drawable_filter_add_filter (GimpDrawableFilter *filter);
-static gboolean gimp_drawable_filter_remove_filter (GimpDrawableFilter *filter);
-
-static void gimp_drawable_filter_update_drawable (GimpDrawableFilter *filter,
- const GeglRectangle *area);
-
-static void gimp_drawable_filter_affect_changed (GimpImage *image,
- GimpChannelType channel,
- GimpDrawableFilter *filter);
-static void gimp_drawable_filter_mask_changed (GimpImage *image,
- GimpDrawableFilter *filter);
-static void gimp_drawable_filter_profile_changed (GimpColorManaged *managed,
- GimpDrawableFilter *filter);
-static void gimp_drawable_filter_format_changed (GimpDrawable *drawable,
- GimpDrawableFilter *filter);
-static void gimp_drawable_filter_drawable_removed (GimpDrawable *drawable,
- GimpDrawableFilter *filter);
+static void gimp_drawable_filter_dispose (GObject *object);
+static void gimp_drawable_filter_finalize (GObject *object);
+
+static void gimp_drawable_filter_sync_region (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_crop (GimpDrawableFilter *filter,
+ gboolean old_crop_enabled,
+ const GeglRectangle *old_crop_rect,
+ gboolean old_preview_enabled,
+ GimpAlignmentType old_preview_alignment,
+ gdouble old_preview_position,
+ gboolean update);
+static void gimp_drawable_filter_sync_opacity (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_mode (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_affect (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_format (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_mask (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter);
+static void gimp_drawable_filter_sync_gamma_hack (GimpDrawableFilter *filter);
+
+static gboolean gimp_drawable_filter_is_filtering (GimpDrawableFilter *filter);
+static gboolean gimp_drawable_filter_add_filter (GimpDrawableFilter *filter);
+static gboolean gimp_drawable_filter_remove_filter (GimpDrawableFilter *filter);
+
+static void gimp_drawable_filter_update_drawable (GimpDrawableFilter *filter,
+ const GeglRectangle *area);
+
+static void gimp_drawable_filter_affect_changed (GimpImage *image,
+ GimpChannelType channel,
+ GimpDrawableFilter *filter);
+static void gimp_drawable_filter_mask_changed (GimpImage *image,
+ GimpDrawableFilter *filter);
+static void gimp_drawable_filter_profile_changed (GimpColorManaged *managed,
+ GimpDrawableFilter *filter);
+static void gimp_drawable_filter_format_changed (GimpDrawable *drawable,
+ GimpDrawableFilter *filter);
+static void gimp_drawable_filter_drawable_removed (GimpDrawable *drawable,
+ GimpDrawableFilter *filter);
+static void gimp_drawable_filter_lock_alpha_changed (GimpLayer *layer,
+ GimpDrawableFilter *filter);
G_DEFINE_TYPE (GimpDrawableFilter, gimp_drawable_filter, GIMP_TYPE_FILTER)
@@ -967,6 +970,13 @@ gimp_drawable_filter_add_filter (GimpDrawableFilter *filter)
G_CALLBACK (gimp_drawable_filter_drawable_removed),
filter);
+ if (GIMP_IS_LAYER (filter->drawable))
+ {
+ g_signal_connect (filter->drawable, "lock-alpha-changed",
+ G_CALLBACK (gimp_drawable_filter_lock_alpha_changed),
+ filter);
+ }
+
return TRUE;
}
@@ -980,6 +990,13 @@ gimp_drawable_filter_remove_filter (GimpDrawableFilter *filter)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (filter->drawable));
+ if (GIMP_IS_LAYER (filter->drawable))
+ {
+ g_signal_handlers_disconnect_by_func (filter->drawable,
+ gimp_drawable_filter_lock_alpha_changed,
+ filter);
+ }
+
g_signal_handlers_disconnect_by_func (filter->drawable,
gimp_drawable_filter_drawable_removed,
filter);
@@ -1094,3 +1111,11 @@ gimp_drawable_filter_drawable_removed (GimpDrawable *drawable,
{
gimp_drawable_filter_remove_filter (filter);
}
+
+static void
+gimp_drawable_filter_lock_alpha_changed (GimpLayer *layer,
+ GimpDrawableFilter *filter)
+{
+ gimp_drawable_filter_sync_affect (filter);
+ gimp_drawable_filter_update_drawable (filter, NULL);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]