diff options
author | nyamatongwe <devnull@localhost> | 2003-01-01 04:47:35 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2003-01-01 04:47:35 +0000 |
commit | 4cb12c84a0682f82fcd5fc113a5a87ea42ece5c1 (patch) | |
tree | 7f93a12ef5b012a9137992f25275bfacb5f8ffeb | |
parent | 3a6568cf58dabdfa4e77b3a2ba7c37a71689052d (diff) | |
download | scintilla-mirror-4cb12c84a0682f82fcd5fc113a5a87ea42ece5c1.tar.gz |
Fixed up line wrapped printing and added property to turn wrapping on or
off for printing.
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 17 | ||||
-rw-r--r-- | src/Editor.h | 1 | ||||
-rw-r--r-- | win32/SciTE.properties | 4 |
5 files changed, 27 insertions, 3 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index 4fa58c481..ad6837cb2 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -505,6 +505,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define CARET_EVEN 0x08 #define SCI_SETXCARETPOLICY 2402 #define SCI_SETYCARETPOLICY 2403 +#define SCI_SETPRINTWRAPS 2406 +#define SCI_GETPRINTWRAPS 2407 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 88741ba3c..a1c785452 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1363,6 +1363,12 @@ fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop) # The exclusion zone is given in lines. fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) +# Set printing to line wrapped (true) or not line wrapped. +set void SetPrintWraps=2406(bool wraps,) + +# Is printing line wrapped. +get bool GetPrintWraps=2407(,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index 4190c3f87..9f10e3894 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -285,6 +285,7 @@ Editor::Editor() { printMagnification = 0; printColourMode = SC_PRINT_NORMAL; + printWraps = true; cursorMode = SC_CURSORNORMAL; controlCharSymbol = 0; /* Draw the control characters */ @@ -2411,7 +2412,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // Determining width must hapen after fonts have been realised in Refresh int lineNumberWidth = 0; if (lineNumberIndex >= 0) { - lineNumberWidth = surface->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, + lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, "99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace)); vsPrint.ms[lineNumberIndex].width = lineNumberWidth; } @@ -2420,7 +2421,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; if (linePrintLast < linePrintStart) linePrintLast = linePrintStart; - int linePrintMax = pdoc->LineFromPosition(pfr->chrg.cpMax - 1); + int linePrintMax = pdoc->LineFromPosition(pfr->chrg.cpMax); if (linePrintLast > linePrintMax) linePrintLast = linePrintMax; //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", @@ -2440,6 +2441,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { int nPrintPos = pfr->chrg.cpMin; int visibleLine = 0; + int widthPrint = pfr->rc.Width() - lineNumberWidth; + if (!printWraps) + widthPrint = LineLayout::wrapWidthInfinite; while (lineDoc <= linePrintLast && ypos < pfr->rc.bottom) { @@ -2452,7 +2456,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. LineLayout ll(8000); - LayoutLine(lineDoc, surfaceMeasure, vsPrint, &ll, pfr->rc.Width() - lineNumberWidth); + LayoutLine(lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); ll.selStart = -1; ll.selEnd = -1; @@ -4961,6 +4965,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETPRINTCOLOURMODE: return printColourMode; + case SCI_SETPRINTWRAPS: + printWraps = wParam != 0; + break; + + case SCI_GETPRINTWRAPS: + return printWraps; + case SCI_GETSTYLEAT: if (static_cast<short>(wParam) >= pdoc->Length()) return 0; diff --git a/src/Editor.h b/src/Editor.h index 6d9287705..15995e7ea 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -184,6 +184,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int printMagnification; int printColourMode; + bool printWraps; int cursorMode; int controlCharSymbol; diff --git a/win32/SciTE.properties b/win32/SciTE.properties index 671442b9e..17db9ad2b 100644 --- a/win32/SciTE.properties +++ b/win32/SciTE.properties @@ -1,3 +1,7 @@ +command.build.SConstruct=scons.bat . +command.name.1.SConstruct=scons clean +command.1.SConstruct=scons.bat --clean . + command.build.*.mak=nmake -f $(FileNameExt) QUIET=1 command.name.1.*.mak=nmake clean command.1.*.mak=nmake -f $(FileNameExt) clean |