diff options
author | nyamatongwe <devnull@localhost> | 2007-02-18 00:33:25 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2007-02-18 00:33:25 +0000 |
commit | a01e47a0a71e7d061988b439a9d572030e6d675a (patch) | |
tree | 404b416dad8cac8c1b2cb30b0da958f1610e69ef | |
parent | 3ed3c6a46d98e7239ab0bac1afca9454445885de (diff) | |
download | scintilla-mirror-a01e47a0a71e7d061988b439a9d572030e6d675a.tar.gz |
Modification to printing avoids extra space between line numbers and text
due to counting the width of the screen line numbers as well as the print
line numbers.
-rw-r--r-- | src/Editor.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index e789e7b76..d3d16036b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3173,16 +3173,17 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff); vsPrint.Refresh(*surfaceMeasure); - // Ensure colours are set up - vsPrint.RefreshColourPalette(palette, true); - vsPrint.RefreshColourPalette(palette, false); // Determining width must hapen after fonts have been realised in Refresh int lineNumberWidth = 0; if (lineNumberIndex >= 0) { lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); vsPrint.ms[lineNumberIndex].width = lineNumberWidth; + vsPrint.Refresh(*surfaceMeasure); // Recalculate fixedColumnWidth } + // Ensure colours are set up + vsPrint.RefreshColourPalette(palette, true); + vsPrint.RefreshColourPalette(palette, false); int linePrintStart = pdoc->LineFromPosition(pfr->chrg.cpMin); int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; @@ -3201,14 +3202,14 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // Ensure we are styled to where we are formatting. pdoc->EnsureStyledTo(endPosPrint); - int xStart = vsPrint.fixedColumnWidth + pfr->rc.left + lineNumberWidth; + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; int ypos = pfr->rc.top; int lineDoc = linePrintStart; int nPrintPos = pfr->chrg.cpMin; int visibleLine = 0; - int widthPrint = pfr->rc.Width() - lineNumberWidth; + int widthPrint = pfr->rc.Width() - vsPrint.fixedColumnWidth; if (printWrapState == eWrapNone) widthPrint = LineLayout::wrapWidthInfinite; @@ -3230,7 +3231,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { ll.containsCaret = false; PRectangle rcLine; - rcLine.left = pfr->rc.left + lineNumberWidth; + rcLine.left = pfr->rc.left; rcLine.top = ypos; rcLine.right = pfr->rc.right - 1; rcLine.bottom = ypos + vsPrint.lineHeight; @@ -3259,7 +3260,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { PRectangle rcNumber = rcLine; rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify - rcNumber.left -= surfaceMeasure->WidthText( + rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); surface->FlushCachedState(); surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, |