From 065668992566910aef274b995d8f861906d514a9 Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 26 Oct 2016 23:09:50 +1100 Subject: INDIC_POINT and INDIC_POINTCHARACTER indicators added to display small arrows underneath positions or characters. --- src/Indicator.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/Indicator.cxx') diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 4bc25a815..c23ae4e17 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -24,7 +24,7 @@ static PRectangle PixelGridAlign(const PRectangle &rc) { return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); } -void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const { +void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const { StyleAndColour sacDraw = sacNormal; if (Flags() & SC_INDICFLAG_VALUEFORE) { sacDraw.fore = value & SC_INDICVALUEMASK; @@ -170,6 +170,19 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r } else if (sacDraw.style == INDIC_COMPOSITIONTHIN) { PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); surface->FillRectangle(rcComposition, sacDraw.fore); + } else if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) { + if (rcCharacter.Width() >= 0.1) { + const int pixelHeight = static_cast(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase + const XYPOSITION x = (sacDraw.style == INDIC_POINT) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2); + const int ix = static_cast(x + 0.5f); + const int iy = static_cast(rc.top + 1.0f); + Point pts[] = { + Point::FromInts(ix - pixelHeight, iy + pixelHeight), // Left + Point::FromInts(ix + pixelHeight, iy + pixelHeight), // Right + Point::FromInts(ix, iy) // Top + }; + surface->Polygon(pts, 3, sacDraw.fore, sacDraw.fore); + } } else { // Either INDIC_PLAIN or unknown surface->MoveTo(static_cast(rc.left), ymid); surface->LineTo(static_cast(rc.right), ymid); -- cgit v1.2.3