diff --git a/src/stage/timeline/patchbay-widget.cpp b/src/stage/timeline/patchbay-widget.cpp index ee0210db3..d1344481d 100644 --- a/src/stage/timeline/patchbay-widget.cpp +++ b/src/stage/timeline/patchbay-widget.cpp @@ -79,8 +79,12 @@ namespace timeline { * thus we create a disabled Adjustment for this parameter. */ PatchbayWidget::PatchbayWidget (PAdjustment const& vScroll) - : Gtk::Viewport{Gtk::Adjustment::create (0,0,0,0,0,0), vScroll} - { } + : Gtk::ScrolledWindow{Gtk::Adjustment::create (0,0,0,0,0,0), vScroll} + { + set_shadow_type (Gtk::SHADOW_NONE); + set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_EXTERNAL); // horizontal extension is fixed, using the track body vertical scrollbar + property_expand() = true; // dynamically grab additional space + } void diff --git a/src/stage/timeline/patchbay-widget.hpp b/src/stage/timeline/patchbay-widget.hpp index 4ca102c28..2d3c866e0 100644 --- a/src/stage/timeline/patchbay-widget.hpp +++ b/src/stage/timeline/patchbay-widget.hpp @@ -68,7 +68,7 @@ namespace timeline { * @todo WIP-WIP as of 4/2019 */ class PatchbayWidget - : public Gtk::Viewport + : public Gtk::ScrolledWindow { public: PatchbayWidget (PAdjustment const& vScroll); diff --git a/src/stage/timeline/track-head-widget.cpp b/src/stage/timeline/track-head-widget.cpp index ef1b08ca9..11dc5abfe 100644 --- a/src/stage/timeline/track-head-widget.cpp +++ b/src/stage/timeline/track-head-widget.cpp @@ -69,6 +69,10 @@ namespace timeline { , treeTODO_{"↳"} , childCnt_{0} { + nameTODO_.set_xalign(0); + nameTODO_.set_yalign(0); + treeTODO_.set_xalign(0); + treeTODO_.set_yalign(0.5); this->attach (nameTODO_, 0,0, 2,1); this->attach (treeTODO_, 0,1, 1,1); @@ -82,15 +86,24 @@ namespace timeline { nameTODO_.set_label (trackName); } + uint + TrackHeadWidget::getHeightAt (int left, int top) const + { + auto* cell = this->get_child_at(left,top); + if (cell == nullptr) return 0; + int actual = cell->get_height(); + int minimal=0, natural=0; + cell->get_preferred_height(minimal, natural); + return max (0, max (actual, natural)); + } + uint TrackHeadWidget::calcContentHeight() const { if (childCnt_ == 0) return calcOverallHeight(); - auto* chld1 = this->get_child_at(0,0); - auto* chld2 = this->get_child_at(1,0); - int h1 = chld1? chld1->get_height() :0; - int h2 = chld2? chld2->get_height() :0; + int h1 = getHeightAt (0,0); + int h2 = getHeightAt (1,0); return max (0, max (h1,h2)); } @@ -98,7 +111,15 @@ namespace timeline { uint TrackHeadWidget::calcOverallHeight() const { - return this->get_height(); + uint heightSum = 0; + for (uint line=0; line <= max(1u, childCnt_); ++line) + { + int h1 = getHeightAt (0,line); + int h2 = getHeightAt (1,line); + + heightSum += max (0, max (h1,h2)); + } + return heightSum; } void @@ -114,10 +135,8 @@ namespace timeline { TrackHeadWidget::increaseContentHeight(uint delta) { auto* cell = this->get_child_at(1,0); - if (not cell) - cell = this->get_child_at(0,0); REQUIRE (cell); - int h = cell->get_height(); + uint h = getHeightAt (1,0); cell->set_size_request (-1, h+delta); } diff --git a/src/stage/timeline/track-head-widget.hpp b/src/stage/timeline/track-head-widget.hpp index 9af3d38d8..337f1b711 100644 --- a/src/stage/timeline/track-head-widget.hpp +++ b/src/stage/timeline/track-head-widget.hpp @@ -104,6 +104,9 @@ namespace timeline { /** Discard all nested sub track display widgets. */ void clearFork(); + + /** get the height allocated at cell(x,y) */ + uint getHeightAt (int left, int top) const; }; diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 6898f3df9..74ccad30a 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -233,7 +233,7 @@ namespace timeline { /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1201 : test/code... remove this } - void relinkContents (DisplayEvaluation&); + void relinkContents (); }; @@ -319,26 +319,19 @@ namespace timeline { TrackPresenter::establishLayout (DisplayEvaluation& displayEvaluation) { if (displayEvaluation.isCollectPhase()) - display_.establishExtension (clips_, markers_); + { + display_.establishExtension (clips_, markers_); + for (auto& subTrack: subFork_) + subTrack->establishLayout (displayEvaluation); + } else - relinkContents (displayEvaluation); - for (auto& subTrack: subFork_) - subTrack->establishLayout (displayEvaluation); - } - - /** second pass of the DisplayEvaluation: - * reassemble content to match adjusted layout - * @todo 2/2021 WIP-WIP initial draft; many aspects still unclear - */ - inline void - TrackPresenter::relinkContents (DisplayEvaluation& displayEvaluation) - { - for (auto& clip: clips_) - clip->relink(); - for (auto& mark: markers_) - mark->relink(); - // re-sync and match the header / body display - display_.sync_and_balance (displayEvaluation); + { // recursion first, so all sub-Tracks are already balanced + for (auto& subTrack: subFork_) + subTrack->establishLayout (displayEvaluation); + this->relinkContents(); + // re-sync and match the header / body display + display_.sync_and_balance (displayEvaluation); + } } /** @@ -363,6 +356,20 @@ namespace timeline { this->head_.accommodateContentHeight (maxVSize); } + /** second pass of the DisplayEvaluation: + * reassemble content to match adjusted layout + * @todo 2/2021 WIP-WIP initial draft; many aspects still unclear + */ + inline void + TrackPresenter::relinkContents () + { + for (auto& clip: clips_) + clip->relink(); + for (auto& mark: markers_) + mark->relink(); + } + + /** re-flow and adjust after the global layout has been established * At this point we can assume that both header and body are updated * and have valid extensions within their perimeter. But the coordination diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 1d862125a..e70688675 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -21947,10 +21947,10 @@ - + - + @@ -22082,9 +22082,9 @@ - + - + @@ -22143,10 +22143,10 @@ - + - + @@ -22485,8 +22485,47 @@ - - + + + + + + + + +

+ ...nachdem erstmals ein size-request gesetzt wurde, hat sich die tatsächliche Höhe des Widget noch nicht verändert (das wird erst mit dem nachfolgenden resize-event vollzogen). Aber der size-request spiegelt sich sofort in der desired_height wieder. Wir müssen also die Ermittlung der "aktuellen" Höhe darauf aufbauen, damit die schon vorgenommenen Anpassungen nicht nochmal im Delta landen +

+ +
+ +
+ + + + + + + + + +

+ damit die Höhen für die Kind-Tracks bereits gesetzt sind, wenn die Gesamthöhe des Parent-Track betrachtet wird +

+ +
+
+
+ + + + + + + + + +