Kaydet (Commit) 0a612a5c authored tarafından dbeurle's avatar dbeurle Kaydeden (comit) Tomaž Vajngerl

Ruler ticks spacing consistent with lowDPI monitors. Draw ticks with width

Change-Id: Id636fa87ac7fd4a8c33d65bd72822768bc94b592
Reviewed-on: https://gerrit.libreoffice.org/13987Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst ec9c7ebb
...@@ -463,13 +463,16 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB ...@@ -463,13 +463,16 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
{ {
double nCenter = nTop + ((nBottom - nTop) / 2); 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 nTickLength2 = nTickLength3 * 0.66;
long nTickLength1 = nTickLength2 * 0.66; long nTickLength1 = nTickLength2 * 0.66;
long nScale = ruler_tab.DPIScaleFactor;
long DPIOffset = nScale - 1;
double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4; double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4;
double nTick2 = 0; double nTick2 = 0;
double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1; double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale;
double nTickUnit = 0; double nTickUnit = 0;
long nTickWidth; long nTickWidth;
bool bNoTicks = false; bool bNoTicks = false;
...@@ -548,7 +551,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB ...@@ -548,7 +551,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
else else
nMulti += 1000; 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 ) if ( nMulti < nOldMulti )
{ {
bNoTicks = true; bNoTicks = true;
...@@ -630,10 +633,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB ...@@ -630,10 +633,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
if(nMin < nHorizontalLocation && nHorizontalLocation < nMax) if(nMin < nHorizontalLocation && nHorizontalLocation < nMax)
{ {
ImplVDrawLine(nHorizontalLocation, nBottom, nHorizontalLocation, ImplVDrawRect(nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset,
nBottom - 1 * ruler_tab.DPIScaleFactor); nBottom - 1 * nScale);
ImplVDrawLine(nHorizontalLocation, nTop, nHorizontalLocation, ImplVDrawRect(nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset,
nTop + 1 * ruler_tab.DPIScaleFactor); nTop + 1 * nScale);
} }
nHorizontalLocation = nStart - n; nHorizontalLocation = nStart - n;
...@@ -641,10 +644,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB ...@@ -641,10 +644,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
if(nMin < nHorizontalLocation && nHorizontalLocation < nMax) if(nMin < nHorizontalLocation && nHorizontalLocation < nMax)
{ {
ImplVDrawLine( nHorizontalLocation, nBottom, nHorizontalLocation, ImplVDrawRect( nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset,
nBottom - 1 * ruler_tab.DPIScaleFactor ); nBottom - 1 * nScale );
ImplVDrawLine( nHorizontalLocation, nTop, nHorizontalLocation, ImplVDrawRect( nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset,
nTop + 1 * ruler_tab.DPIScaleFactor ); nTop + 1 * nScale );
} }
} }
// Tick/Tick2 - Output (Strokes) // Tick/Tick2 - Output (Strokes)
...@@ -673,10 +676,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB ...@@ -673,10 +676,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
nT = nStart + n; nT = nStart + n;
if ( nT < nMax ) if ( nT < nMax )
ImplVDrawLine( nT, nT1, nT, nT2 ); ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 );
nT = nStart - n; nT = nStart - n;
if ( nT > nMin ) if ( nT > nMin )
ImplVDrawLine( nT, nT1, nT, nT2 ); ImplVDrawRect( nT, nT1, nT + DPIOffset, nT2 );
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment