From 1cf2e459c630a0232526299672583e64ae4e0280 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 15 Dec 2018 06:00:16 +0100 Subject: [PATCH] Timeline: consider to turn RulerTrack into a part of the systematic UI model ...meaing - it can be diff mutated - it is attached to the UI-Bus - it has persistent presentation state --- src/common/ui-protocol.cpp | 1 + src/include/ui-protocol.hpp | 1 + src/stage/timeline/ruler-track.cpp | 18 +++---------- src/stage/timeline/ruler-track.hpp | 37 +++++++++----------------- src/stage/timeline/track-body.hpp | 29 ++++++++++++++++++-- src/stage/timeline/track-presenter.cpp | 20 ++++++++++++++ src/stage/timeline/track-presenter.hpp | 3 ++- wiki/thinkPad.ichthyo.mm | 22 +++++++++++---- 8 files changed, 84 insertions(+), 47 deletions(-) diff --git a/src/common/ui-protocol.cpp b/src/common/ui-protocol.cpp index 4f8674d55..8fa10ae16 100644 --- a/src/common/ui-protocol.cpp +++ b/src/common/ui-protocol.cpp @@ -35,6 +35,7 @@ namespace stage { const Symbol TYPE_Fork{"Fork"}; const Symbol TYPE_Clip{"Clip"}; + const Symbol TYPE_Ruler{"Ruler"}; const Symbol TYPE_Marker{"Marker"}; const Symbol TYPE_Channel{"Channel"}; const Symbol TYPE_Effect{"Effect"}; diff --git a/src/include/ui-protocol.hpp b/src/include/ui-protocol.hpp index 9d920331a..8ad85e1b6 100644 --- a/src/include/ui-protocol.hpp +++ b/src/include/ui-protocol.hpp @@ -74,6 +74,7 @@ namespace stage { extern const Symbol TYPE_Fork; extern const Symbol TYPE_Clip; + extern const Symbol TYPE_Ruler; extern const Symbol TYPE_Marker; extern const Symbol TYPE_Channel; extern const Symbol TYPE_Effect; diff --git a/src/stage/timeline/ruler-track.cpp b/src/stage/timeline/ruler-track.cpp index b529ff44f..58fde7068 100644 --- a/src/stage/timeline/ruler-track.cpp +++ b/src/stage/timeline/ruler-track.cpp @@ -22,10 +22,10 @@ /** @file ruler-track.cpp - ** Implementation details regarding custom drawing of timeline and - ** frame count ticks at the top of the TimelineCanvas. + ** Implementation details regarding custom drawing of track overview + ** and time code ticks and markers onto the TimelineCanvas. ** - ** @todo WIP-WIP-WIP as of 12/2016 + ** @todo WIP-WIP-WIP as of 12/2018 ** */ @@ -76,13 +76,6 @@ namespace timeline { } - void - RulerTrack::setTrackName (cuString& trackName) - { - TODO ("is the track name of any relevance for the TrackBody widget?"); - } - - /** * recursively calculate the height in pixels to display this track, * including all nested sub-tracks @@ -90,10 +83,7 @@ namespace timeline { uint RulerTrack::calcHeight() { - uint heightSum = overviewHeight_ + contentHeight_; - for (TrackBody* subTrack : subTracks_) - heightSum += subTrack->calcHeight(); - return heightSum; + UNIMPLEMENTED ("calculate display height of the overview ruler in pixels"); } diff --git a/src/stage/timeline/ruler-track.hpp b/src/stage/timeline/ruler-track.hpp index 17c559511..94f364478 100644 --- a/src/stage/timeline/ruler-track.hpp +++ b/src/stage/timeline/ruler-track.hpp @@ -22,22 +22,17 @@ /** @file ruler-track.hpp - ** Timeline presentation helper to organise drawing of the time overview ruler. + ** Timeline presentation helper to organise drawing of the overview rulers. ** The scrollable body part of the timeline display relies on custom drawing onto ** a ["widget canvas"](\ref TimelineCanvas) for the nested track content; above - ** this area we build a horizontal ruler to show the timecode and frame count - ** references plus any markers, ranges and locators. Since these need to be - ** aligned precisely with the content, we employ custom drawing for this - ** part as well. The TimelineRuler helper -- like any parts of the coordinated - ** TimelineLayout, are referred to from and used by the BodyCanvasWidget for - ** offloading specific parts of the drawing routines. - ** Actually, this space is just a working area and created by custom - ** drawing on the [timeline canvas](\ref timeline::BodyCanvasWidget); - ** yet for coordination of a globally consistent timeline layout, each - ** track display is coordinated by a TrackPresenter, which corresponds - ** to a session::Fork and directly controls the respective display elements - ** in the [header pane](\ref timeline::HeaderPaneWidget) and the display of the - ** timeline body, which is actually a canvas for custom drawing. + ** this track content area we build a horizontal ruler to show the timecode or + ** frame count references plus any markers, ranges and locators. In case of + ** group tracks or collapsed tracks, a synopsis of the content may be rendered + ** into this overview bar. Since any of these display elements need to be aligned + ** precisely with the content, we employ custom drawing for the rulers as well. + ** The RulerTrack -- like any parts of the coordinated TimelineLayout, will be + ** referred to from and used by the BodyCanvasWidget for offloading specific + ** parts of the drawing routines. ** ** @todo WIP-WIP-WIP as of 12/2018 ** @@ -66,17 +61,9 @@ namespace timeline { /** - * Helper to organise and draw the time overview ruler at the top of the - * timeline BodyCanvasWidget. Support custom drawing onto the TimelineCanvas - * to show the timecode or frame count ticks plus any markers, ranges and locators... - * TrackBody units work together with the TimelineCanvas, which arranges all - * elements placed into the tracks and performs custom drawing to mark the - * working space available for placing those elements (Clips, Effects, Markers). - * A given TrackBody works with coordinates relative to its vertical starting point; - * coordinates on the TimelineCanvas operate from top downwards. The fundamental - * task of a TrackBody is to find out about its own overall height, including the - * overall height required by all its nested children. Moreover, the height of - * the content area needs to be negotiated with the actual content elements. + * Helper to organise and draw the time or content overview ruler at the top of the + * timeline track display. The purpose is to support custom drawing onto the TimelineCanvas + * to show rendered content, timecode or frame count ticks plus any markers, ranges and locators... * @todo WIP-WIP as of 10/2018 */ class RulerTrack diff --git a/src/stage/timeline/track-body.hpp b/src/stage/timeline/track-body.hpp index cade5a7b9..cdc4a0d5c 100644 --- a/src/stage/timeline/track-body.hpp +++ b/src/stage/timeline/track-body.hpp @@ -41,10 +41,11 @@ #define STAGE_TIMELINE_TRACK_BODY_H #include "stage/gtk-base.hpp" +#include "stage/timeline/ruler-track.hpp" //#include "lib/util.hpp" -//#include +#include #include @@ -52,6 +53,8 @@ namespace stage { namespace timeline { + class TrackPresenter; + /** * Helper to organise and draw the space allocated for a fork of sub-tracks. @@ -70,8 +73,12 @@ namespace timeline { uint overviewHeight_; uint contentHeight_; + using PRuler = std::unique_ptr; + using Rulers = std::vector; + using SubTracks = std::vector; + Rulers rulers_; SubTracks subTracks_; public: @@ -82,8 +89,26 @@ namespace timeline { uint calcHeight(); + private:/* ===== Internals ===== */ - + + /** + * Allow the TrackPresenter to manage the rulers + * The collection of rulers is part of the systematic UI model + * and thus formally a direct child of the TrackPresenter; however they + * are only relevant for the immediate display and interaction mechanics, + * thus we store them right here, close to usage site. + * @note Ruler entries can be added and removed by diff message, but since + * the UI is performed single threaded, these mutations never interfer + * with display evaluation passes. + */ + Rulers& + bindRulers() + { + return rulers_; + } + + friend class TrackPresenter; }; diff --git a/src/stage/timeline/track-presenter.cpp b/src/stage/timeline/track-presenter.cpp index 87194ec6b..17b08a246 100644 --- a/src/stage/timeline/track-presenter.cpp +++ b/src/stage/timeline/track-presenter.cpp @@ -85,9 +85,29 @@ namespace timeline { using PFork = unique_ptr; using PClip = unique_ptr; using PMarker = unique_ptr; + using PRuler = unique_ptr; buffer.create ( TreeMutator::build() + .attach (collection(display_.body.bindRulers()) + .isApplicableIf ([&](GenNode const& spec) -> bool + { // »Selector« : require object-like sub scope with type-field "Ruler" + return TYPE_Ruler == spec.data.recordType(); + }) + .matchElement ([&](GenNode const& spec, PRuler const& elm) -> bool + { +// return spec.idi == ID{*elm}; ////////////////////////////////////////////////////////////TICKET #1193 : shall RulerTrack be a Tangible? + }) + .constructFrom ([&](GenNode const& spec) -> PRuler + { +// return make_unique (spec.idi, this->uiBus_); ///////////////////////////////TICKET #1193 : how to construct a RulerTrack? + }) + .buildChildMutator ([&](PRuler& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool + { ///////////////////////////////TICKET #1193 : do we even want to "mutate" a ruler? +// if (ID{*target} != subID) return false; +// target->buildMutator (buff); +// return true; + })) .attach (collection(markers_) .isApplicableIf ([&](GenNode const& spec) -> bool { // »Selector« : require object-like sub scope with type-field "Marker" diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 555104332..eb627f6e5 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -124,8 +124,9 @@ namespace timeline { ~TrackPresenter(); /** - * @param identity used to refer to a corresponding session::Fork in the Session + * @param id identity used to refer to a corresponding session::Fork * @param nexus a way to connect this Controller to the UI-Bus. + * @param anchorDisplay a one-way closure to attach into the display fabric */ template TrackPresenter (ID id, ctrl::BusTerm& nexus, FUN anchorDisplay) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 407aa9bad..c76bbdfa7 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -19415,8 +19415,15 @@ - - + + + + + + + + + @@ -21740,13 +21747,13 @@ - - - + + + @@ -21754,6 +21761,11 @@ + + + + +