MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / DrawAnnotation

Method DrawAnnotation

scintilla/src/Editor.cxx:2860–2911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2858}
2859
2860void Editor::DrawAnnotation ( Surface *surface, ViewStyle &vsDraw, int line, int xStart,
2861 PRectangle rcLine, LineLayout *ll, int subLine )
2862{
2863 int indent = pdoc->GetLineIndentation ( line ) * vsDraw.spaceWidth;
2864 PRectangle rcSegment = rcLine;
2865 int annotationLine = subLine - ll->lines;
2866 const StyledText stAnnotation = pdoc->AnnotationStyledText ( line );
2867 if ( stAnnotation.text && ValidStyledText ( vsDraw, vsDraw.annotationStyleOffset, stAnnotation ) ) {
2868 surface->FillRectangle ( rcSegment, vsDraw.styles[0].back );
2869 if ( vs.annotationVisible == ANNOTATION_BOXED ) {
2870 // Only care about calculating width if need to draw box
2871 int widthAnnotation = WidestLineWidth ( surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation );
2872 widthAnnotation += vsDraw.spaceWidth * 2; // Margins
2873 rcSegment.left = xStart + indent;
2874 rcSegment.right = rcSegment.left + widthAnnotation;
2875 } else {
2876 rcSegment.left = xStart;
2877 }
2878 const int annotationLines = pdoc->AnnotationLines ( line );
2879 size_t start = 0;
2880 size_t lengthAnnotation = stAnnotation.LineLength ( start );
2881 int lineInAnnotation = 0;
2882 while ( ( lineInAnnotation < annotationLine ) && ( start < stAnnotation.length ) ) {
2883 start += lengthAnnotation + 1;
2884 lengthAnnotation = stAnnotation.LineLength ( start );
2885 lineInAnnotation++;
2886 }
2887 PRectangle rcText = rcSegment;
2888 if ( vs.annotationVisible == ANNOTATION_BOXED ) {
2889 surface->FillRectangle ( rcText,
2890 vsDraw.styles[stAnnotation.StyleAt ( start ) + vsDraw.annotationStyleOffset].back );
2891 rcText.left += vsDraw.spaceWidth;
2892 }
2893 DrawStyledText ( surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent,
2894 stAnnotation, start, lengthAnnotation );
2895 if ( vs.annotationVisible == ANNOTATION_BOXED ) {
2896 surface->PenColour ( vsDraw.styles[vsDraw.annotationStyleOffset].fore );
2897 surface->MoveTo ( rcSegment.left, rcSegment.top );
2898 surface->LineTo ( rcSegment.left, rcSegment.bottom );
2899 surface->MoveTo ( rcSegment.right, rcSegment.top );
2900 surface->LineTo ( rcSegment.right, rcSegment.bottom );
2901 if ( subLine == ll->lines ) {
2902 surface->MoveTo ( rcSegment.left, rcSegment.top );
2903 surface->LineTo ( rcSegment.right, rcSegment.top );
2904 }
2905 if ( subLine == ll->lines + annotationLines - 1 ) {
2906 surface->MoveTo ( rcSegment.left, rcSegment.bottom - 1 );
2907 surface->LineTo ( rcSegment.right, rcSegment.bottom - 1 );
2908 }
2909 }
2910 }
2911}
2912
2913void Editor::DrawLine ( Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
2914 PRectangle rcLine, LineLayout *ll, int subLine )

Callers

nothing calls this directly

Calls 12

ValidStyledTextFunction · 0.85
WidestLineWidthFunction · 0.85
DrawStyledTextFunction · 0.85
GetLineIndentationMethod · 0.80
AnnotationStyledTextMethod · 0.80
FillRectangleMethod · 0.80
AnnotationLinesMethod · 0.80
LineLengthMethod · 0.80
PenColourMethod · 0.80
StyleAtMethod · 0.45
MoveToMethod · 0.45
LineToMethod · 0.45

Tested by

no test coverage detected