diff --git a/src/stage/timeline/body-canvas-widget.cpp b/src/stage/timeline/body-canvas-widget.cpp index a4ddbea8e..1eae7a32c 100644 --- a/src/stage/timeline/body-canvas-widget.cpp +++ b/src/stage/timeline/body-canvas-widget.cpp @@ -537,6 +537,32 @@ namespace timeline { } /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + /* ==== Interface: ViewHook ===== */ + + void + BodyCanvasWidget::hook (Gtk::Widget& head, int xPos, int yPos) + { + UNIMPLEMENTED ("find the relevant canvas and attach the widget at given pos"); + } + + void + BodyCanvasWidget::remove (Gtk::Widget& head) + { + UNIMPLEMENTED ("find the relevant canvas and search and attach the widget"); + } + + void + BodyCanvasWidget::rehook (model::ViewHooked&) noexcept + { + UNIMPLEMENTED ("find the relevant canvas and attach the widget anew"); + } + + void + BodyCanvasWidget::move (Gtk::Widget& head, int xPos, int yPos) + { + UNIMPLEMENTED ("find the relevant canvas and reposition the widget"); + } + diff --git a/src/stage/timeline/body-canvas-widget.hpp b/src/stage/timeline/body-canvas-widget.hpp index fa134307e..e15072da5 100644 --- a/src/stage/timeline/body-canvas-widget.hpp +++ b/src/stage/timeline/body-canvas-widget.hpp @@ -59,6 +59,7 @@ #include "stage/gtk-base.hpp" #include "stage/timeline/track-profile.hpp" +#include "stage/model/view-hook.hpp" //#include "lib/util.hpp" @@ -105,6 +106,7 @@ namespace timeline { */ class BodyCanvasWidget : public Gtk::Box + , public model::ViewHook { DisplayManager& layout_; TrackProfile profile_; @@ -136,6 +138,13 @@ namespace timeline { void DEBUG_injectTrackLabel(cuString const& trackName, int startLine); /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this + protected: /* ==== Interface: ViewHook ===== */ + + void hook (Gtk::Widget&, int xPos=0, int yPos=0) override; + void move (Gtk::Widget&, int xPos, int yPos) override; + void remove (Gtk::Widget&) override; + void rehook (model::ViewHooked&) noexcept override; + private:/* ===== Internals ===== */ void slotStructureChange() noexcept; diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp index 95e95b2b8..3ae4f4ae0 100644 --- a/src/stage/timeline/display-manager.hpp +++ b/src/stage/timeline/display-manager.hpp @@ -57,14 +57,11 @@ #include "lib/error.hpp" #include "lib/nocopy.hpp" - +#include "stage/model/view-hook.hpp" #include "lib/util.hpp" #include -//#include -//#include - namespace stage { @@ -72,10 +69,35 @@ namespace timeline { using util::max; -// class TrackHeadWidget; + class TrackHeadWidget; + class TrackBody; - /** @todo quick-n-dirty hack. Should consider the Range TR (C++20) */ + /** + * Interface: a compound of anchoring facilities. + * With the help of view-hooking, some detail presentation component + * or widget can attach itself into the overarching view context or canvas + * of the Timeline, while remaining agnostic about actual structure or implementation + * of this »display umbrella«. The local presentation component itself is then model::ViewHooked, + * thereby managing its attachment to the global context automatically. As it turns out, within + * the timeline display, we typically need a specific combination of such model::ViewHook, and + * we need them recursively: the actual timeline::DisplayFrame, while attaching below such + * DisplayViewHooks, is in turn itself again such a sub-anchor, allowing to attach + * child display frames recursively, which is required to display sub-tracks. + */ + class DisplayViewHooks + { + public: + virtual ~DisplayViewHooks() { } ///< this is an interface + + virtual model::ViewHook& getHeadHook() =0; + virtual model::ViewHook& getBodyHook() =0; + virtual model::ViewHook& getClipHook() =0; + }; + + + + /** @todo quick-n-dirty hack. Should consider the Range TS (C++20) */ struct PixSpan { int b = 0; @@ -100,11 +122,12 @@ namespace timeline { }; /** - * Interface used by the widgets to translate themselves into screen layout. - * @todo WIP-WIP as of 11/2018 + * Interface used by the widgets to attach and translate themselves into screen layout. + * @todo WIP-WIP as of 12/2019 */ class DisplayManager : util::NonCopyable + , public DisplayViewHooks { // TimelineLayout(); diff --git a/src/stage/timeline/timeline-layout.hpp b/src/stage/timeline/timeline-layout.hpp index e48f9546a..8205c4fda 100644 --- a/src/stage/timeline/timeline-layout.hpp +++ b/src/stage/timeline/timeline-layout.hpp @@ -140,6 +140,12 @@ namespace timeline { PixSpan getPixSpan() override; void triggerDisplayEvaluation() override; + protected: /* ==== Interface: DisplayViewHooks===== */ + + model::ViewHook& getHeadHook() override { return *this; }; + model::ViewHook& getBodyHook() override { return *this; }; + model::ViewHook& getClipHook() override { return bodyCanvas_; }; + protected: /* ==== Interface: ViewHook ===== */ void hook (TrackHeadWidget&, int xPos=0, int yPos=0) override; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d53800643..7dd370d28 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -21895,6 +21895,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -22023,6 +22045,10 @@ + + + +