This is mostly copied from the Paint method but with some things omitted such as the margin markers, line numbers, selection and caret Should be merged back into a combined Draw method.
| 3832 | // such as the margin markers, line numbers, selection and caret |
| 3833 | // Should be merged back into a combined Draw method. |
| 3834 | long Editor::FormatRange ( bool draw, Sci_RangeToFormat *pfr ) |
| 3835 | { |
| 3836 | if ( !pfr ) { |
| 3837 | return 0; |
| 3838 | } |
| 3839 | AutoSurface surface ( pfr->hdc, this, SC_TECHNOLOGY_DEFAULT ); |
| 3840 | if ( !surface ) { |
| 3841 | return 0; |
| 3842 | } |
| 3843 | AutoSurface surfaceMeasure ( pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT ); |
| 3844 | if ( !surfaceMeasure ) { |
| 3845 | return 0; |
| 3846 | } |
| 3847 | // Can't use measurements cached for screen |
| 3848 | posCache.Clear(); |
| 3849 | ViewStyle vsPrint ( vs ); |
| 3850 | vsPrint.technology = SC_TECHNOLOGY_DEFAULT; |
| 3851 | // Modify the view style for printing as do not normally want any of the transient features to be printed |
| 3852 | // Printing supports only the line number margin. |
| 3853 | int lineNumberIndex = -1; |
| 3854 | for ( int margin = 0; margin <= SC_MAX_MARGIN; margin++ ) { |
| 3855 | if ( ( vsPrint.ms[margin].style == SC_MARGIN_NUMBER ) && ( vsPrint.ms[margin].width > 0 ) ) { |
| 3856 | lineNumberIndex = margin; |
| 3857 | } else { |
| 3858 | vsPrint.ms[margin].width = 0; |
| 3859 | } |
| 3860 | } |
| 3861 | vsPrint.fixedColumnWidth = 0; |
| 3862 | vsPrint.zoomLevel = printMagnification; |
| 3863 | // Don't show indentation guides |
| 3864 | // If this ever gets changed, cached pixmap would need to be recreated if technology != SC_TECHNOLOGY_DEFAULT |
| 3865 | vsPrint.viewIndentationGuides = ivNone; |
| 3866 | // Don't show the selection when printing |
| 3867 | vsPrint.selbackset = false; |
| 3868 | vsPrint.selforeset = false; |
| 3869 | vsPrint.selAlpha = SC_ALPHA_NOALPHA; |
| 3870 | vsPrint.selAdditionalAlpha = SC_ALPHA_NOALPHA; |
| 3871 | vsPrint.whitespaceBackgroundSet = false; |
| 3872 | vsPrint.whitespaceForegroundSet = false; |
| 3873 | vsPrint.showCaretLineBackground = false; |
| 3874 | vsPrint.alwaysShowCaretLineBackground = false; |
| 3875 | // Don't highlight matching braces using indicators |
| 3876 | vsPrint.braceHighlightIndicatorSet = false; |
| 3877 | vsPrint.braceBadLightIndicatorSet = false; |
| 3878 | // Set colours for printing according to users settings |
| 3879 | for ( size_t sty = 0; sty < vsPrint.styles.size(); sty++ ) { |
| 3880 | if ( printColourMode == SC_PRINT_INVERTLIGHT ) { |
| 3881 | vsPrint.styles[sty].fore = InvertedLight ( vsPrint.styles[sty].fore ); |
| 3882 | vsPrint.styles[sty].back = InvertedLight ( vsPrint.styles[sty].back ); |
| 3883 | } else if ( printColourMode == SC_PRINT_BLACKONWHITE ) { |
| 3884 | vsPrint.styles[sty].fore = ColourDesired ( 0, 0, 0 ); |
| 3885 | vsPrint.styles[sty].back = ColourDesired ( 0xff, 0xff, 0xff ); |
| 3886 | } else if ( printColourMode == SC_PRINT_COLOURONWHITE ) { |
| 3887 | vsPrint.styles[sty].back = ColourDesired ( 0xff, 0xff, 0xff ); |
| 3888 | } else if ( printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG ) { |
| 3889 | if ( sty <= STYLE_DEFAULT ) { |
| 3890 | vsPrint.styles[sty].back = ColourDesired ( 0xff, 0xff, 0xff ); |
| 3891 | } |
nothing calls this directly
no test coverage detected