From 99d0f0a0aedf7a52a045bbf0d60dac719440b760 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 28 Feb 2020 22:11:00 +0100 Subject: [PATCH] Relative-Hook: investigate and resolve wrong offset on child tracks The reason was: each further ViewRefHook added again the full offset. Need to change the hierarchy and allow for this chained hooking already starting from the base interface ViewHook onward (with trivial default impl) --- src/stage/model/view-hook.hpp | 10 +- src/stage/timeline/display-manager.hpp | 55 +++++ src/stage/timeline/track-presenter.hpp | 52 +---- .../session/dummy-session-connection.cpp | 17 +- wiki/thinkPad.ichthyo.mm | 213 +++++++++++++++++- 5 files changed, 282 insertions(+), 65 deletions(-) diff --git a/src/stage/model/view-hook.hpp b/src/stage/model/view-hook.hpp index b7416f172..f26d190f6 100644 --- a/src/stage/model/view-hook.hpp +++ b/src/stage/model/view-hook.hpp @@ -66,9 +66,6 @@ namespace stage { namespace model { - template - class ViewHooked; - /** * Interface to represent _"some presentation layout entity",_ @@ -106,6 +103,13 @@ namespace model { { return Pos{*this, x,y}; } + + /** Anchor point to build chains of related View Hooks */ + virtual ViewHook& + getAnchorHook() noexcept + { + return *this; + } }; diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp index 44f012495..e03d2331a 100644 --- a/src/stage/timeline/display-manager.hpp +++ b/src/stage/timeline/display-manager.hpp @@ -74,6 +74,61 @@ namespace timeline { class TrackBody; + /** + * Special ViewHook decorator to apply a (dynamic) offset + * when attaching or moving Widgets on the shared canvas. + */ + template + class ViewRefHook + : public model::ViewHook + { + model::ViewHook& refHook_; + + + /* ==== Interface: ViewHook ===== */ + + void + hook (WID& widget, int xPos=0, int yPos=0) override + { + refHook_.hook (widget, hookAdjX (xPos), hookAdjY (yPos)); + } + + void + move (WID& widget, int xPos, int yPos) override + { + refHook_.move (widget, hookAdjX (xPos), hookAdjY (yPos)); + } + + void + remove (WID& widget) override + { + refHook_.remove (widget); + } + + void + rehook (WID& hookedWidget) noexcept override + { + refHook_.rehook (hookedWidget); + } + + /** allow to build a derived ViewRefHook with different offset */ + model::ViewHook& + getAnchorHook() noexcept override + { + return this->refHook_; + } + + protected: /* === extended Interface for relative view hook === */ + virtual int hookAdjX (int xPos) =0; + virtual int hookAdjY (int yPos) =0; + + public: + ViewRefHook(model::ViewHook& baseHook) + : refHook_{baseHook.getAnchorHook()} + { } + }; + + /** * Interface: a compound of anchoring facilities. * With the help of view-hooking, some detail presentation component diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 3c59f3514..88dde4da2 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -70,54 +70,6 @@ namespace timeline { using std::unique_ptr; - /** - * ViewHook decorator to apply a (dynamic) offset - * when attaching or moving Widgets on the shared canvas. - */ - template - class CanvasOffsetHook - : public model::ViewHook - { - model::ViewHook& refHook_; - - - /* ==== Interface: ViewHook ===== */ - - void - hook (WID& widget, int xPos=0, int yPos=0) override - { - refHook_.hook (widget, hookAdjX (xPos), hookAdjY (yPos)); - } - - void - move (WID& widget, int xPos, int yPos) override - { - refHook_.move (widget, hookAdjX (xPos), hookAdjY (yPos)); - } - - void - remove (WID& widget) override - { - refHook_.remove (widget); - } - - void - rehook (WID& hookedWidget) noexcept override - { - refHook_.rehook (hookedWidget); - } - - protected: /* === extended Interface for relative view hook === */ - virtual int hookAdjX (int xPos) =0; - virtual int hookAdjY (int yPos) =0; - - public: - CanvasOffsetHook(model::ViewHook& refHook) - : refHook_{refHook} - { } - }; - - /** * Reference frame to organise the presentation related to a specific Track in the Timeline-GUI. * With the help of such a common frame of reference, we solve the problem that each individual @@ -127,7 +79,7 @@ namespace timeline { class DisplayFrame : util::NonCopyable , public DisplayViewHooks - , public CanvasOffsetHook + , public ViewRefHook { ViewHooked head_; ViewHooked body_; @@ -146,7 +98,7 @@ namespace timeline { public: DisplayFrame (DisplayViewHooks& displayAnchor) - : CanvasOffsetHook{displayAnchor.getClipHook()} + : ViewRefHook{displayAnchor.getClipHook()} , head_{displayAnchor.getHeadHook()} , body_{displayAnchor.getBodyHook()} { } diff --git a/src/steam/mobject/session/dummy-session-connection.cpp b/src/steam/mobject/session/dummy-session-connection.cpp index e01fc9046..a369dc8f1 100644 --- a/src/steam/mobject/session/dummy-session-connection.cpp +++ b/src/steam/mobject/session/dummy-session-connection.cpp @@ -77,7 +77,10 @@ namespace mobject { namespace session { namespace { //Implementation details.... - + + /** @note timeline(toplevel) follows a special convention: + * initial population already includes track fork (root). + */ GenNode emptyTimeline (string baseID, RandID const& forkRootID) { @@ -115,17 +118,19 @@ namespace session { } //(End)Implementation details.... - DummySessionConnection::~DummySessionConnection() { } - - DummySessionConnection::DummySessionConnection() - { - } /** storage for the Singleton accessor */ lib::Depend DummySessionConnection::instance; + DummySessionConnection::DummySessionConnection() + { } + + DummySessionConnection::~DummySessionConnection() { } + + + /** * Build a population diff message to describe a specific session structure to add */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 54f4b5aa5..6ac6e16fc 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -26529,12 +26529,7 @@ - - - - - - + @@ -26548,6 +26543,212 @@ + + + + + + + + + + + +

+ direkt in der Berechnungs-Schleife erkennen, wenn wir den Präfix-Bereich durchschritten haben +

+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ daher Policy ändern: jeder schlägt den totalen absoluten  Offset drauf +

+ + +
+ +
+ + + + + + +

+ ...und dieser muß deshalb auch schon eine Funktion getAnchorHook() auf dem API bieten +

+ + +
+
+ + + +
+
+ + +