diff options
author | dbeurle <dbeurle@student.unimelb.edu.au> | 2015-01-19 09:47:29 +1100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2015-01-19 08:11:47 +0000 |
commit | 0a612a5c5c2982bccfe0cd6c5a3bba8d9107e043 (patch) | |
tree | 4a52a32d7d78196ea4a212a833ab91a29a37b570 | |
parent | ec9c7ebb575b592e188c5f6b545570b11744d063 (diff) |
Ruler ticks spacing consistent with lowDPI monitors. Draw ticks with width
Change-Id: Id636fa87ac7fd4a8c33d65bd72822768bc94b592
Reviewed-on: https://gerrit.libreoffice.org/13987
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | svtools/source/control/ruler.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 96b6aa0ba9eb..e97386c17822 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -463,13 +463,16 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB { double nCenter = nTop + ((nBottom - nTop) / 2); - long nTickLength3 = (nBottom - nTop) * 0.5 * ruler_tab.DPIScaleFactor; + long nTickLength3 = (nBottom - nTop) * 0.5; long nTickLength2 = nTickLength3 * 0.66; long nTickLength1 = nTickLength2 * 0.66; + long nScale = ruler_tab.DPIScaleFactor; + long DPIOffset = nScale - 1; + double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4; double nTick2 = 0; - double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1; + double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale; double nTickUnit = 0; long nTickWidth; bool bNoTicks = false; @@ -548,7 +551,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB else nMulti += 1000; - // Overeflow - in this case don't draw ticks and exit + // Overflow - in this case don't draw ticks and exit if ( nMulti < nOldMulti ) { bNoTicks = true; @@ -630,10 +633,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB if(nMin < nHorizontalLocation && nHorizontalLocation < nMax) { - ImplVDrawLine(nHorizontalLocation, nBottom, nHorizontalLocation, - nBottom - 1 * ruler_tab.DPIScaleFactor); - ImplVDrawLine(nHorizontalLocation, nTop, nHorizontalLocation, - nTop + 1 * ruler_tab.DPIScaleFactor); + ImplVDrawRect(nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset, + nBottom - 1 * nScale); + ImplVDrawRect(nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset, + nTop + 1 * nScale); } nHorizontalLocation = nStart - n; @@ -641,10 +644,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB if(nMin < nHorizontalLocation && nHorizontalLocation < nMax) { - ImplVDrawLine( nHorizontalLocation, nBottom, nHorizontalLocation, - nBottom - 1 * ruler_tab.DPIScaleFactor ); - ImplVDrawLine( nHorizontalLocation, nTop, nHorizontalLocation, - nTop + 1 * ruler_tab.DPIScaleFactor ); + ImplVDrawRect( nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset, + nBottom - 1 * nScale ); + ImplVDrawRect( nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset, + nTop + 1 * nScale ); } } // Tick/Tick2 - Output (Strokes) @@ -673,10 +676,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB nT = nStart + n; if ( nT < nMax ) - ImplVDrawLine( nT, nT1, nT, nT2 ); + ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 ); nT = nStart - n; if ( nT > nMin ) - ImplVDrawLine( nT, nT1, nT, nT2 ); + ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 ); } } } |