Clip: fill in minimal implementation to make the clip appear

This commit is contained in:
Fischlurch 2021-01-25 03:06:27 +01:00
parent 21f6e61fd3
commit 5b33605469
8 changed files with 170 additions and 28 deletions

View file

@ -130,6 +130,16 @@ namespace timeline {
,getClipContentCanvas()
,std::nullopt); /////////////////////////TICKET #1213 : time → horizontal extension : how to represent "always" / "the whole track"??
}))
.change(ATTR_name, [&](string val)
{ // »Attribute Setter« : receive a new value for the clip name field
REQUIRE (widget_);
widget_->setClipName (val);
})
.change(ATTR_timing, [&](TimeSpan val)
{
REQUIRE (widget_);
widget_->changeTiming (val);
})
//-Diff-Change-Listener----------------
.onLocalChange ([this]()
{
@ -154,7 +164,9 @@ namespace timeline {
int
ClipPresenter::determineRequiredVerticalExtension() const
{
UNIMPLEMENTED ("any details regarding clip presentation");
REQUIRE (widget_);
return widget_->calcRequiredHeight()
+ widget_->getVerticalOffset();
}

View file

@ -106,6 +106,7 @@
//using Gtk::Widget;
//using sigc::mem_fun;
//using sigc::ptr_fun;
using lib::time::TimeVar;
using util::unConst;
//using std::cout;
//using std::endl;
@ -149,6 +150,9 @@ namespace timeline {
, util::NonCopyable
{
WidgetHook& display_;
uString clipName_;
TimeVar start_; /////////////////////////////////////////////////////////////////TICKET #1038 : how to handle storage of timings??
TimeVar len_;
/* === Interface ClipDelegate === */
@ -167,15 +171,51 @@ namespace timeline {
cuString
getClipName() const override
{
return "lala LOLO"; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip name/ID
return clipName_; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip name/ID
}
void
setClipName(cuString newName) override
{
clipName_ = newName;
}
Time
getStartTime() const override
{
return Time::NEVER; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip start time
return start_; ////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip start time
}
Duration
getLen() const override
{
return Duration{this->len_};
}
void
changeTiming (TimeSpan changedTimings) override
{
this->start_ = changedTimings.start();
this->len_ = changedTimings.duration();
}
/**
* This is a mere data record without actual presentation,
* and thus can not occupy any screen extension.
*/
uint
calcRequiredHeight() const override
{
return 0;
}
uint
getVerticalOffset() const override
{
return 0;
}
WidgetHook&
getCanvas() const override
{
@ -187,12 +227,18 @@ namespace timeline {
ClipData(WidgetHook& displayAnchor)
: ClipDelegate{}
, display_{displayAnchor}
, clipName_{"?name?"}
, start_{Time::NEVER}
, len_{Duration::NIL}
{ }
/** state switch ctor */
ClipData(ClipDelegate& existing)
: ClipDelegate{}
, display_{existing.getCanvas()}
, clipName_{existing.getClipName()}
, start_{existing.getStartTime()}
, len_{existing.getLen()}
{
TODO("copy further clip presentation properties");
}
@ -203,6 +249,9 @@ namespace timeline {
: public HookedWidget
, public ClipDelegate
{
TimeVar start_; /////////////////////////////////////////////////////////////////TICKET #1038 : how to handle storage of timings??
TimeVar len_;
/* === Interface ClipDelegate === */
Appearance
@ -225,10 +274,41 @@ namespace timeline {
return this->get_label();
}
void
setClipName(cuString newName) override
{
this->set_label (newName);
}
void
changeTiming (TimeSpan changedTimings) override
{
this->start_ = changedTimings.start();
this->len_ = changedTimings.duration();
}
Time
getStartTime() const override
{
return Time::NEVER; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip start time
return this->start_; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store the clip start time
}
Duration
getLen() const override
{
return Duration{this->len_};
}
uint
getVerticalOffset() const override
{
return defaultOffsetY; ///////////////////////////////////////////////////////////////TICKET #1038 : data storage; here : store a per clip vertical offset
}
uint
calcRequiredHeight() const override
{
return this->get_height(); //////////////////////////////////////////////////////////TICKET #1038 : for the first draft we just use a Button; TODO: actual calculation here
}
WidgetHook&
@ -239,17 +319,24 @@ namespace timeline {
public:
ClipWidget(WidgetHook::Pos hookPoint, Duration dur, uString clipName)
ClipWidget(WidgetHook::Pos hookPoint, Duration dur, uString clipName) /////////////////////TICKET #1038 : it's probably wrong only to pass-in the duration, beacuse we also need to retain the start point in full precision
: HookedWidget{hookPoint, clipName}
, ClipDelegate{}
{ }
, start_{Time::NEVER}
, len_{dur}
{
show_all();
}
/** state switch ctor */
ClipWidget(ClipDelegate& existing, WidgetHook* newView)
: HookedWidget{existing.establishHookPoint(newView), existing.getClipName()}
, ClipDelegate{}
, start_{existing.getStartTime()}
, len_{existing.getLen()}
{
TODO("copy further clip presentation properties");
show_all();
}
};

View file

@ -177,10 +177,17 @@ namespace timeline {
/** human readable rendering of the clip's name or identity */
virtual cuString getClipName() const =0;
virtual void setClipName (cuString) =0;
virtual Time getStartTime() const =0;
virtual void changeTiming (TimeSpan) =0;
virtual Time getStartTime() const =0;
virtual Duration getLen() const =0;
virtual uint getVerticalOffset() const =0;
virtual WidgetHook& getCanvas() const =0;
virtual uint calcRequiredHeight() const =0;
/** (re)establish current canvas attachment coordinates,
* thereby possibly switching to a new canvas implementation

View file

@ -32,7 +32,7 @@
** pass; typically additional space requirements are discovered and propagated _as message_ to GTK,
** and so the DisplayEvaluation can be expected to be re-triggered soon thereafter.
**
** # Tasks to perform
** # Specification
**
** The basic goal is to establish a coherent vertical space allocation for all tracks within the
** timeline (while, to the contrary, the horizontal extension is a fixed requirement and can be
@ -41,7 +41,7 @@
** - buildup of a timeline::TrackProfile to accommodate those requirements and all decorations
** - adjustment of the TrackHeadWidget extensions to match the allocated track body space precisely.
**
** # Evaluation structure
** ## Evaluation structure
**
** This is an intricate collaboration of closely related elements; however, each of the aforementioned
** tasks is defined such as to operate in a self-confined way on some part of the timeline. All the
@ -49,9 +49,9 @@
** to pass on the DisplayEvaluation itself by reference, recursively. To make the overall process work,
** moreover we establish a *Requirement* to pass on this invocation _strictly in layout order_ -- which
** implies a recursive depth-first invocation proceeding *top-down* and *from left to right*. It is
** each LayoutElement's liability to recurse appropriately to make this happen.
** each LayoutElement's liability to recurse appropriately in order to make this happen.
**
** # Evaluation state and phases
** ## Evaluation state and phases
**
** The DisplayEvaluation works by direct (side)effect within the invoked elements, eventually leading
** to some of the embedded GTK widgets being resized -- which typically will re-trigger our custom drawing

View file

@ -121,6 +121,17 @@ namespace timeline {
/* ==== Code for vertical track display layout ==== */
/**
* ensure content with the given extension can be accommodated
* within this track's content area
*/
void
TrackBody::accomodateHeight(uint contentExtension)
{
if (contentExtension > contentHeight_)
contentHeight_ = contentExtension;
}
/**
* recursively calculate the height in pixels to display this track,
@ -218,7 +229,7 @@ namespace timeline {
// we render this prefix part on a separate drawing canvas,
profile.markPrefixEnd();
// ...and now we switch to the second, scrollable canvas,
// which thus needs to use adjusted coordinates for widgets.
// which uses its own local coordinates, thus restart Y-pos.
line = 0;
}
// mark offset of the actual content area relative to this track's top

View file

@ -118,6 +118,7 @@ namespace timeline {
uint establishTrackSpace (TrackProfile&);
uint calcRulerHeight();
uint calcHeight();
void accomodateHeight(uint contentExtension);
uint getContentOffsetY() { return startLine_ + contentOffset_; }

View file

@ -330,6 +330,8 @@ namespace timeline {
{
return clip->determineRequiredVerticalExtension();
}));
this->body_.accomodateHeight(maxVSize);
//////////////////////////////////////////////////////////////////////////////////////////TICKET #1211 : actually implement a coordination of head / body sizes here
int headSize = this->head_.get_height();
int bodySize = this->body_.calcHeight();
}

View file

@ -21300,7 +21300,7 @@
</node>
</node>
</node>
<node CREATED="1582991961258" FOLDED="true" ID="ID_545649889" MODIFIED="1582991965501" TEXT="pro Track">
<node CREATED="1582991961258" ID="ID_545649889" MODIFIED="1582991965501" TEXT="pro Track">
<node CREATED="1582992016890" ID="ID_1705972913" MODIFIED="1582992030828" TEXT="Aufsammeln der vertikalen Ausdehnung"/>
<node CREATED="1582992031648" ID="ID_752229981" MODIFIED="1582992037387" TEXT="Maximum + Padding"/>
<node CREATED="1582992060135" ID="ID_446948891" MODIFIED="1582992233901">
@ -21755,9 +21755,21 @@
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1583010246034" ID="ID_113344286" MODIFIED="1583677197995" TEXT="Resultat mit Wert vom Header vergleichen">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1583010246034" ID="ID_113344286" MODIFIED="1611533767877" TEXT="Resultat mit Wert vom Header abgleichen">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611527674130" ID="ID_1530876056" MODIFIED="1611533938726" TEXT="Ergebnis &#x2259; lokales Maximum &#x2192; TrackBody::contentHeight_">
<linktarget COLOR="#43447b" DESTINATION="ID_1530876056" ENDARROW="Default" ENDINCLINATION="802;689;" ID="Arrow_ID_471691943" SOURCE="ID_1232626344" STARTARROW="None" STARTINCLINATION="655;24;"/>
<icon BUILTIN="flag-yellow"/>
<node CREATED="1611533783838" ID="ID_504265049" MODIFIED="1611533798915" TEXT="Vorsicht: es sind zwei Belange">
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1611533829992" ID="ID_1527761356" MODIFIED="1611533848566" TEXT="der Content mu&#xdf; in den Content-Bereich im Track passen"/>
<node CREATED="1611533811939" ID="ID_254664541" MODIFIED="1611533828996" TEXT="Synchronisation zwischen Header und Body"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611533873746" ID="ID_1129757567" MODIFIED="1611533921023" TEXT="wo/wie werden die Sub-Tracks ber&#xfc;cksichtigt?">
<icon BUILTIN="help"/>
</node>
</node>
</node>
<node COLOR="#338800" CREATED="1583010270152" ID="ID_689332581" MODIFIED="1583606371280" TEXT="depth-first-Suche und Aktion auf dem R&#xfc;ckweg">
<icon BUILTIN="button_ok"/>
@ -21771,6 +21783,9 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1583010590180" ID="ID_253184113" MODIFIED="1583677738518" TEXT="Header-Ausgleich">
<arrowlink COLOR="#8b71ae" DESTINATION="ID_1925515175" ENDARROW="Default" ENDINCLINATION="259;-76;" ID="Arrow_ID_44202222" STARTARROW="None" STARTINCLINATION="-426;50;"/>
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611534925644" ID="ID_1754764132" MODIFIED="1611534940798" TEXT="#1211 coordinate track extension">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1583677270535" ID="ID_1729172771" MODIFIED="1583677289501" TEXT="ungekl&#xe4;rt: wann genau mu&#xdf; der Header-Ausgleich laufen?">
<icon BUILTIN="help"/>
<node CREATED="1583677300836" ID="ID_893081931" MODIFIED="1583677581501" TEXT="Plan-A">
@ -27975,13 +27990,16 @@
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1611478658033" HGAP="73" ID="ID_1825783827" MODIFIED="1611479264977" TEXT="diese L&#xf6;sung scheint tragf&#xe4;hig. Nun fertig bauen!" VSHIFT="12">
<arrowlink COLOR="#f2d4e1" DESTINATION="ID_811510338" ENDARROW="Default" ENDINCLINATION="-516;-1779;" ID="Arrow_ID_1877167801" STARTARROW="None" STARTINCLINATION="481;25;"/>
<icon BUILTIN="yes"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611479345795" HGAP="88" ID="ID_911852543" MODIFIED="1611479554687" STYLE="bubble" TEXT="einen Clip via Diff injizieren" VSHIFT="-7">
<node COLOR="#435e98" CREATED="1611479345795" HGAP="88" ID="ID_911852543" MODIFIED="1611540320555" STYLE="bubble" TEXT="einen Clip via Diff injizieren" VSHIFT="-7">
<edge COLOR="#fad1c1"/>
<icon BUILTIN="full-1"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611479345795" HGAP="88" ID="ID_1289774279" MODIFIED="1611492845512" STYLE="bubble" TEXT="ein funktionsf&#xe4;higes Clip-Widget..." VSHIFT="-7">
<edge COLOR="#fad1c1"/>
<icon BUILTIN="full-2"/>
<node CREATED="1611540326300" ID="ID_126501533" MODIFIED="1611540332119" TEXT="Clip erscheint">
<icon BUILTIN="idea"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611479345795" HGAP="94" ID="ID_915417374" MODIFIED="1611479560862" STYLE="bubble" TEXT="an der richtigen Stelle zur Anzeige bringen" VSHIFT="-7">
<edge COLOR="#fad1c1"/>
@ -28589,6 +28607,7 @@
<node CREATED="1584318751425" ID="ID_1908104469" MODIFIED="1584318760838" TEXT="nehme mal einen Gtk::Button...">
<icon BUILTIN="ksmiletris"/>
</node>
<node CREATED="1611539454282" ID="ID_1159321207" MODIFIED="1611539483874" TEXT="Data-Storage: erst mal lauter lokale Datenfelder"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611479299338" ID="ID_1803753965" MODIFIED="1611479325824" TEXT="damit die erste lauff&#xe4;hige Clip-Widget-Implementierung">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1611492890873" ID="ID_458756808" MODIFIED="1611492956892" TEXT="sollte in der seit 4/20 existierenden Implementierung bereits funktionieren">
@ -28604,24 +28623,27 @@
</html></richcontent>
<icon BUILTIN="idea"/>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1611494845768" ID="ID_591566495" MODIFIED="1611495181481" TEXT="tja....">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
UNIMPLEMENTED: clip-presenter.cpp:157: worker_3: determineRequiredVerticalExtension: any details regarding clip presentation
</p>
</body>
</html></richcontent>
<icon BUILTIN="smiley-oh"/>
<node COLOR="#338800" CREATED="1611494845768" ID="ID_591566495" MODIFIED="1611540171140" TEXT="erst mal vorl&#xe4;ufig die Datenfelder anlegen &#x27f9; kann vertikale Ausdehnung berechnen">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611527884423" ID="ID_1232626344" MODIFIED="1611533938726" TEXT="Ergebnis der DisplayEvaluation &#x2259; lokales Maximum &#x2192; TrackBody::contentHeight_ ">
<arrowlink COLOR="#43447b" DESTINATION="ID_1530876056" ENDARROW="Default" ENDINCLINATION="802;689;" ID="Arrow_ID_471691943" STARTARROW="None" STARTINCLINATION="655;24;"/>
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1583678122516" ID="ID_73602256" MODIFIED="1583678142379" TEXT="...und dessen vertikale Ausdehnung ermitteln und zur&#xfc;ckmelden">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611539501493" ID="ID_1849626018" MODIFIED="1611539513626" TEXT="TODO: &#xdc;berlegungen zur Daten-Storage">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611539517985" ID="ID_1850041925" MODIFIED="1611539580594" TEXT="macht es Sinn, f&#xfc;r alle Clip-Anzeigeformen einen gemeinsamen Daten-Record zu verwenden?">
<icon BUILTIN="help"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1611539550821" ID="ID_219259739" MODIFIED="1611539584717" TEXT="und: diesen einbetten, oder per Pointer halten und weitergeben?">
<icon BUILTIN="help"/>
</node>
</node>
</node>
<node CREATED="1583678162183" ID="ID_798000610" MODIFIED="1583678185165" TEXT="Stufe-2">
<icon BUILTIN="hourglass"/>