diff --git a/src/lib/verb-token.hpp b/src/lib/verb-token.hpp index 4a7eb0521..4b6cbdf97 100644 --- a/src/lib/verb-token.hpp +++ b/src/lib/verb-token.hpp @@ -96,11 +96,6 @@ namespace lib { return (receiver.*handler_)(std::forward(args)...); } - operator string() const - { - return string(token_); - } - VerbToken(Handler handlerFunction, Literal token) : handler_(handlerFunction) , token_(token) @@ -113,6 +108,17 @@ namespace lib { /* default copyable */ + operator string() const + { + return string(token_); + } + + Literal const& + getID() + { + return token_; + } + /** equality of VerbToken, based on equality of the #token_ Literal * @remarks member pointers to virtual functions aren't comparable, for good reason */ diff --git a/src/stage/timeline/ruler-track.cpp b/src/stage/timeline/ruler-track.cpp index 58fde7068..b75dd0048 100644 --- a/src/stage/timeline/ruler-track.cpp +++ b/src/stage/timeline/ruler-track.cpp @@ -26,6 +26,7 @@ ** and time code ticks and markers onto the TimelineCanvas. ** ** @todo WIP-WIP-WIP as of 12/2018 + ** @todo this is more or less preliminary/placeholder code as of 4/2019 ** */ @@ -37,7 +38,7 @@ //#include "lib/format-string.hpp" //#include "lib/format-cout.hpp" -//#include "lib/util.hpp" +#include "lib/util.hpp" //#include //#include @@ -45,6 +46,7 @@ //using util::_Fmt; +using util::isnil; //using util::contains; //using Gtk::Widget; //using sigc::mem_fun; @@ -57,9 +59,12 @@ namespace stage { namespace timeline { namespace { - uint TIMERULER_SCALE_HEIGHT_px = 20; - uint TIMERULER_LARGE_TICK_WEIGHT_px = 2; - uint TIMERULER_SMALL_TICK_WEIGHT_px = 2; + const uint DEFAULT_OVERVIEW_HEIGHT_px = 20; + + const uint TIMERULER_SCALE_HEIGHT_px = 20; + const uint TIMERULER_LARGE_TICK_WEIGHT_px = 2; + const uint TIMERULER_SMALL_TICK_WEIGHT_px = 2; + const uint TIMERULE_GAP_BELOW_px = 5; } @@ -77,15 +82,48 @@ namespace timeline { /** - * recursively calculate the height in pixels to display this track, - * including all nested sub-tracks + * recursively calculate the height in pixels to display this ruler track. + * @todo this is more or less braindead placeholder code as of 4/2019 */ uint RulerTrack::calcHeight() { - UNIMPLEMENTED ("calculate display height of the overview ruler in pixels"); + if (isnil (scales_)) + return DEFAULT_OVERVIEW_HEIGHT_px; + else + { // handle time ruler ////////////////////////////////////////////////TICKET #1194 : proper handling of ruler tracks + uint combinedScaleHeight = 0; + for (auto& scale : scales_) + combinedScaleHeight += scale.calcHeight(); + return combinedScaleHeight; + } } + /** + * possibly cause the display of an additional padding gap below this ruler track + * @return `0` when no gap shall be displayed, _otherwise_ the gap height in pixels. + * @todo this is more or less braindead placeholder code as of 4/2019 + */ + uint + RulerTrack::getGapHeight() + { + if (not isnil (scales_)) + return TIMERULE_GAP_BELOW_px; + else + return 0; // no Gap + + } + + /** + * get vertical extension of this scale on the time(code) overview ruler + * @todo this is more or less braindead placeholder code as of 4/2019 + */ + uint + RulerScale::calcHeight() + { ////////////////////////////////////////////////TICKET #1194 : proper handling of ruler tracks + return TIMERULER_SCALE_HEIGHT_px; + } + }}// namespace stage::timeline diff --git a/src/stage/timeline/ruler-track.hpp b/src/stage/timeline/ruler-track.hpp index 94f364478..cbc7305fb 100644 --- a/src/stage/timeline/ruler-track.hpp +++ b/src/stage/timeline/ruler-track.hpp @@ -54,9 +54,10 @@ namespace stage { namespace timeline { + ////////////////////////////////////////////////////////////////////TICKET #1195 : Timecode Ruler presentation struct RulerScale { - + uint calcHeight(); }; @@ -64,7 +65,7 @@ namespace timeline { * Helper to organise and draw the time or content overview ruler at the top of the * timeline track display. The purpose is to support custom drawing onto the TimelineCanvas * to show rendered content, timecode or frame count ticks plus any markers, ranges and locators... - * @todo WIP-WIP as of 10/2018 + * @todo this is more or less preliminary/placeholder code as of 4/2019 ////////////////////////TICKET #1194 : proper handling of ruler tracks */ class RulerTrack { @@ -77,6 +78,7 @@ namespace timeline { ~RulerTrack(); uint calcHeight(); + uint getGapHeight(); private:/* ===== Internals ===== */ diff --git a/src/stage/timeline/track-body.cpp b/src/stage/timeline/track-body.cpp index 6a312b38f..286a5bf0b 100644 --- a/src/stage/timeline/track-body.cpp +++ b/src/stage/timeline/track-body.cpp @@ -37,7 +37,7 @@ //#include "stage/ui-bus.hpp" //#include "lib/format-string.hpp" -//#include "lib/util.hpp" +#include "lib/util.hpp" //#include //#include @@ -45,6 +45,7 @@ //using util::_Fmt; +using util::isnil; //using util::contains; //using Gtk::Widget; //using sigc::mem_fun; @@ -57,7 +58,6 @@ namespace stage { namespace timeline { namespace { - const uint DEFAULT_OVERVIEW_HEIGHT_px = 20; const uint DEFAULT_CONTENT_HEIGHT_px = 80; } @@ -65,8 +65,7 @@ namespace timeline { TrackBody::TrackBody() - : overviewHeight_{DEFAULT_OVERVIEW_HEIGHT_px} - , contentHeight_{DEFAULT_CONTENT_HEIGHT_px} + : contentHeight_{DEFAULT_CONTENT_HEIGHT_px} , subTracks_{} , rulers_{} { } @@ -92,7 +91,13 @@ namespace timeline { uint TrackBody::calcHeight() { - uint heightSum = overviewHeight_ + contentHeight_; + uint overviewHeight = 0; + for (auto& ruler : rulers_) + { + overviewHeight += ruler->calcHeight(); + + ruler->getGapHeight(); + } + uint heightSum = overviewHeight + contentHeight_; for (TrackBody* subTrack : subTracks_) heightSum += subTrack->calcHeight(); return heightSum; @@ -103,11 +108,28 @@ namespace timeline { * recursively establish the screen space allocation for this structure of nested tracks. * The TrackProfile is an abstracted description of the sequence of track elements, * which constitute a vertical cross section through the track bodies + * - pre: the given profile is built and complete up to the (upper side) start of this timeline + * - post: the profile is elaborated for this track and its children, down to the lower end. + * */ void TrackBody::establishTrackSpace (TrackProfile& profile) { - UNIMPLEMENTED ("recursively build the TrackProfile"); + for (auto& ruler : rulers_) + { + profile.append_ruler (ruler->calcHeight()); + uint gapHeight = ruler->getGapHeight(); + if (gapHeight > 0) + profile.append_gap (gapHeight); + } + profile.append_content (this->contentHeight_); + if (not isnil(subTracks_)) + { + profile.addSlopeDown(); + for (TrackBody* subTrack : subTracks_) + subTrack->establishTrackSpace (profile); + profile.addSlopeUp(); + } } diff --git a/src/stage/timeline/track-body.hpp b/src/stage/timeline/track-body.hpp index ce54bb19b..c588b1670 100644 --- a/src/stage/timeline/track-body.hpp +++ b/src/stage/timeline/track-body.hpp @@ -71,7 +71,6 @@ namespace timeline { */ class TrackBody { - uint overviewHeight_; uint contentHeight_; using PRuler = std::unique_ptr; diff --git a/src/stage/timeline/track-profile.hpp b/src/stage/timeline/track-profile.hpp index f13bc7912..072670b4d 100644 --- a/src/stage/timeline/track-profile.hpp +++ b/src/stage/timeline/track-profile.hpp @@ -122,6 +122,36 @@ namespace timeline { TOKEN_BUILDER (close) TOKEN_BUILDER (prelude) TOKEN_BUILDER (coda) + + void + addSlopeDown() + { + this->append_open (1); + } + + void + addSlopeUp() + { + if (lastEntryIs("close")) + incrementLastCloseSlope(); + else + append_close (1); + } + + private: + bool + lastEntryIs (Literal expectedToken) + { + return util::isnil (elements) + or elements.back().first.getID() == expectedToken; + } + + void + incrementLastCloseSlope() + { + REQUIRE (lastEntryIs ("close")); + ++ elements.back().second; + } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a707825ad..1c3a81f15 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -19333,14 +19333,14 @@ - - + + - - + + @@ -19425,9 +19425,10 @@ - - - + + + + @@ -19435,7 +19436,9 @@ - + + + @@ -19458,6 +19461,10 @@ + + + + @@ -19473,8 +19480,8 @@ - - + + @@ -19485,12 +19492,53 @@ - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19519,25 +19567,6 @@ - - - - - - - - - - - - - - - - - - - @@ -19748,7 +19777,21 @@ - + + + + + + + + + + + + + + + @@ -21977,8 +22020,8 @@ - - + + @@ -21994,7 +22037,8 @@ - + +