[gimp/wip/animation: 179/197] plug-ins: update filtering when updating the layer view selection.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/animation: 179/197] plug-ins: update filtering when updating the layer view selection.
- Date: Sat, 7 Oct 2017 03:13:29 +0000 (UTC)
commit 1e54537c8c222adb08941fadefef5170812a2648
Author: Jehan <jehan girinstud io>
Date: Mon Jul 17 17:43:24 2017 +0200
plug-ins: update filtering when updating the layer view selection.
.../animation-play/widgets/animation-layer-view.c | 37 ++++++++++++------
.../animation-play/widgets/animation-layer-view.h | 3 +-
plug-ins/animation-play/widgets/animation-xsheet.c | 40 ++++++++++---------
3 files changed, 47 insertions(+), 33 deletions(-)
---
diff --git a/plug-ins/animation-play/widgets/animation-layer-view.c
b/plug-ins/animation-play/widgets/animation-layer-view.c
index 640a08d..1c392af 100644
--- a/plug-ins/animation-play/widgets/animation-layer-view.c
+++ b/plug-ins/animation-play/widgets/animation-layer-view.c
@@ -261,20 +261,39 @@ animation_layer_view_filter (AnimationLayerView *view,
* animation_layer_view_select:
* @view: the #AnimationLayerView.
* @layers: a #GList of #GimpLayer ids.
+ * @filter: the viewing filter.
*
* Selects the rows for all @layers in @view.
*/
void
animation_layer_view_select (AnimationLayerView *view,
- const GList *layers)
+ const GList *layers,
+ const gchar *filter)
{
GtkTreeSelection *selection;
const GList *layer;
+ GtkToggleButton *filter_button;
+ gboolean filter_was_active;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->priv->tree_view));
g_signal_handlers_block_by_func (selection,
G_CALLBACK (on_selection_changed),
view);
+
+ filter_button = GTK_TOGGLE_BUTTON (view->priv->filter_button);
+ filter_was_active = view->priv->filter_active;
+ /* Deactivate the filtering. */
+ if (filter_was_active)
+ gtk_toggle_button_set_active (filter_button, FALSE);
+
+ /* Change the filter but do *not* refresh the GUI. */
+ if (g_strcmp0 (view->priv->filter, filter) != 0)
+ {
+ if (view->priv->filter)
+ g_free (view->priv->filter);
+ view->priv->filter = g_strdup (filter);
+ }
+
gtk_tree_selection_unselect_all (selection);
for (layer = layers; layer; layer = layer->next)
{
@@ -282,18 +301,6 @@ animation_layer_view_select (AnimationLayerView *view,
gint tattoo = GPOINTER_TO_INT (layer->data);
path = animation_layer_view_get_row (view, tattoo, NULL);
- if (! path &&
- gimp_image_get_layer_by_tattoo (view->priv->image_id,
- tattoo))
- {
- /* The layer exists, but the row can't be found. We must be
- * filtering. Remove the filter. */
- GtkToggleButton *button;
-
- button = GTK_TOGGLE_BUTTON (view->priv->filter_button);
- gtk_toggle_button_set_active (button, FALSE);
- path = animation_layer_view_get_row (view, tattoo, NULL);
- }
g_warn_if_fail (path != NULL);
if (path)
{
@@ -301,6 +308,10 @@ animation_layer_view_select (AnimationLayerView *view,
gtk_tree_path_free (path);
}
}
+ /* Reactivate the filtering. */
+ if (filter_was_active)
+ gtk_toggle_button_set_active (filter_button, TRUE);
+
g_signal_handlers_unblock_by_func (selection,
G_CALLBACK (on_selection_changed),
view);
diff --git a/plug-ins/animation-play/widgets/animation-layer-view.h
b/plug-ins/animation-play/widgets/animation-layer-view.h
index 2d260b9..08cbc55 100644
--- a/plug-ins/animation-play/widgets/animation-layer-view.h
+++ b/plug-ins/animation-play/widgets/animation-layer-view.h
@@ -53,6 +53,7 @@ void animation_layer_view_refresh (AnimationLayerView *view);
void animation_layer_view_filter (AnimationLayerView *view,
const gchar *filter);
void animation_layer_view_select (AnimationLayerView *view,
- const GList *layers);
+ const GList *layers,
+ const gchar *filter);
#endif /* __ANIMATION_LAYER_VIEW_H__ */
diff --git a/plug-ins/animation-play/widgets/animation-xsheet.c
b/plug-ins/animation-play/widgets/animation-xsheet.c
index fcb02a3..ed54b5b 100755
--- a/plug-ins/animation-play/widgets/animation-xsheet.c
+++ b/plug-ins/animation-play/widgets/animation-xsheet.c
@@ -1648,28 +1648,15 @@ animation_xsheet_cel_clicked (GtkWidget *button,
}
/* Finally update the layer view. */
- if (xsheet->priv->selected_track >= 0)
- {
- const gchar *title;
-
- title = animation_cel_animation_get_track_title (xsheet->priv->animation,
- xsheet->priv->selected_track);
- animation_layer_view_filter (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- title);
- }
- else
- {
- animation_layer_view_filter (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- NULL);
- }
if (g_queue_is_empty (xsheet->priv->selected_frames))
{
animation_layer_view_select (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- NULL);
+ NULL, NULL);
}
else
{
const GList *layers;
+ const gchar *filter = NULL;
/* When several frames are selected, show layers of the first selected. */
position = g_queue_peek_tail (xsheet->priv->selected_frames);
@@ -1677,8 +1664,14 @@ animation_xsheet_cel_clicked (GtkWidget *button,
layers = animation_cel_animation_get_layers (xsheet->priv->animation,
GPOINTER_TO_INT (track_num),
GPOINTER_TO_INT (position));
+
+ if (xsheet->priv->selected_track >= 0)
+ {
+ filter = animation_cel_animation_get_track_title (xsheet->priv->animation,
+ xsheet->priv->selected_track);
+ }
animation_layer_view_select (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- layers);
+ layers, filter);
}
}
/* Middle click */
@@ -2299,8 +2292,13 @@ create_suite (gint *key,
if (xsheet->priv->selected_track == data->level &&
selected_pos == pos)
{
+ const gchar *filter = NULL;
+
+ /* Filter with level title. */
+ filter = animation_cel_animation_get_track_title (xsheet->priv->animation,
+ data->level);
animation_layer_view_select (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- layers);
+ layers, filter);
}
}
@@ -2413,17 +2411,21 @@ animation_xsheet_select_all (AnimationXSheet *xsheet,
if (g_queue_is_empty (xsheet->priv->selected_frames))
{
animation_layer_view_select (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- NULL);
+ NULL, NULL);
}
else
{
const GList *layers;
+ const gchar *filter = NULL;
/* Show layers of position 0. */
layers = animation_cel_animation_get_layers (xsheet->priv->animation,
level, 0);
+ /* Filter with level title. */
+ filter = animation_cel_animation_get_track_title (xsheet->priv->animation,
+ level);
animation_layer_view_select (ANIMATION_LAYER_VIEW (xsheet->priv->layer_view),
- layers);
+ layers, filter);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]