diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/EditModel.cxx | 1 | ||||
| -rw-r--r-- | src/EditModel.h | 1 | ||||
| -rw-r--r-- | src/EditView.cxx | 19 | ||||
| -rw-r--r-- | src/Editor.cxx | 86 | ||||
| -rw-r--r-- | src/Editor.h | 2 | ||||
| -rw-r--r-- | src/Indicator.cxx | 59 | ||||
| -rw-r--r-- | src/Indicator.h | 26 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 9 | ||||
| -rw-r--r-- | src/ViewStyle.h | 1 | 
9 files changed, 155 insertions, 49 deletions
| diff --git a/src/EditModel.cxx b/src/EditModel.cxx index fe65a8bf8..b50ade258 100644 --- a/src/EditModel.cxx +++ b/src/EditModel.cxx @@ -65,6 +65,7 @@ EditModel::EditModel() {  	imeInteraction = imeWindowed;  	foldFlags = 0;  	hotspot = Range(invalidPosition); +	hoverIndicatorPos = invalidPosition;  	wrapWidth = LineLayout::wrapWidthInfinite;  	pdoc = new Document();  	pdoc->AddRef(); diff --git a/src/EditModel.h b/src/EditModel.h index d8def3294..fce26bd22 100644 --- a/src/EditModel.h +++ b/src/EditModel.h @@ -48,6 +48,7 @@ public:  	ContractionState cs;  	// Hotspot support  	Range hotspot; +	int hoverIndicatorPos;  	// Wrapping support  	int wrapWidth; diff --git a/src/EditView.cxx b/src/EditView.cxx index 4976d3614..c33f62d7b 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -940,18 +940,18 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle  }  static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw, -	const LineLayout *ll, int xStart, PRectangle rcLine, int subLine) { +	const LineLayout *ll, int xStart, PRectangle rcLine, int subLine, Indicator::DrawState drawState) {  	const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];  	PRectangle rcIndic(  		ll->positions[startPos] + xStart - subLineStart,  		rcLine.top + vsDraw.maxAscent,  		ll->positions[endPos] + xStart - subLineStart,  		rcLine.top + vsDraw.maxAscent + 3); -	vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine); +	vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, drawState);  }  static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, -	int line, int xStart, PRectangle rcLine, int subLine, int lineEnd, bool under) { +	int line, int xStart, PRectangle rcLine, int subLine, int lineEnd, bool under, int hoverIndicatorPos) {  	// Draw decorators  	const int posLineStart = model.pdoc->LineStart(line);  	const int lineStart = ll->LineStart(subLine); @@ -967,8 +967,11 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS  				int endPos = deco->rs.EndRun(startPos);  				if (endPos > posLineEnd)  					endPos = posLineEnd; +				const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && +					((hoverIndicatorPos >= startPos) && (hoverIndicatorPos <= endPos)); +				Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal;  				DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, -					surface, vsDraw, ll, xStart, rcLine, subLine); +					surface, vsDraw, ll, xStart, rcLine, subLine, drawState);  				startPos = endPos;  				if (!deco->rs.ValueAt(startPos)) {  					startPos = deco->rs.EndRun(startPos); @@ -986,13 +989,13 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS  			if (rangeLine.ContainsCharacter(model.braces[0])) {  				int braceOffset = model.braces[0] - posLineStart;  				if (braceOffset < ll->numCharsInLine) { -					DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine); +					DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal);  				}  			}  			if (rangeLine.ContainsCharacter(model.braces[1])) {  				int braceOffset = model.braces[1] - posLineStart;  				if (braceOffset < ll->numCharsInLine) { -					DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine); +					DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal);  				}  			}  		} @@ -1662,7 +1665,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl  	}  	if (phase & drawIndicatorsBack) { -		DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true); +		DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos);  		DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart);  		DrawMarkUnderline(surface, model, vsDraw, line, rcLine);  	} @@ -1677,7 +1680,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl  	}  	if (phase & drawIndicatorsFore) { -		DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false); +		DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false, model.hoverIndicatorPos);  	}  	// End of the drawing of the current line diff --git a/src/Editor.cxx b/src/Editor.cxx index 8cf77ead1..8c406242d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -630,6 +630,7 @@ void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition ancho  	sel.RangeMain() = rangeNew;  	SetRectangularRange();  	ClaimSelection(); +	SetHoverIndicatorPosition(sel.MainCaret());  	if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) {  		RedrawSelMargin(); @@ -657,6 +658,7 @@ void Editor::SetSelection(SelectionPosition currentPos_) {  			SelectionRange(SelectionPosition(currentPos_), sel.RangeMain().anchor);  	}  	ClaimSelection(); +	SetHoverIndicatorPosition(sel.MainCaret());  	if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) {  		RedrawSelMargin(); @@ -678,6 +680,7 @@ void Editor::SetEmptySelection(SelectionPosition currentPos_) {  	sel.RangeMain() = rangeNew;  	SetRectangularRange();  	ClaimSelection(); +	SetHoverIndicatorPosition(sel.MainCaret());  	if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) {  		RedrawSelMargin(); @@ -1988,6 +1991,7 @@ void Editor::ClearSelection(bool retainMultipleSelections) {  	ThinRectangularRange();  	sel.RemoveDuplicates();  	ClaimSelection(); +	SetHoverIndicatorPosition(sel.MainCaret());  }  void Editor::ClearAll() { @@ -4117,6 +4121,7 @@ static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) {  }  void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { +	SetHoverIndicatorPoint(pt);  	//Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop);  	ptMouseLast = pt;  	const bool ctrl = (modifiers & SCI_CTRL) != 0; @@ -4315,6 +4320,36 @@ bool Editor::PointIsHotspot(Point pt) {  	return PositionIsHotspot(pos);  } +void Editor::SetHoverIndicatorPosition(int position) { +	int hoverIndicatorPosPrev = hoverIndicatorPos; +	hoverIndicatorPos = INVALID_POSITION; +	if (vs.indicatorsDynamic == 0) +		return; +	if (position != INVALID_POSITION) { +		for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { +			if (vs.indicators[deco->indicator].IsDynamic()) { +				if (pdoc->decorations.ValueAt(deco->indicator, position)) { +					hoverIndicatorPos = position; +				} +			} +		} +	} +	if (hoverIndicatorPosPrev != hoverIndicatorPos) { +		if (hoverIndicatorPosPrev != INVALID_POSITION) +			InvalidateRange(hoverIndicatorPosPrev, hoverIndicatorPosPrev + 1); +		if (hoverIndicatorPos != INVALID_POSITION) +			InvalidateRange(hoverIndicatorPos, hoverIndicatorPos + 1); +	} +} + +void Editor::SetHoverIndicatorPoint(Point pt) { +	if (vs.indicatorsDynamic == 0) { +		SetHoverIndicatorPosition(INVALID_POSITION); +	} else { +		SetHoverIndicatorPosition(PositionFromLocation(pt, true, true)); +	} +} +  void Editor::SetHotSpotRange(Point *pt) {  	if (pt) {  		int pos = PositionFromLocation(*pt, false, true); @@ -4457,12 +4492,18 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {  		// Display regular (drag) cursor over selection  		if (PointInSelection(pt) && !SelectionEmpty()) {  			DisplayCursor(Window::cursorArrow); -		} else if (PointIsHotspot(pt)) { -			DisplayCursor(Window::cursorHand); -			SetHotSpotRange(&pt);  		} else { -			DisplayCursor(Window::cursorText); -			SetHotSpotRange(NULL); +			SetHoverIndicatorPoint(pt); +			if (PointIsHotspot(pt)) { +				DisplayCursor(Window::cursorHand); +				SetHotSpotRange(&pt); +			} else { +				if (hoverIndicatorPos != invalidPosition) +					DisplayCursor(Window::cursorHand); +				else +					DisplayCursor(Window::cursorText); +				SetHotSpotRange(NULL); +			}  		}  	}  } @@ -4475,6 +4516,8 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {  	//Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop);  	SelectionPosition newPos = SPositionFromLocation(pt, false, false,  		AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); +	if (hoverIndicatorPos != INVALID_POSITION) +		InvalidateRange(newPos.Position(), newPos.Position() + 1);  	newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position());  	if (inDragDrop == ddInitial) {  		inDragDrop = ddNone; @@ -4840,6 +4883,9 @@ void Editor::SetDocPointer(Document *document) {  	view.llc.Deallocate();  	NeedWrapping(); +	hotspot = Range(invalidPosition); +	hoverIndicatorPos = invalidPosition; +  	view.ClearAllTabstops();  	pdoc->AddWatcher(this, 0); @@ -6765,23 +6811,45 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_INDICSETSTYLE:  		if (wParam <= INDIC_MAX) { -			vs.indicators[wParam].style = static_cast<int>(lParam); +			vs.indicators[wParam].sacNormal.style = static_cast<int>(lParam); +			vs.indicators[wParam].sacHover.style = static_cast<int>(lParam);  			InvalidateStyleRedraw();  		}  		break;  	case SCI_INDICGETSTYLE: -		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].style : 0; +		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.style : 0;  	case SCI_INDICSETFORE:  		if (wParam <= INDIC_MAX) { -			vs.indicators[wParam].fore = ColourDesired(static_cast<long>(lParam)); +			vs.indicators[wParam].sacNormal.fore = ColourDesired(static_cast<long>(lParam)); +			vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast<long>(lParam));  			InvalidateStyleRedraw();  		}  		break;  	case SCI_INDICGETFORE: -		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.AsLong() : 0; +		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.fore.AsLong() : 0; + +	case SCI_INDICSETHOVERSTYLE: +		if (wParam <= INDIC_MAX) { +			vs.indicators[wParam].sacHover.style = static_cast<int>(lParam); +			InvalidateStyleRedraw(); +		} +		break; + +	case SCI_INDICGETHOVERSTYLE: +		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.style : 0; + +	case SCI_INDICSETHOVERFORE: +		if (wParam <= INDIC_MAX) { +			vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast<long>(lParam)); +			InvalidateStyleRedraw(); +		} +		break; + +	case SCI_INDICGETHOVERFORE: +		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.fore.AsLong() : 0;  	case SCI_INDICSETUNDER:  		if (wParam <= INDIC_MAX) { diff --git a/src/Editor.h b/src/Editor.h index ec24f66fd..1fc907ac7 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -545,6 +545,8 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	bool PointIsHotspot(Point pt);  	void SetHotSpotRange(Point *pt);  	Range GetHotSpotRange() const; +	void SetHoverIndicatorPosition(int position); +	void SetHoverIndicatorPoint(Point pt);  	int CodePage() const;  	virtual bool ValidCodePage(int /* codePage */) const { return true; } diff --git a/src/Indicator.cxx b/src/Indicator.cxx index daf62aa02..9cbf7e12d 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -23,10 +23,14 @@ 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) const { -	surface->PenColour(fore); +void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState) const { +	StyleAndColour sacDraw = sacNormal; +	if (drawState == drawHover) { +		sacDraw = sacHover; +	} +	surface->PenColour(sacDraw.fore);  	int ymid = static_cast<int>(rc.bottom + rc.top) / 2; -	if (style == INDIC_SQUIGGLE) { +	if (sacDraw.style == INDIC_SQUIGGLE) {  		int x = int(rc.left+0.5);  		int xLast = int(rc.right+0.5);  		int y = 0; @@ -42,7 +46,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  			}  			surface->LineTo(x, static_cast<int>(rc.top) + y);  		} -	} else if (style == INDIC_SQUIGGLEPIXMAP) { +	} else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) {  		PRectangle rcSquiggle = PixelGridAlign(rc);  		int width = Platform::Minimum(4000, static_cast<int>(rcSquiggle.Width())); @@ -51,17 +55,17 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  		for (int x = 0; x < width; x++) {  			if (x%2) {  				// Two halfway columns have a full pixel in middle flanked by light pixels -				image.SetPixel(x, 0, fore, alphaSide); -				image.SetPixel(x, 1, fore, alphaFull); -				image.SetPixel(x, 2, fore, alphaSide); +				image.SetPixel(x, 0, sacDraw.fore, alphaSide); +				image.SetPixel(x, 1, sacDraw.fore, alphaFull); +				image.SetPixel(x, 2, sacDraw.fore, alphaSide);  			} else {  				// Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre -				image.SetPixel(x, (x%4) ? 0 : 2, fore, alphaFull); -				image.SetPixel(x, 1, fore, alphaSide2); +				image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull); +				image.SetPixel(x, 1, sacDraw.fore, alphaSide2);  			}  		}  		surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels()); -	} else if (style == INDIC_SQUIGGLELOW) { +	} else if (sacDraw.style == INDIC_SQUIGGLELOW) {  		surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top));  		int x = static_cast<int>(rc.left) + 3;  		int y = 0; @@ -72,7 +76,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  			x += 3;  		}  		surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) + y);	// Finish the line -	} else if (style == INDIC_TT) { +	} else if (sacDraw.style == INDIC_TT) {  		surface->MoveTo(static_cast<int>(rc.left), ymid);  		int x = static_cast<int>(rc.left) + 5;  		while (x < rc.right) { @@ -88,7 +92,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  			surface->MoveTo(x-3, ymid);  			surface->LineTo(x-3, ymid+2);  		} -	} else if (style == INDIC_DIAGONAL) { +	} else if (sacDraw.style == INDIC_DIAGONAL) {  		int x = static_cast<int>(rc.left);  		while (x < rc.right) {  			surface->MoveTo(x, static_cast<int>(rc.top) + 2); @@ -101,24 +105,25 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  			surface->LineTo(endX, endY);  			x += 4;  		} -	} else if (style == INDIC_STRIKE) { +	} else if (sacDraw.style == INDIC_STRIKE) {  		surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top) - 4);  		surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) - 4); -	} else if (style == INDIC_HIDDEN) { +	} else if (sacDraw.style == INDIC_HIDDEN) {  		// Draw nothing -	} else if (style == INDIC_BOX) { +	} else if (sacDraw.style == INDIC_BOX) {  		surface->MoveTo(static_cast<int>(rc.left), ymid + 1);  		surface->LineTo(static_cast<int>(rc.right), ymid + 1);  		surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rcLine.top) + 1);  		surface->LineTo(static_cast<int>(rc.left), static_cast<int>(rcLine.top) + 1);  		surface->LineTo(static_cast<int>(rc.left), ymid + 1); -	} else if (style == INDIC_ROUNDBOX || style == INDIC_STRAIGHTBOX) { +	} else if (sacDraw.style == INDIC_ROUNDBOX || sacDraw.style == INDIC_STRAIGHTBOX) {  		PRectangle rcBox = rcLine;  		rcBox.top = rcLine.top + 1;  		rcBox.left = rc.left;  		rcBox.right = rc.right; -		surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0); -	} else if (style == INDIC_DOTBOX) { +		surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0,  +			sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0); +	} else if (sacDraw.style == INDIC_DOTBOX) {  		PRectangle rcBox = PixelGridAlign(rc);  		rcBox.top = rcLine.top + 1;  		rcBox.bottom = rcLine.bottom; @@ -128,36 +133,36 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  		// Draw horizontal lines top and bottom  		for (int x=0; x<width; x++) {  			for (int y = 0; y<static_cast<int>(rcBox.Height()); y += static_cast<int>(rcBox.Height()) - 1) { -				image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); +				image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);  			}  		}  		// Draw vertical lines left and right  		for (int y = 1; y<static_cast<int>(rcBox.Height()); y++) {  			for (int x=0; x<width; x += width-1) { -				image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); +				image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);  			}  		}  		surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); -	} else if (style == INDIC_DASH) { +	} else if (sacDraw.style == INDIC_DASH) {  		int x = static_cast<int>(rc.left);  		while (x < rc.right) {  			surface->MoveTo(x, ymid);  			surface->LineTo(Platform::Minimum(x + 4, static_cast<int>(rc.right)), ymid);  			x += 7;  		} -	} else if (style == INDIC_DOTS) { +	} else if (sacDraw.style == INDIC_DOTS) {  		int x = static_cast<int>(rc.left);  		while (x < static_cast<int>(rc.right)) {  			PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); -			surface->FillRectangle(rcDot, fore); +			surface->FillRectangle(rcDot, sacDraw.fore);  			x += 2;  		} -	} else if (style == INDIC_COMPOSITIONTHICK) { +	} else if (sacDraw.style == INDIC_COMPOSITIONTHICK) {  		PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); -		surface->FillRectangle(rcComposition, fore); -	} else if (style == INDIC_COMPOSITIONTHIN) { +		surface->FillRectangle(rcComposition, sacDraw.fore); +	} else if (sacDraw.style == INDIC_COMPOSITIONTHIN) {  		PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); -		surface->FillRectangle(rcComposition, fore); +		surface->FillRectangle(rcComposition, sacDraw.fore);  	} else {	// Either INDIC_PLAIN or unknown  		surface->MoveTo(static_cast<int>(rc.left), ymid);  		surface->LineTo(static_cast<int>(rc.right), ymid); diff --git a/src/Indicator.h b/src/Indicator.h index 96cba3c05..c17ae494c 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -12,21 +12,37 @@  namespace Scintilla {  #endif +struct StyleAndColour { +	int style; +	ColourDesired fore; +	StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) { +	} +	StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) { +	} +	bool operator==(const StyleAndColour &other) const { +		return (style == other.style) && (fore == other.fore); +	} +}; +  /**   */  class Indicator {  public: -	int style; -	ColourDesired fore; +	enum DrawState { drawNormal, drawHover, drawActive }; +	StyleAndColour sacNormal; +	StyleAndColour sacHover;  	bool under;  	int fillAlpha;  	int outlineAlpha; -	Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)), under(false), fillAlpha(30), outlineAlpha(50) { +	Indicator() : under(false), fillAlpha(30), outlineAlpha(50) {  	}  	Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) : -		style(style_), fore(fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_) { +		sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_) { +	} +	void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState) const; +	bool IsDynamic() const { +		return !(sacNormal == sacHover);  	} -	void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const;  };  #ifdef SCI_NAMESPACE diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index b60905caf..864356bc1 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -101,8 +101,11 @@ ViewStyle::ViewStyle(const ViewStyle &source) {  		markers[mrk] = source.markers[mrk];  	}  	CalcLargestMarkerHeight(); +	indicatorsDynamic = 0;  	for (int ind=0; ind<=INDIC_MAX; ind++) {  		indicators[ind] = source.indicators[ind]; +		if (indicators[ind].IsDynamic()) +			indicatorsDynamic++;  	}  	selColours = source.selColours; @@ -197,6 +200,7 @@ void ViewStyle::Init(size_t stylesSize_) {  	indicators[2] = Indicator(INDIC_PLAIN, ColourDesired(0xff, 0, 0));  	technology = SC_TECHNOLOGY_DEFAULT; +	indicatorsDynamic = 0;  	lineHeight = 1;  	lineOverlap = 0;  	maxAscent = 1; @@ -318,6 +322,11 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {  		FontRealised *fr = Find(styles[k]);  		styles[k].Copy(fr->font, *fr);  	} +	indicatorsDynamic = 0; +	for (int ind = 0; ind <= INDIC_MAX; ind++) { +		if (indicators[ind].IsDynamic()) +			indicatorsDynamic++; +	}  	maxAscent = 1;  	maxDescent = 1;  	FindMaxAscentDescent(); diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 4a4ffcdf0..08afebaa5 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -83,6 +83,7 @@ public:  	LineMarker markers[MARKER_MAX + 1];  	int largestMarkerHeight;  	Indicator indicators[INDIC_MAX + 1]; +	unsigned int indicatorsDynamic;  	int technology;  	int lineHeight;  	int lineOverlap; | 
