Timeline: also observe additional space for decorations added via CSS
This commit is contained in:
parent
346b5ae769
commit
737505979b
4 changed files with 81 additions and 6 deletions
|
|
@ -93,6 +93,31 @@ namespace timeline {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adjust the vertical space to accommodate for additional decorations
|
||||
* as required by the CSS style rules. Our custom drawing code observes
|
||||
* the same adjustments when drawing background and frame borders.
|
||||
*/
|
||||
void
|
||||
setupAdditionalTrackPadding_fromCSS()
|
||||
{
|
||||
StyleC styleRuler{trackRulerStyle.getAdvice()};
|
||||
StyleC styleBody {trackBodyStyle.getAdvice()};
|
||||
|
||||
int decorationRuler = styleRuler->get_margin().get_top()
|
||||
+ styleRuler->get_margin().get_bottom()
|
||||
+ styleRuler->get_border().get_top()
|
||||
+ styleRuler->get_border().get_bottom()
|
||||
+ styleRuler->get_padding().get_top()
|
||||
+ styleRuler->get_padding().get_bottom()
|
||||
;
|
||||
int decorationBody = styleBody->get_padding().get_top()
|
||||
+ styleBody->get_padding().get_bottom()
|
||||
;
|
||||
TrackBody::setupDecoration(decorationBody, decorationRuler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal drawing routines to paint the nested system
|
||||
* of insets and rulers in the track content display
|
||||
|
|
@ -431,6 +456,7 @@ namespace timeline {
|
|||
{
|
||||
if (rootBody_ and isnil (profile_))
|
||||
{
|
||||
setupAdditionalTrackPadding_fromCSS();
|
||||
layout_.triggerDisplayEvaluation();
|
||||
rootBody_->establishTrackSpace (profile_);
|
||||
adjustCanvasHeight(layout_.getPixSpan().delta(),
|
||||
|
|
|
|||
|
|
@ -78,6 +78,11 @@ namespace timeline {
|
|||
}
|
||||
|
||||
|
||||
/** storage for common style/padding settings */
|
||||
uint TrackBody::contentDecoration = 0;
|
||||
uint TrackBody::rulerDecoration = 0;
|
||||
|
||||
|
||||
void
|
||||
TrackBody::setTrackName (cuString& trackName)
|
||||
{
|
||||
|
|
@ -97,6 +102,22 @@ namespace timeline {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup additional vertical padding for the decorations added through CSS.
|
||||
* Our drawing code retrieves the margin, padding and border size settings from the
|
||||
* appropriate CSS rules and adds the necessary additional space to the drawing coordinates;
|
||||
* however, since one purpose of TrackBody is to calculate overall space requirements, we also
|
||||
* need to account for this additional space. This call allows to pass in those values, which
|
||||
* will be stored in static (class) variables.
|
||||
*/
|
||||
void
|
||||
TrackBody::setupDecoration (uint content, uint ruler)
|
||||
{
|
||||
contentDecoration = content;
|
||||
rulerDecoration = ruler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* recursively calculate the height in pixels to display this track,
|
||||
* including all nested sub-tracks
|
||||
|
|
@ -104,7 +125,7 @@ namespace timeline {
|
|||
uint
|
||||
TrackBody::calcHeight()
|
||||
{
|
||||
uint heightSum = calcRulerHeight() + contentHeight_;
|
||||
uint heightSum = calcRulerHeight() + contentHeight_ + contentDecoration;
|
||||
for (TrackBody* subTrack : subTracks_)
|
||||
heightSum += subTrack->calcHeight();
|
||||
return heightSum;
|
||||
|
|
@ -122,7 +143,8 @@ namespace timeline {
|
|||
for (auto& ruler : rulers_)
|
||||
{
|
||||
overviewHeight += ruler->calcHeight()
|
||||
+ ruler->getGapHeight();
|
||||
+ ruler->getGapHeight()
|
||||
+ rulerDecoration;
|
||||
}
|
||||
return overviewHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ namespace timeline {
|
|||
class TrackBody
|
||||
{
|
||||
uint contentHeight_;
|
||||
static uint contentDecoration;
|
||||
static uint rulerDecoration;
|
||||
|
||||
using PRuler = std::unique_ptr<RulerTrack>;
|
||||
using Rulers = std::vector<PRuler>;
|
||||
|
|
@ -87,6 +89,7 @@ namespace timeline {
|
|||
~TrackBody();
|
||||
|
||||
void setTrackName (cuString&);
|
||||
static void setupDecoration (uint content, uint ruler);
|
||||
void establishTrackSpace (TrackProfile&);
|
||||
void attachSubTrack (TrackBody*);
|
||||
uint calcRulerHeight();
|
||||
|
|
|
|||
|
|
@ -23817,8 +23817,8 @@
|
|||
<arrowlink COLOR="#5590d5" DESTINATION="ID_1444331441" ENDARROW="Default" ENDINCLINATION="-449;0;" ID="Arrow_ID_1759102712" STARTARROW="None" STARTINCLINATION="98;-3;"/>
|
||||
<linktarget COLOR="#02ab84" DESTINATION="ID_840104433" ENDARROW="Default" ENDINCLINATION="1035;-107;" ID="Arrow_ID_77023730" SOURCE="ID_1092949064" STARTARROW="Default" STARTINCLINATION="106;39;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1564932652482" ID="ID_1330271110" MODIFIED="1564934138367" TEXT="alle render_background mit vollständigem Rechteck versorgen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1564932652482" ID="ID_1330271110" MODIFIED="1566525299678" TEXT="alle render_background mit vollständigem Rechteck versorgen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1565268879772" ID="ID_261041772" MODIFIED="1566401288902" TEXT="brauche berechnete Höhe(n)">
|
||||
<arrowlink COLOR="#a37084" DESTINATION="ID_31825370" ENDARROW="Default" ENDINCLINATION="145;324;" ID="Arrow_ID_1599930326" STARTARROW="Default" STARTINCLINATION="-943;-105;"/>
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
|
|
@ -23847,6 +23847,9 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1564932680606" ID="ID_695299880" MODIFIED="1564934141564" TEXT="Rahmen paßgenau einsetzen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1566525274854" ID="ID_1976574053" MODIFIED="1566525289358" TEXT="Vorsicht: auch horizontal genügend Platz schaffen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1564932712545" ID="ID_756463948" MODIFIED="1564934128901" TEXT="(optional) zusätzliche Schattierung im Overlay-Pass zeichnen">
|
||||
<linktarget COLOR="#7255d4" DESTINATION="ID_756463948" ENDARROW="Default" ENDINCLINATION="-507;0;" ID="Arrow_ID_1335568264" SOURCE="ID_909641864" STARTARROW="None" STARTINCLINATION="576;29;"/>
|
||||
|
|
@ -23866,14 +23869,35 @@
|
|||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1566518998190" ID="ID_284079883" MODIFIED="1566519017050" TEXT="Stylesheet bestimmt zusätzlichen Margin + Padding"/>
|
||||
<node CREATED="1566519017878" ID="ID_30554429" MODIFIED="1566519029065" TEXT="diese müssen mit den Werten im TrackBody verrechnet werden">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1566522092555" ID="ID_293262823" MODIFIED="1566522110192" TEXT="Konsequenz: TrackBody muß auch den Style abfragen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1566522092555" ID="ID_293262823" MODIFIED="1566524848312" TEXT="Konsequenz: TrackBody muß auch den Style abfragen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1566524821779" ID="ID_447136717" MODIFIED="1566524894982" TEXT="Lösung: via statische Funktion setzen"/>
|
||||
<node CREATED="1566524850167" ID="ID_1119976379" MODIFIED="1566524885730" TEXT="kann dann aus body-canvas-widget.cpp passieren">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...wo parktischerweise der Style-Advice in einer lokalen statischen Variablen liegt
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1566524901403" ID="ID_950799052" MODIFIED="1566524918407" TEXT="TODO: prüfen ... stimmen die Werte">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1566519037996" ID="ID_57629359" MODIFIED="1566519094001" TEXT="der zusätzliche Platz wird u.A. für den box-shadow benötigt">
|
||||
<arrowlink COLOR="#2b75cc" DESTINATION="ID_1092949064" ENDARROW="Default" ENDINCLINATION="286;83;" ID="Arrow_ID_1686979270" STARTARROW="None" STARTINCLINATION="572;0;"/>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1566524922429" ID="ID_1618879281" MODIFIED="1566524941579" TEXT="für den Overlay-Pass genau analoge Berechnungen machen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue