[gimp] app: update layers-dialog floating-sel attrs/highlight when image changes
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: update layers-dialog floating-sel attrs/highlight when image changes
- Date: Wed, 7 Mar 2018 15:59:01 +0000 (UTC)
commit 8d9580fd2b71501cd3e435952d06a3b56cb6d8d7
Author: Ell <ell_se yahoo com>
Date: Wed Mar 7 10:42:00 2018 -0500
app: update layers-dialog floating-sel attrs/highlight when image changes
Move the button-highlight update to its own function, and call it
when the active image changes, as well as when its floating
selection changes.
Call the floating-selection-changed signal handler when the active
image changes, so that we correctly update its row's attributes.
app/widgets/gimplayertreeview.c | 66 ++++++++++++++++++++++++++++----------
1 files changed, 48 insertions(+), 18 deletions(-)
---
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 519f00b..10fda92 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -151,6 +151,7 @@ static void gimp_layer_tree_view_update_options (GimpLayerTree
GimpLayer *layer);
static void gimp_layer_tree_view_update_menu (GimpLayerTreeView *view,
GimpLayer *layer);
+static void gimp_layer_tree_view_update_highlight (GimpLayerTreeView *view);
static void gimp_layer_tree_view_mask_update (GimpLayerTreeView *view,
GtkTreeIter *iter,
GimpLayer *layer);
@@ -843,18 +844,33 @@ static void
gimp_layer_tree_view_set_image (GimpItemTreeView *view,
GimpImage *image)
{
+ GimpLayerTreeView *layer_view = GIMP_LAYER_TREE_VIEW (view);
+
if (gimp_item_tree_view_get_image (view))
- g_signal_handlers_disconnect_by_func (gimp_item_tree_view_get_image (view),
- gimp_layer_tree_view_floating_selection_changed,
- view);
+ {
+ g_signal_handlers_disconnect_by_func (gimp_item_tree_view_get_image (view),
+ gimp_layer_tree_view_floating_selection_changed,
+ view);
+ }
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (view, image);
if (gimp_item_tree_view_get_image (view))
- g_signal_connect (gimp_item_tree_view_get_image (view),
- "floating-selection-changed",
- G_CALLBACK (gimp_layer_tree_view_floating_selection_changed),
- view);
+ {
+ g_signal_connect (gimp_item_tree_view_get_image (view),
+ "floating-selection-changed",
+ G_CALLBACK (gimp_layer_tree_view_floating_selection_changed),
+ view);
+
+ /* call gimp_layer_tree_view_floating_selection_changed() now, to update
+ * the floating selection's row attributes.
+ */
+ gimp_layer_tree_view_floating_selection_changed (
+ gimp_item_tree_view_get_image (view),
+ layer_view);
+ }
+
+ gimp_layer_tree_view_update_highlight (layer_view);
}
static GimpItem *
@@ -888,7 +904,6 @@ static void
gimp_layer_tree_view_floating_selection_changed (GimpImage *image,
GimpLayerTreeView *layer_view)
{
- GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (layer_view);
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
GimpLayer *floating_sel;
@@ -930,16 +945,7 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *image,
g_list_free (all_layers);
}
- gimp_highlightable_button_set_highlight (
- GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_new_button (item_view)),
- floating_sel != NULL &&
- ! GIMP_IS_CHANNEL (gimp_layer_get_floating_sel_drawable (floating_sel)));
- gimp_highlightable_button_set_highlight (
- GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_delete_button (item_view)),
- floating_sel != NULL);
- gimp_highlightable_button_set_highlight (
- GIMP_HIGHLIGHTABLE_BUTTON (layer_view->priv->anchor_button),
- floating_sel != NULL);
+ gimp_layer_tree_view_update_highlight (layer_view);
}
@@ -1182,6 +1188,30 @@ gimp_layer_tree_view_update_menu (GimpLayerTreeView *layer_view,
gimp_layer_get_edit_mask (layer));
}
+static void
+gimp_layer_tree_view_update_highlight (GimpLayerTreeView *layer_view)
+{
+ GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (layer_view);
+ GimpImage *image = gimp_item_tree_view_get_image (item_view);
+ GimpLayer *floating_sel = NULL;
+
+ if (image)
+ floating_sel = gimp_image_get_floating_selection (image);
+
+ gimp_highlightable_button_set_highlight (
+ GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_new_button (item_view)),
+ floating_sel != NULL &&
+ ! GIMP_IS_CHANNEL (gimp_layer_get_floating_sel_drawable (floating_sel)));
+
+ gimp_highlightable_button_set_highlight (
+ GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_delete_button (item_view)),
+ floating_sel != NULL);
+
+ gimp_highlightable_button_set_highlight (
+ GIMP_HIGHLIGHTABLE_BUTTON (layer_view->priv->anchor_button),
+ floating_sel != NULL);
+}
+
/* Layer Mask callbacks */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]