| 2858 | } |
| 2859 | |
| 2860 | void 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 | |
| 2913 | void Editor::DrawLine ( Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, |
| 2914 | PRectangle rcLine, LineLayout *ll, int subLine ) |
nothing calls this directly
no test coverage detected