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)
This commit is contained in:
Fischlurch 2018-10-31 03:52:24 +01:00
parent 0aa4a8cb42
commit 04b665afd1
6 changed files with 89 additions and 18 deletions

View file

@ -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;
}

View file

@ -75,7 +75,10 @@ namespace timeline {
class TimelineCanvas
: public Gtk::Layout
{
public:
TrackBody* rootBody_;
TimelineCanvas();
};

View file

@ -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

View file

@ -45,7 +45,7 @@
//#include "lib/util.hpp"
//#include <memory>
//#include <vector>
#include <vector>
@ -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<TrackBody*>;
SubTracks subTracks_;
public:
TrackBody ();
~TrackBody();
uint calcHeight();
private:/* ===== Internals ===== */
};

View file

@ -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)
{

View file

@ -18908,7 +18908,7 @@
<icon BUILTIN="idea"/>
</node>
</node>
<node CREATED="1540511179218" ID="ID_1592328868" MODIFIED="1540597814664" TEXT="Problem: Ankerpunkt">
<node CREATED="1540511179218" FOLDED="true" ID="ID_1592328868" MODIFIED="1540951696891" TEXT="Problem: Ankerpunkt">
<icon BUILTIN="button_ok"/>
<node CREATED="1540511250489" ID="ID_49278916" MODIFIED="1540511273407" TEXT="wie h&#xe4;ngt man die ganze Struktur auf?"/>
<node CREATED="1540511274366" ID="ID_1134388060" MODIFIED="1540511281241" TEXT="L&#xf6;sungsans&#xe4;tze">
@ -19039,7 +19039,7 @@
</node>
<node CREATED="1540588158613" ID="ID_725383313" MODIFIED="1540588172897" TEXT="Funktor ist...">
<node CREATED="1540588173682" ID="ID_1607525948" MODIFIED="1540588180650" TEXT="entweder ein virtueller dispatch"/>
<node CREATED="1540588181550" ID="ID_1634888629" MODIFIED="1540588240683" TEXT="oder de-factor generisch">
<node CREATED="1540588181550" ID="ID_1634888629" MODIFIED="1540951684741" TEXT="oder de-facto generisch">
<linktarget COLOR="#14409c" DESTINATION="ID_1634888629" ENDARROW="Default" ENDINCLINATION="-255;27;" ID="Arrow_ID_797597310" SOURCE="ID_417702154" STARTARROW="None" STARTINCLINATION="224;-18;"/>
</node>
</node>
@ -19146,6 +19146,24 @@
</node>
<node CREATED="1540641317386" ID="ID_151954769" MODIFIED="1540684353686" TEXT="Canvas">
<linktarget COLOR="#a9b4c1" DESTINATION="ID_151954769" ENDARROW="Default" ENDINCLINATION="68;9;" ID="Arrow_ID_1923805019" SOURCE="ID_18552766" STARTARROW="None" STARTINCLINATION="110;25;"/>
<node CREATED="1540951718734" HGAP="56" ID="ID_179159881" MODIFIED="1540951729689" TEXT="TrackBody" VSHIFT="11">
<node CREATED="1540951732747" ID="ID_879954288" MODIFIED="1540951770897" TEXT="kein Widget, sondern eine Hilfs-Struktur"/>
<node CREATED="1540951833141" ID="ID_387631457" MODIFIED="1540951859869" TEXT="erledigt f&#xfc;r den Canvas das Zeichnen f&#xfc;r einen Track"/>
<node CREATED="1540951862399" ID="ID_708158546" MODIFIED="1540951902567" TEXT="relative Koordinaten (und sowiso nur vertikal)"/>
<node CREATED="1540951873159" ID="ID_1843757439" MODIFIED="1540951880554" TEXT="kennt aber seine eigene H&#xf6;he"/>
<node CREATED="1540951934151" ID="ID_1702719060" MODIFIED="1540951945593" TEXT="Bestandteile">
<node CREATED="1540951946493" ID="ID_803471574" MODIFIED="1540951952401" TEXT="overview ruler"/>
<node CREATED="1540951953036" ID="ID_1163326543" MODIFIED="1540951958127" TEXT="content area"/>
<node CREATED="1540951987535" ID="ID_1044870207" MODIFIED="1540952016368" TEXT="sub-content"/>
<node CREATED="1540952017027" ID="ID_1004640509" MODIFIED="1540952034477" TEXT="Sequenz von (nested) sub TrackBody"/>
</node>
<node CREATED="1540953620811" ID="ID_421197092" MODIFIED="1540953623748" TEXT="Aufgaben">
<node CREATED="1540953625171" ID="ID_1987245010" MODIFIED="1540953631853" TEXT="sub-TrackBody verwalten"/>
<node CREATED="1540953632393" ID="ID_132647407" MODIFIED="1540953641353" TEXT="gesamt-H&#xf6;he ermitteln"/>
<node CREATED="1540953791364" ID="ID_540126417" MODIFIED="1540953808931" TEXT="vertikale Koordinaten zum Platzieren von Content ermitteln"/>
<node CREATED="1540953642160" ID="ID_1963147841" MODIFIED="1540953662125" TEXT="Hintergrund f&#xfc;r eigenen Bereich zeichnen"/>
</node>
</node>
</node>
</node>
</node>