diff --git a/src/stage/timeline/body-canvas-widget.cpp b/src/stage/timeline/body-canvas-widget.cpp index 62bb6dbb4..2230a50b1 100644 --- a/src/stage/timeline/body-canvas-widget.cpp +++ b/src/stage/timeline/body-canvas-widget.cpp @@ -72,6 +72,8 @@ namespace timeline { namespace { // details of track background painting const int INITIAL_TIMERULER_HEIGHT_px = 30; + const int INITIAL_CONTENT_HEIGHT_px = 100; + const int INITIAL_CONTENT_WIDTH_px = 200; /** request a pre-defined CSS style context for the track body */ lumiera::advice::Request trackBodyStyle{"style(trackBody)"}; @@ -364,22 +366,19 @@ namespace timeline { return profile_; }; + // initially set up some dummy space. Will be updated to match on first draw() call... + adjustCanvasHeight(INITIAL_CONTENT_WIDTH_px, INITIAL_CONTENT_HEIGHT_px, INITIAL_TIMERULER_HEIGHT_px); + this->set_border_width (0); - this->property_expand() = true; // dynamically grab any available additional space - this->pack_start (rulerCanvas_); - this->pack_start (contentArea_); + this->property_expand() = true; // dynamically grab any available additional space + this->pack_start (rulerCanvas_, Gtk::PACK_SHRINK); + this->pack_start (contentArea_, Gtk::PACK_EXPAND_WIDGET); contentArea_.set_shadow_type (Gtk::SHADOW_NONE); contentArea_.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC); // always need a horizontal scrollbar contentArea_.property_expand() = true; // dynamically grab additional space contentArea_.add (mainCanvas_); - { // for the initial empty canvas -- use all space the enclosing scrolled window got. - auto currSize = get_allocation(); - int height = currSize.get_height(); - adjustCanvasHeight(currSize.get_width(), height, INITIAL_TIMERULER_HEIGHT_px); - } - // realise all initially configured elements.... this->show_all(); } @@ -420,9 +419,10 @@ namespace timeline { if (rootBody_ and isnil (profile_)) { layout_.triggerDisplayEvaluation(); - TODO("retrieve the vertical extension established by the triggerDisplayEvaluation() "); -// adjustCanvasHeight(currSize.get_width(), height, INITIAL_TIMERULER_HEIGHT_px); //////////////////////////TODO rootBody_->establishTrackSpace (profile_); + adjustCanvasHeight(layout_.getPixSpan().delta(), + rootBody_->calcHeight(), + rootBody_->calcRulerHeight()); } } @@ -437,8 +437,16 @@ namespace timeline { void BodyCanvasWidget::adjustCanvasHeight(int canvasWidth, int totalHeight, int rulerHeight) { - rulerCanvas_.set_size (canvasWidth, rulerHeight); - mainCanvas_.set_size (canvasWidth, max(0, totalHeight-rulerHeight)); + auto adjust = [](Gtk::Layout& canvas, guint newWidth, guint newHeight) -> void + { + guint currWidth{0}, currHeight{0}; + canvas.get_size(currWidth, currHeight); + if (currWidth != newWidth or currHeight != newHeight) + canvas.set_size(newWidth, newHeight); + }; + + adjust (rulerCanvas_, canvasWidth, rulerHeight); + adjust (mainCanvas_, canvasWidth, max(0, totalHeight-rulerHeight)); } diff --git a/src/stage/timeline/track-body.cpp b/src/stage/timeline/track-body.cpp index 2f749ffee..5c6e60f61 100644 --- a/src/stage/timeline/track-body.cpp +++ b/src/stage/timeline/track-body.cpp @@ -103,6 +103,20 @@ namespace timeline { */ uint TrackBody::calcHeight() + { + uint heightSum = calcRulerHeight() + contentHeight_; + for (TrackBody* subTrack : subTracks_) + heightSum += subTrack->calcHeight(); + return heightSum; + } + + + /** + * sum up the vertical extension required by all overview rulers. + * @return height in pixels, including all gap space + */ + uint + TrackBody::calcRulerHeight() { uint overviewHeight = 0; for (auto& ruler : rulers_) @@ -110,10 +124,7 @@ namespace timeline { overviewHeight += ruler->calcHeight() + ruler->getGapHeight(); } - uint heightSum = overviewHeight + contentHeight_; - for (TrackBody* subTrack : subTracks_) - heightSum += subTrack->calcHeight(); - return heightSum; + return overviewHeight; } diff --git a/src/stage/timeline/track-body.hpp b/src/stage/timeline/track-body.hpp index 0345218c7..325bc39f7 100644 --- a/src/stage/timeline/track-body.hpp +++ b/src/stage/timeline/track-body.hpp @@ -89,6 +89,7 @@ namespace timeline { void setTrackName (cuString&); void establishTrackSpace (TrackProfile&); void attachSubTrack (TrackBody*); + uint calcRulerHeight(); uint calcHeight(); DisplayManager::SignalStructureChange signalStructureChange_; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a95646635..893b8ecc5 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -16598,7 +16598,7 @@ - + @@ -19390,9 +19390,9 @@ - + - + @@ -20213,7 +20213,9 @@ - + + + @@ -21430,11 +21432,25 @@ - + + + + + + + + + + + + + + + + + - - @@ -21444,6 +21460,20 @@ + + + + + + + + + + + + + + @@ -21672,8 +21702,8 @@ - - + + @@ -21683,8 +21713,9 @@ - + + @@ -21725,6 +21756,24 @@ + + + + + + + + + + + + + + + + + + @@ -22616,7 +22665,8 @@ - + + @@ -22694,8 +22744,8 @@ - - + +