diff --git a/src/stage/timeline/clip-presenter.cpp b/src/stage/timeline/clip-presenter.cpp index 11a2af977..7bd477a91 100644 --- a/src/stage/timeline/clip-presenter.cpp +++ b/src/stage/timeline/clip-presenter.cpp @@ -64,15 +64,20 @@ namespace timeline { - - ClipPresenter::ClipPresenter (ID identity, ctrl::BusTerm& nexus, optional offsetX) + /** + * @param identity referring to the corresponding session::Clip in Steam-Layer. + * @param nexus a way to connect this Controller to the UI-Bus. + * @param view (abstracted) canvas or display framework to attach this clip to + * @param offsetX offset relative to the start of the track ///////////////////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!! + */ + ClipPresenter::ClipPresenter (ID identity, ctrl::BusTerm& nexus, WidgetViewHook& view, optional offsetX) : Controller{identity, nexus} , channels_{} , effects_{} , markers_{} , widget_{} { - UNIMPLEMENTED ("decide upon the appearance style, based on the presence of the offset. Instantiate the appropriate delegate"); + ClipDelegate::buildDelegate (widget_, view, offsetX); } @@ -122,7 +127,9 @@ namespace timeline { }) .constructFrom ([&](GenNode const& spec) -> PEffect { - return make_unique (spec.idi, this->uiBus_, std::nullopt); ///////////TICKET #1213 : is it really such a good idea to pass that here?? + return make_unique (spec.idi, this->uiBus_ + ,getClipContentCanvas() + ,std::nullopt); /////////////////////////TICKET #1213 : is it really such a good idea to pass that here?? Note: nullopt effectively disables any display }) .buildChildMutator ([&](PEffect& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool { @@ -141,17 +148,36 @@ namespace timeline { }) .constructFrom ([&](GenNode const& spec) -> PChannel { - return make_unique (spec.idi, this->uiBus_, std::nullopt); ///////////TICKET #1213 : is it really such a good idea to pass that here?? + return make_unique (spec.idi, this->uiBus_ + ,getClipContentCanvas() + ,std::nullopt); /////////////////////////TICKET #1213 : how to represent "always" / "the whole track"?? }) .buildChildMutator ([&](PChannel& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool { if (subID != target->getID()) return false; target->buildMutator (buff); return true; - }))); + })) + .onLocalChange ([this]() + { + this->resetAppearanceStyle(); + })); + } + void + ClipPresenter::resetAppearanceStyle() + { + ClipDelegate::switchAppearance (this->widget_, defaultAppearance); + } + + WidgetViewHook& + ClipPresenter::getClipContentCanvas() + { + UNIMPLEMENTED ("how to create and wire an embedded canvas for the clip contents/effects"); + } + int ClipPresenter::determineRequiredVerticalExtension() const { diff --git a/src/stage/timeline/clip-presenter.hpp b/src/stage/timeline/clip-presenter.hpp index 66fff8615..d376b617a 100644 --- a/src/stage/timeline/clip-presenter.hpp +++ b/src/stage/timeline/clip-presenter.hpp @@ -86,12 +86,15 @@ namespace timeline { unique_ptr widget_; + /** default level of detail presentation desired for each clip. + * @note the actual appearance style is chosen based on this setting + * yet limited by the additional information necessary to establish + * a given level; e.g. name or content renderer must be available + * to allow for a detailed rendering of the clip in the timeline. */ + static const ClipDelegate::Appearance defaultAppearance = ClipDelegate::COMPACT; + public: - /** - * @param identity used to refer to a corresponding session::Fork in the Session - * @param nexus a way to connect this Controller to the UI-Bus. - */ - ClipPresenter (ID identity, ctrl::BusTerm& nexus, optional offsetX); + ClipPresenter (ID, ctrl::BusTerm&, WidgetViewHook&, optional offsetX); ~ClipPresenter(); @@ -106,6 +109,19 @@ namespace timeline { int determineRequiredVerticalExtension() const; private:/* ===== Internals ===== */ + + /** reevaluate desired presentation mode and available data, + * possibly leading to a changed appearance style of the clip. + * @remark a typical example would be, when a clip's temporal position, + * previously unspecified, now becomes defined through a diff message. + * With this data, it becomes feasible _actually to show the clip_ in + * the timeline. Thus the [Appearance style](\ref ClipDelegate::Appearance) + * of the presentation widget (delegate) can be switched up from `PENDING` + * to `ABRIDGED`. + */ + void resetAppearanceStyle(); + + WidgetViewHook& getClipContentCanvas(); }; diff --git a/src/stage/timeline/clip-widget.cpp b/src/stage/timeline/clip-widget.cpp index 9f0c62055..a821491b2 100644 --- a/src/stage/timeline/clip-widget.cpp +++ b/src/stage/timeline/clip-widget.cpp @@ -55,36 +55,55 @@ //using sigc::ptr_fun; //using std::cout; //using std::endl; +using std::optional; +using std::nullopt; namespace stage { namespace timeline { - - + const int ClipDelegate::defaultOffsetY{0}; + const string ClipDelegate::defaultName{_("clip")}; ClipDelegate::~ClipDelegate() { } - ClipDelegate::ClipDelegate(WidgetViewHook& displayAnchor) - : display_{&displayAnchor} + ClipDelegate::ClipDelegate() { } namespace {// details of concrete clip appearance styles... + class ClipData + : public ClipDelegate + , util::NonCopyable + { + WidgetViewHook& display_; + + /* === Interface ClipDelegate === */ + + public: + ClipData(WidgetViewHook& displayAnchor) + : ClipDelegate{} + , display_{displayAnchor} + { } + }; + + using ViewHookedWidget = model::ViewHooked; ///////////////////////////////////////////TICKET #1211 : need preliminary placeholder clip widget for timeline layout + class ClipWidget - : public Gtk::Button //////////////////////////////////////////////////////////////////TICKET #1211 : need preliminary placeholder clip widget for timeline layout + : public ViewHookedWidget , public ClipDelegate - , util::MoveOnly + , util::NonCopyable { /* === Interface ClipDelegate === */ public: - ClipWidget(WidgetViewHook& displayAnchor) - : ClipDelegate{displayAnchor} + ClipWidget(WidgetViewHook& displayAnchor, int x, int y, uString clipName) + : ViewHookedWidget{displayAnchor.hookedAt(x,y), clipName} + , ClipDelegate{} { } }; @@ -100,6 +119,15 @@ namespace timeline { UNIMPLEMENTED ("clip appearance style state management"); } + ClipDelegate::Appearance + ClipDelegate::buildDelegate (PDelegate& manager, WidgetViewHook& view, optional startOffsetX) ////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!! + { + if (startOffsetX) + manager.reset (new ClipWidget{view, *startOffsetX, defaultOffsetY, defaultName}); + else + manager.reset (new ClipData{view}); + } + }}// namespace stage::timeline diff --git a/src/stage/timeline/clip-widget.hpp b/src/stage/timeline/clip-widget.hpp index 46b9c7520..cbc0f483e 100644 --- a/src/stage/timeline/clip-widget.hpp +++ b/src/stage/timeline/clip-widget.hpp @@ -106,7 +106,9 @@ //#include "lib/util.hpp" +#include #include +#include //#include @@ -114,6 +116,8 @@ namespace stage { namespace timeline { + using std::string; + using WidgetViewHook = model::ViewHook; class ClipDelegate; @@ -125,16 +129,20 @@ namespace timeline { */ class ClipDelegate { - WidgetViewHook* display_; - public: virtual ~ClipDelegate(); ///< this is an interface + ClipDelegate(); enum Appearance {PENDING, SYMBOLIC, ABRIDGED, COMPACT, EXPANDED, DEGRADED}; - ClipDelegate(WidgetViewHook& displayAnchor); + /** vertical offset below the track start */ + static const int defaultOffsetY; + + /** placeholder name -- typically overridden from the model */ + static const string defaultName; + /** request to change the clip delegate's appearance style, if possible. * @param manager entity to hold and maintain this specific appearance state. @@ -161,6 +169,12 @@ namespace timeline { Appearance desired =PENDING, WidgetViewHook* newView =nullptr); + /** build the initial presentation widget on construction, using a minimally + * viable appearance style. This is the first incantation of #switchAppearance. + */ + static Appearance buildDelegate (PDelegate& manager, WidgetViewHook& view, + std::optional startOffsetX); ///////////////////////TICKET #1213 : translation time->offset should be built into the ViewHook!!! + private:/* ===== Internals ===== */ }; diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 76a52d0f9..abc06b736 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -146,17 +146,16 @@ namespace timeline { ViewHooked head_; ViewHooked body_; - /* ==== Interface: DisplayViewHooks===== */ - - model::ViewHook& getHeadHook() override { return head_; }; - model::ViewHook& getBodyHook() override { return body_; }; - model::ViewHook& getClipHook() override { return *this; }; - /* === extended Interface for relative view hook === */ int hookAdjX (int xPos) override { return xPos; }; int hookAdjY (int yPos) override { return yPos + body_.getContentOffsetY(); }; + public: /* ==== Interface: DisplayViewHooks===== */ + + model::ViewHook& getHeadHook() override { return head_; }; + model::ViewHook& getBodyHook() override { return body_; }; + model::ViewHook& getClipHook() override { return *this; }; public: DisplayFrame (DisplayViewHooks& displayAnchor) @@ -333,7 +332,7 @@ namespace timeline { .constructFrom ([&](GenNode const& spec) -> PClip { std::optional startOffsetX{extractStartOffset (spec)}; //////////////////////////TICKET #1213 : should pass the start time instead!! - return make_unique (spec.idi, this->uiBus_, startOffsetX); + return make_unique (spec.idi, this->uiBus_, display_.getClipHook(), startOffsetX); }) .buildChildMutator ([&](PClip& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool { diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0654062e3..addc340c5 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -27808,18 +27808,21 @@ - - - + + + + + - + + - - + + @@ -27839,7 +27842,10 @@ - + + + + @@ -27864,6 +27870,20 @@ + + + + + + +

+ wenn man das naiv coden würde, dann würden wir für jeden Clip erst mal einen ClipData-Placeholder erzeugen, nur um dann, nach dem Empfangen des vollständigen Diff, diesen wieder zu deallozieren und dafür ein ClipWidget zu erzeugen... +

+ + +
+ +
@@ -28026,7 +28046,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -28067,6 +28113,9 @@ + + +