diff --git a/src/stage/model/canvas-hook.hpp b/src/stage/model/canvas-hook.hpp index b228b5fb6..4382585db 100644 --- a/src/stage/model/canvas-hook.hpp +++ b/src/stage/model/canvas-hook.hpp @@ -57,6 +57,7 @@ #include "lib/util.hpp" #include +#include ///////////////TODO namespace stage { @@ -66,6 +67,7 @@ namespace model { using lib::time::Offset; using lib::time::TimeValue; using lib::time::TimeSpan; + using std::string; //////////////////////////TODO @@ -99,6 +101,9 @@ namespace model { * @return resulting TimeValue when applying the offset within current metric */ virtual TimeValue applyScreenDelta(Time anchor, double deltaPx) const =0; +//////////////////////////////////////////////////////////////TODO +virtual string tranZ(TimeValue staTiPoi) const =0; +//////////////////////////////////////////////////////////////TODO }; diff --git a/src/stage/model/zoom-metric.hpp b/src/stage/model/zoom-metric.hpp index 187d64e58..9f71af049 100644 --- a/src/stage/model/zoom-metric.hpp +++ b/src/stage/model/zoom-metric.hpp @@ -51,6 +51,8 @@ #include "lib/meta/trait.hpp" #include "stage/model/canvas-hook.hpp" #include "stage/model/zoom-window.hpp" +#include "lib/format-obj.hpp"////////////////////////////TODO +#include "lib/format-string.hpp"/////////////////////////TODO @@ -91,7 +93,18 @@ namespace model { { return zoomWindow_.overallSpan(); } - + +//////////////////////////////////////////////////////////////TODO +string tranZ(TimeValue staTiPoi) const override + { + auto sta = zoomWindow_.overallSpan().start(); + Offset offi{sta, staTiPoi}; + Rat mulli = zoomWindow_.px_per_sec() * _FSecs(offi); + int64_t casti = rational_cast (mulli); + static util::_Fmt formi{"Offset(%d, %d) = %d ⟼ px = %s ⟼ %s"}; + return formi % _raw(sta) % _raw(staTiPoi) % _raw(offi) % util::toString(mulli) % casti; + } +//////////////////////////////////////////////////////////////TODO int translateTimeToPixels (TimeValue startTimePoint) const override { @@ -101,7 +114,10 @@ namespace model { int translateScreenDelta (Offset timeOffset) const override { - return rational_cast (zoomWindow_.px_per_sec() * _FSecs(timeOffset)); + auto pxOffset = rational_cast (zoomWindow_.px_per_sec() * _FSecs(timeOffset)); + // // use 64-bit for the division to prevent numeric-wrap... + REQUIRE (abs (pxOffset) <= std::numeric_limits::max()); + return int(pxOffset); } TimeValue diff --git a/src/stage/timeline/display-manager.hpp b/src/stage/timeline/display-manager.hpp index 3b4b0cdf4..9890e7e5d 100644 --- a/src/stage/timeline/display-manager.hpp +++ b/src/stage/timeline/display-manager.hpp @@ -99,6 +99,7 @@ namespace timeline { using lib::time::TimeValue; class TrackHeadWidget; class TrackBody; + using std::string;///////////////////////////////TODO /** @@ -189,8 +190,10 @@ namespace timeline { auto covfefe2 = coveredTime(); auto end = covfefe2.end(); auto tranE = translateTimeToPixels(end); + + string buggi = tranZ(end); -cout<<"|↯| pxSpan cov1="< - + + + + + + + + + + + + + + + + + + + + + + + @@ -43712,7 +43734,7 @@ - + @@ -43861,8 +43883,8 @@ - - + +