29 const int mLength = context.
mLength;
31 const int mLeft = context.
mLeft;
32 const int mTop = context.
mTop;
33 const int mBottom = context.
mBottom;
34 const int mRight = context.
mRight;
37 const double mMin = context.
mMin;
38 const double mMax = context.
mMax;
49 double UPP = (mHiddenMax - mHiddenMin) / mLength;
53 [
this, &tickSizes, &dc, &majorOutputs, &mFonts, mOrientation,
54 mMin, mMax, mLength, mRight, mBottom, &context]
55 (
double value) ->
int {
59 if (value > std::max(mMin, mMax))
70 mid = (int)(mLength * ((mMin - value) / (mMin - mMax)) + 0.5);
72 const int iMaxPos = (mOrientation == wxHORIZONTAL) ? mRight : mBottom - 5;
73 if (mid >= 0 && mid < iMaxPos)
74 Tick(dc, mid, value, tickSizes, mFonts.
major, majorOutputs, context);
86 TickAtValue(-mDbMirrorValue);
92 TickAtValue(-2 * mDbMirrorValue);
95 if (!mDbMirrorValue) {
100 double sign = UPP > 0.0 ? 1.0 : -1.0;
102 int nDroppedMinorLabels = 0;
104 for (
int jj = 0; jj < 3; ++jj) {
105 const double denom = jj == 0 ? tickSizes.mMajor :
106 jj == 1 ? tickSizes.mMinor : tickSizes.mMinorMinor;
109 if (denom == 0)
continue;
110 auto font = jj == 0 ? mFonts.
major :
115 allOutputs.
bits, allOutputs.
box
118 double d, warpedD, nextD;
120 double prevTime = 0.0, time = 0.0;
125 d = (prevTime + time) / 2.0;
135 double step = floor(sign * warpedD / denom);
136 while (ii <= mLength) {
142 nextD = (prevTime + time) / 2.0;
153 if (floor(sign * warpedD / denom) > step) {
154 step = floor(sign * warpedD / denom);
155 bool ticked =
Tick(dc, ii, sign * step * denom, tickSizes,
156 font, outputs, context);
157 bool major = jj == 0;
158 if (!major && !ticked) {
159 nDroppedMinorLabels++;
173 if (nDroppedMinorLabels >
174 (allOutputs.
majorLabels.size() + (mLabelEdges ? 2 : 0))
191 Tick(dc, 0, mMin, tickSizes, mFonts.
major, majorOutputs, context);
192 Tick(dc, mLength, mMax, tickSizes, mFonts.
major, majorOutputs, context);
Piecewise linear or piecewise exponential function from double to double.
double ComputeWarpedLength(const Envelope &env, double t0, double t1) const
bool Tick(wxDC &dc, int pos, double d, const TickSizes &tickSizes, wxFont font, TickOutputs outputs, const RulerStruct &context) const
const ZoomInfo * mpZoomInfo
void Update(wxDC &dc, const Envelope *envelope, UpdateOutputs &allOutputs, const RulerStruct &context) const override
static const LinearUpdater & Instance()
~LinearUpdater() override
void BoxAdjust(UpdateOutputs &allOutputs, const RulerStruct &context) const
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
std::unique_ptr< Fonts > mpFonts
const RulerFormat * mpRulerFormat
Labels & minorMinorLabels