diff --git a/timeline/clip.cpp b/timeline/clip.cpp index 0a8a9d6b9..5b4311de6 100644 --- a/timeline/clip.cpp +++ b/timeline/clip.cpp @@ -102,6 +102,15 @@ bool Clip::IsActiveAt(long timecode) && timecode - timeline_in(true) + clip_in(true) < media_length(); } +bool Clip::IsSelected(bool containing) +{ + if (this->sequence == nullptr) { + return false; + } + + return this->sequence->IsClipSelected(this, containing); +} + const QColor &Clip::color() { return color_; diff --git a/timeline/clip.h b/timeline/clip.h index cf8435966..8e6e94914 100644 --- a/timeline/clip.h +++ b/timeline/clip.h @@ -59,6 +59,7 @@ public: ClipPtr copy(Sequence *s); bool IsActiveAt(long timecode); + bool IsSelected(bool containing = true); const QColor& color(); void set_color(int r, int g, int b); diff --git a/timeline/sequence.h b/timeline/sequence.h index f4e2e5518..559564e3b 100644 --- a/timeline/sequence.h +++ b/timeline/sequence.h @@ -48,8 +48,8 @@ public: Effect* GetSelectedGizmo(); - bool IsClipSelected(int clip_index, bool containing); - bool IsClipSelected(Clip* clip, bool containing); + bool IsClipSelected(int clip_index, bool containing = true); + bool IsClipSelected(Clip* clip, bool containing = true); bool IsTransitionSelected(Transition* t); QVector selections; diff --git a/ui/effectui.cpp b/ui/effectui.cpp index 11284d092..836a4836e 100644 --- a/ui/effectui.cpp +++ b/ui/effectui.cpp @@ -20,11 +20,41 @@ EffectUI::EffectUI(Effect* e) : // If this effect is actually a transition if (e->meta->type == EFFECT_TYPE_TRANSITION) { + Transition* t = static_cast(e); + + // Since effects can have two clip attachments, find out which one is selected + Clip* selected_clip = t->parent_clip; + bool both_selected = false; + + // Check if this is a shared transition + if (t->secondary_clip != nullptr) { + + // Check which clips are selected + if (t->secondary_clip->IsSelected()) { + + selected_clip = t->secondary_clip; + + if (t->parent_clip->IsSelected()) { + // Both clips are selected + both_selected = true; + } + + } else if (!t->parent_clip->IsSelected()) { + + // Neither are selected, but the naming scheme (no "opening" or "closing" modifier) will be the same + both_selected = true; + + } + + } + // See if the transition is the clip's opening or closing transition and label it accordingly - if (e->parent_clip->opening_transition.get() == e) { - effect_name = tr("%1 (Opening)").arg(e->name); + if (both_selected) { + effect_name = t->name; + } else if (selected_clip->opening_transition.get() == t) { + effect_name = tr("%1 (Opening)").arg(t->name); } else { - effect_name = tr("%1 (Closing)").arg(e->name); + effect_name = tr("%1 (Closing)").arg(t->name); } } else {