Timeline: push the trackname attribute down into the widget/display

...in accordance to our general design guideline: we don't duplicate
actual model values within the controllers/presenters, since our widgets
act themselves as view-model
This commit is contained in:
Fischlurch 2018-11-10 02:59:23 +01:00
parent c8dc5a24a8
commit 866d7efe0a
8 changed files with 53 additions and 16 deletions

View file

@ -64,7 +64,7 @@ namespace timeline {
TrackBody::TrackBody (cuString trackName)
TrackBody::TrackBody()
: overviewHeight_{DEFAULT_OVERVIEW_HEIGHT_px}
, contentHeight_{DEFAULT_OVERVIEW_HEIGHT_px}
, subTracks_{}
@ -77,6 +77,13 @@ namespace timeline {
}
void
TrackBody::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

View file

@ -78,9 +78,11 @@ namespace timeline {
SubTracks subTracks_;
public:
TrackBody (cuString trackName);
TrackBody();
~TrackBody();
void setTrackName (cuString&);
uint calcHeight();
private:/* ===== Internals ===== */

View file

@ -62,9 +62,9 @@ namespace timeline {
TrackHeadWidget::TrackHeadWidget (cuString& trackName)
TrackHeadWidget::TrackHeadWidget()
: Gtk::Grid{}
, nameTODO_{trackName}
, nameTODO_{"?"}
, treeTODO_{""}
{
this->attach (nameTODO_, 0,0, 2,1);
@ -74,6 +74,12 @@ namespace timeline {
}
void
TrackHeadWidget::setTrackName (cuString& trackName)
{
nameTODO_.set_label (trackName);
}
/**
* @remark The Lumiera Timeline model does not rely on a list of tracks, as most conventional
* video editing software does -- rather, each sequence holds a _fork of nested scopes._

View file

@ -74,9 +74,11 @@ namespace timeline {
Gtk::Label treeTODO_;
public:
TrackHeadWidget (cuString& trackName);
TrackHeadWidget();
~TrackHeadWidget();
void setTrackName (cuString&);
/** Integrate the control area for a nested sub track fork. */
void injectSubFork (TrackHeadWidget& subForkHead);

View file

@ -152,7 +152,7 @@ namespace timeline {
}))
.change(ATTR_name, [&](string val)
{ // »Attribute Setter« : receive a new value for the track name field
name_ = val;
this->setTrackName (val);
}));
}

View file

@ -80,9 +80,9 @@ namespace timeline {
TrackBody body;
template<class FUN>
DisplayFrame (cuString& name, FUN anchorDisplay)
: head{name}
, body{name}
DisplayFrame (FUN anchorDisplay)
: head{}
, body{}
{
anchorDisplay (head, body);
}
@ -92,6 +92,13 @@ namespace timeline {
TODO ("cause the managed presentation elements to detach from their parents");
}
void
setTrackName (cuString& name)
{
head.setTrackName (name);
body.setTrackName (name); ///////////////////////////////////TICKET #1017 -- TODO 11/18 : not clear yet if TrackBody needs to know its name
}
void
injectSubTrack (TrackHeadWidget& head, TrackBody& body)
{
@ -106,7 +113,6 @@ namespace timeline {
class TrackPresenter
: public model::Controller
{
string name_;
DisplayFrame display_;
vector<unique_ptr<TrackPresenter>> subFork_;
@ -124,12 +130,13 @@ namespace timeline {
template<class FUN>
TrackPresenter (ID id, ctrl::BusTerm& nexus, FUN anchorDisplay)
: Controller{id, nexus}
, name_{id.getSym()} // fallback initialise track-name from human-readable ID symbol
, display_{name_, anchorDisplay}
, display_{anchorDisplay}
, subFork_{}
, markers_{}
, clips_{}
{ }
{
setTrackName (id.getSym()); // fallback initialise track-name from human-readable ID symbol
}
/** set up a binding to respond to mutation messages via UiBus */
@ -137,6 +144,13 @@ namespace timeline {
private:/* ===== Internals ===== */
/** invoked via diff to show a (changed) track name */
void
setTrackName (string name)
{
display_.setTrackName (name);
}
};

View file

@ -109,9 +109,9 @@ namespace session {
DummySessionConnection::fabricateSeq1 (string baseID)
{
const RandID forkRootID{gui::ATTR_fork};
const GenNode timeline = emptyTimeline (baseID, forkRootID);
const GenNode rootTrackName{string{gui::ATTR_name}, "Track-"+baseID}
, FORK_ROOT = MakeRec().genNode(forkRootID)
const GenNode timeline = emptyTimeline (baseID, forkRootID)
, rootTrackName = GenNode{string{gui::ATTR_name}, "Track-"+baseID}
, FORK_ROOT = MakeRec().genNode(forkRootID)
;
return MutationMessage{ ins (timeline)

View file

@ -19326,6 +19326,12 @@
<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 BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1541814972977" HGAP="8" ID="ID_1482433902" MODIFIED="1541814987634" TEXT="offen..." VSHIFT="5">
<icon BUILTIN="bell"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1541814988759" ID="ID_327310802" MODIFIED="1541815003222" TEXT="mu&#xdf; der TrackBody seinen Namen kennen?">
<icon BUILTIN="help"/>
</node>
</node>
</node>
</node>
</node>