| 1889 | } |
| 1890 | |
| 1891 | void DrawStyledText ( Surface *surface, ViewStyle &vs, int styleOffset, PRectangle rcText, int ascent, |
| 1892 | const StyledText &st, size_t start, size_t length ) |
| 1893 | { |
| 1894 | if ( st.multipleStyles ) { |
| 1895 | int x = rcText.left; |
| 1896 | size_t i = 0; |
| 1897 | while ( i < length ) { |
| 1898 | size_t end = i; |
| 1899 | int style = st.styles[i + start]; |
| 1900 | while ( end < length - 1 && st.styles[start + end + 1] == style ) { |
| 1901 | end++; |
| 1902 | } |
| 1903 | style += styleOffset; |
| 1904 | int width = surface->WidthText ( vs.styles[style].font, |
| 1905 | st.text + start + i, static_cast<int> ( end - i + 1 ) ); |
| 1906 | PRectangle rcSegment = rcText; |
| 1907 | rcSegment.left = x; |
| 1908 | rcSegment.right = x + width + 1; |
| 1909 | surface->DrawTextNoClip ( rcSegment, vs.styles[style].font, |
| 1910 | ascent, st.text + start + i, |
| 1911 | static_cast<int> ( end - i + 1 ), |
| 1912 | vs.styles[style].fore, |
| 1913 | vs.styles[style].back ); |
| 1914 | x += width; |
| 1915 | i = end + 1; |
| 1916 | } |
| 1917 | } else { |
| 1918 | size_t style = st.style + styleOffset; |
| 1919 | surface->DrawTextNoClip ( rcText, vs.styles[style].font, |
| 1920 | rcText.top + vs.maxAscent, st.text + start, |
| 1921 | static_cast<int> ( length ), |
| 1922 | vs.styles[style].fore, |
| 1923 | vs.styles[style].back ); |
| 1924 | } |
| 1925 | } |
| 1926 | |
| 1927 | void Editor::PaintSelMargin ( Surface *surfWindow, PRectangle &rc ) |
| 1928 | { |
no test coverage detected