From 04b665afd1224beb9531b3d50ccfbb9517521ced Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 31 Oct 2018 03:52:24 +0100 Subject: [PATCH] Timeline: concept for the TrackBody helpers these recursively nested helper entities work together with the TimelineCanvas and enable the latter to draw the track background in the Timeline Widget and to find out about the vertical coordinates where to place content (Clip, Effects, Markers) --- src/gui/timeline/body-canvas-widget.cpp | 11 +++++-- src/gui/timeline/body-canvas-widget.hpp | 3 ++ src/gui/timeline/track-body.cpp | 42 ++++++++++++++++++------- src/gui/timeline/track-body.hpp | 24 ++++++++++++-- src/gui/timeline/track-presenter.hpp | 5 +++ wiki/thinkPad.ichthyo.mm | 22 +++++++++++-- 6 files changed, 89 insertions(+), 18 deletions(-) diff --git a/src/gui/timeline/body-canvas-widget.cpp b/src/gui/timeline/body-canvas-widget.cpp index 10e06f7be..284688036 100644 --- a/src/gui/timeline/body-canvas-widget.cpp +++ b/src/gui/timeline/body-canvas-widget.cpp @@ -58,6 +58,13 @@ namespace timeline { + TimelineCanvas::TimelineCanvas() + : Gtk::Layout{} + , rootBody_{nullptr} + { } + + + BodyCanvasWidget::~BodyCanvasWidget() { } @@ -87,9 +94,9 @@ namespace timeline { * of a Timeline, will also prepare the grounding for any other nested entities to be drawn on top. */ void - BodyCanvasWidget::installForkRoot (TrackBody& rootTrackHead) + BodyCanvasWidget::installForkRoot (TrackBody& rootTrackBody) { - UNIMPLEMENTED ("how actually to represent the track bode on the canvas"); + canvas_.rootBody_ = &rootTrackBody; } diff --git a/src/gui/timeline/body-canvas-widget.hpp b/src/gui/timeline/body-canvas-widget.hpp index 47d68e5e2..47b1743e6 100644 --- a/src/gui/timeline/body-canvas-widget.hpp +++ b/src/gui/timeline/body-canvas-widget.hpp @@ -75,7 +75,10 @@ namespace timeline { class TimelineCanvas : public Gtk::Layout { + public: + TrackBody* rootBody_; + TimelineCanvas(); }; diff --git a/src/gui/timeline/track-body.cpp b/src/gui/timeline/track-body.cpp index 081a85842..f953432bc 100644 --- a/src/gui/timeline/track-body.cpp +++ b/src/gui/timeline/track-body.cpp @@ -56,20 +56,40 @@ namespace gui { namespace timeline { - - - - - TrackBody::TrackBody () - { - } - - - TrackBody::~TrackBody() - { + namespace { + const uint DEFAULT_OVERVIEW_HEIGHT_px = 20; + const uint DEFAULT_CONTENT_HEIGHT_px = 80; } + TrackBody::TrackBody() + : overviewHeight_{DEFAULT_OVERVIEW_HEIGHT_px} + , contentHeight_{DEFAULT_OVERVIEW_HEIGHT_px} + , subTracks_{} + { } + + + TrackBody::~TrackBody() + { + TODO ("detach from parent; store a functor or backreference"); + } + + + /** + * recursively calculate the height in pixels to display this track, + * including all nested sub-tracks + */ + uint + TrackBody::calcHeight() + { + uint heightSum = overviewHeight_ + contentHeight_; + for (TrackBody* subTrack : subTracks_) + heightSum += subTrack->calcHeight(); + return heightSum; + } + + + }}// namespace gui::timeline diff --git a/src/gui/timeline/track-body.hpp b/src/gui/timeline/track-body.hpp index df8479122..0abcdf4e5 100644 --- a/src/gui/timeline/track-body.hpp +++ b/src/gui/timeline/track-body.hpp @@ -45,7 +45,7 @@ //#include "lib/util.hpp" //#include -//#include +#include @@ -54,14 +54,32 @@ namespace timeline { /** - * @todo WIP-WIP as of 12/2016 + * Helper to organise and draw the space allocated for a fork of sub-tracks. + * 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 require by all its nesting children. Moreover, the height of + * the content area needs to be negotiated with the actual content elements. + * @todo WIP-WIP as of 10/2018 */ class TrackBody { + uint overviewHeight_; + uint contentHeight_; + + using SubTracks = std::vector; + + SubTracks subTracks_; + public: TrackBody (); ~TrackBody(); - + + uint calcHeight(); + private:/* ===== Internals ===== */ }; diff --git a/src/gui/timeline/track-presenter.hpp b/src/gui/timeline/track-presenter.hpp index 39d9c1a46..a2a2244ee 100644 --- a/src/gui/timeline/track-presenter.hpp +++ b/src/gui/timeline/track-presenter.hpp @@ -87,6 +87,11 @@ namespace timeline { anchorDisplay (head, body); } + ~DisplayFrame() + { + TODO ("cause the managed presentation elements to detach from their parents"); + } + void injectSubTrack (TrackHeadWidget& head, TrackBody& body) { diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 6f6782833..50f931a66 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -18908,7 +18908,7 @@ - + @@ -19039,7 +19039,7 @@ - + @@ -19146,6 +19146,24 @@ + + + + + + + + + + + + + + + + + +