From 3102de9d8a14c326c8fbb1bcf7e0f89c7e7b1823 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 18 Jul 2019 19:44:04 +0200 Subject: [PATCH] Timeline: inject sub-track into the header pane structure --- src/stage/timeline/track-head-widget.cpp | 25 +++++++++++++++++++----- src/stage/timeline/track-head-widget.hpp | 11 ++++++++--- src/stage/timeline/track-presenter.cpp | 14 ++++++------- src/stage/timeline/track-presenter.hpp | 2 +- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/stage/timeline/track-head-widget.cpp b/src/stage/timeline/track-head-widget.cpp index c5c8601ff..d98ab18eb 100644 --- a/src/stage/timeline/track-head-widget.cpp +++ b/src/stage/timeline/track-head-widget.cpp @@ -66,6 +66,7 @@ namespace timeline { : Gtk::Grid{} , nameTODO_{"?"} , treeTODO_{"↳"} + , childCnt_{0} { this->attach (nameTODO_, 0,0, 2,1); this->attach (treeTODO_, 0,1, 1,1); @@ -85,15 +86,29 @@ namespace timeline { * video editing software does -- rather, each sequence holds a _fork of nested scopes._ * This recursively nested structure is reflected in the patchbay area corresponding to * each track in the _header pane_ of the timeline display, located to the left. The - * patchbay for each track is a grid with four quadrants, and the 4th quadrant is the - * _content area,_ which is recursively extended to hold nested PatchbayWidget elements, - * corresponding to the child tracks of this track. To _fund_ this recursively extensible - * structure, we need to set up the first four quadrants + * patchbay for each track is a grid with initially four quadrants, and the 4th quadrant + * holds the _content area,_ which is again a TrackHeadWidget. Additional sub-Tracks + * are added as additional lines to the grid, while nested sub-Tracks will be handled + * recursively by the corresponding nested TrackHeadWidget. + * @note Child tracks are always appended. When tracks are reordered or deleted, + * the whole structure has to be re-built accordingly. */ void TrackHeadWidget::injectSubFork (TrackHeadWidget& subForkHead) { - UNIMPLEMENTED ("how actually to represent the track in the patchbay"); + ++childCnt_; + this->attach (subForkHead, 0, childCnt_, 1,1); + } + + + void + TrackHeadWidget::clearSubFork() + { + while (childCnt_ > 0) + { + this->remove_row (childCnt_); + --childCnt_; + } } diff --git a/src/stage/timeline/track-head-widget.hpp b/src/stage/timeline/track-head-widget.hpp index 8c80ad11c..67519b6f1 100644 --- a/src/stage/timeline/track-head-widget.hpp +++ b/src/stage/timeline/track-head-widget.hpp @@ -34,9 +34,9 @@ ** + video overlay parameters (additive, opaque, transparent) ** + video or audio _level_ (=fader) ** - how to locate this content in time (e.g. relative to some marker) - ** For each track, we show a patchbay in the timeline header pane, which serves to control - ** such aspects relevant for all content contained within the scope of this track, including - ** the sub-tracks nested therein. + ** For each track, we display a "patchbay"-like content control in the timeline header pane, + ** which serves to control such aspects relevant for all content contained within the scope + ** of this track, including the sub-tracks nested therein. ** ** @todo WIP-WIP-WIP as of 10/2018 ** @@ -74,6 +74,8 @@ namespace timeline { Gtk::Label nameTODO_; Gtk::Label treeTODO_; + uint childCnt_; + public: TrackHeadWidget(); ~TrackHeadWidget(); @@ -82,6 +84,9 @@ namespace timeline { /** Integrate the control area for a nested sub track fork. */ void injectSubFork (TrackHeadWidget& subForkHead); + + /** Discard all nested sub track display widgets. */ + void clearSubFork(); private:/* ===== Internals ===== */ diff --git a/src/stage/timeline/track-presenter.cpp b/src/stage/timeline/track-presenter.cpp index 5b6a4859f..b43bdfd42 100644 --- a/src/stage/timeline/track-presenter.cpp +++ b/src/stage/timeline/track-presenter.cpp @@ -104,17 +104,17 @@ namespace timeline { }) .matchElement ([&](GenNode const& spec, PRuler const& elm) -> bool { -// return spec.idi == ID{*elm}; ////////////////////////////////////////////////////////////TICKET #1193 : shall RulerTrack be a Tangible? + return spec.idi == ID{*elm}; }) .constructFrom ([&](GenNode const& spec) -> PRuler - { -// return make_unique (spec.idi, this->uiBus_); ///////////////////////////////TICKET #1193 : how to construct a RulerTrack? + { // »Constructor« : how to attach a new ruler track + return make_unique (spec.idi, this->uiBus_, *this); }) .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; + { + if (ID{*target} != subID) return false; + target->buildMutator (buff); + return true; })) .attach (collection(markers_) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 1581fb470..8a917b3b8 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -106,8 +106,8 @@ namespace timeline { void injectSubTrack (TrackHeadWidget& subHead, TrackBody& subBody) { + head.injectSubFork (subHead); body.attachSubTrack (&subBody); - UNIMPLEMENTED ("inject the widgets to represent a nested sub-track within this timeline track display frame"); } };