From a866701d7ec9dbfaadced7711111c09795a6a75b Mon Sep 17 00:00:00 2001 From: martynshaw99 Date: Fri, 6 Dec 2013 00:51:49 +0000 Subject: [PATCH] Add some more precision to the ruler in LinearDBFormat mode, and display it. This is not a complete fix, but is some way towards it. --- src/widgets/Ruler.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 25db1e09d..acf30728e 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -369,6 +369,16 @@ void Ruler::FindLinearTickSizes(double UPP) switch(mFormat) { case LinearDBFormat: + if (units < 0.001) { + mMinor = 0.001; + mMajor = 0.005; + return; + } + if (units < 0.01) { + mMinor = 0.01; + mMajor = 0.05; + return; + } if (units < 0.1) { mMinor = 0.1; mMajor = 0.5; @@ -590,7 +600,8 @@ wxString Ruler::LabelString(double d, bool major) if (mMinor >= 1.0) s.Printf(wxT("%d"), (int)floor(d+0.5)); else { - s.Printf(wxT("%.1f"), d); + int precision = -log10(mMinor); + s.Printf(wxT("%.*f"), precision, d); } break; case RealFormat: