From 31116fb0794656cefd1dbf0356523b986e7db91c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 15 Mar 2020 17:26:13 +0100 Subject: [PATCH] Clip: draft state-switching operation --- src/stage/timeline/clip-widget.cpp | 17 ++++++++-- src/stage/timeline/clip-widget.hpp | 45 +++++++++++++++++++++++--- src/stage/timeline/track-presenter.hpp | 1 + wiki/thinkPad.ichthyo.mm | 22 +++++++++++-- 4 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/stage/timeline/clip-widget.cpp b/src/stage/timeline/clip-widget.cpp index ed5947e31..9f0c62055 100644 --- a/src/stage/timeline/clip-widget.cpp +++ b/src/stage/timeline/clip-widget.cpp @@ -67,7 +67,8 @@ namespace timeline { ClipDelegate::~ClipDelegate() { } - ClipDelegate::ClipDelegate () + ClipDelegate::ClipDelegate(WidgetViewHook& displayAnchor) + : display_{&displayAnchor} { } @@ -82,11 +83,23 @@ namespace timeline { /* === Interface ClipDelegate === */ public: - ClipWidget() { } + ClipWidget(WidgetViewHook& displayAnchor) + : ClipDelegate{displayAnchor} + { } }; }//(End)clip appearance details. + /* === Appearance Style state transitions === */ + + ClipDelegate::Appearance + ClipDelegate::switchAppearance (PDelegate& manager, Appearance desired, WidgetViewHook* newView) + { + UNIMPLEMENTED ("clip appearance style state management"); + } + + + }}// namespace stage::timeline diff --git a/src/stage/timeline/clip-widget.hpp b/src/stage/timeline/clip-widget.hpp index 575e47082..46b9c7520 100644 --- a/src/stage/timeline/clip-widget.hpp +++ b/src/stage/timeline/clip-widget.hpp @@ -102,10 +102,11 @@ #define STAGE_TIMELINE_CLIP_WIDGET_H #include "stage/gtk-base.hpp" +#include "stage/model/view-hook.hpp" //#include "lib/util.hpp" -//#include +#include //#include @@ -113,19 +114,53 @@ namespace stage { namespace timeline { + using WidgetViewHook = model::ViewHook; + + class ClipDelegate; + using PDelegate = std::unique_ptr; + /** * @todo WIP-WIP as of 3/2020 */ class ClipDelegate { - public: - enum Appearance {PENDING, ABRIDGED, COMPACT, EXPANDED, DEGRADED}; + WidgetViewHook* display_; + public: virtual ~ClipDelegate(); ///< this is an interface - ClipDelegate(); - + + enum Appearance {PENDING, SYMBOLIC, ABRIDGED, COMPACT, EXPANDED, DEGRADED}; + + + ClipDelegate(WidgetViewHook& displayAnchor); + + /** request to change the clip delegate's appearance style, if possible. + * @param manager entity to hold and maintain this specific appearance state. + * @param desired the intended style of mode to achieve + * @param displayAnchor (optionally) a different view to hook up the delegate. + * @return the actual mode the presentation was switched to + * @remark switching the appearance style is a state transition; sometimes + * this change also implies switching the actual implementation of + * the delegate. And thus there can be prerequisites for achieving + * a specific appearance and presentation mode. Most notably, to + * reach any style beyond `SYMBOLIC`, we need to know the temporal + * extension of the clip. If such requirements can not be fulfilled, + * presentation stays or drops to the most elaborate state possible + * with the current configuration. + * @note Default and fallback appearance style is `PENDING`, which turns the + * delegate into a mere data record without visual representation. + * @note whenever a ViewHook (instance) different than the existing one is + * given, the existing widget / delegate will be destroyed and + * replaced by a suitable copy hooked up into the new display. + * The ctor #ClipDelegate(WidgetViewHook) ensures there is + * always a display_ (ViewHook) to refer to. + */ + static Appearance switchAppearance (PDelegate& manager, + Appearance desired =PENDING, + WidgetViewHook* newView =nullptr); + private:/* ===== Internals ===== */ }; diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 720ac5f0f..76a52d0f9 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -84,6 +84,7 @@ #include "stage/gtk-base.hpp" #include "include/ui-protocol.hpp" +#include "stage/model/view-hook.hpp" #include "stage/model/controller.hpp" #include "stage/timeline/display-evaluation.hpp" #include "stage/timeline/marker-widget.hpp" diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 2059acdbf..d78de799c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -27762,10 +27762,12 @@ - + - + + + @@ -27806,6 +27808,11 @@ + + + + + @@ -27857,9 +27864,18 @@ - + + + + + + + + + +