diff options
author | nyamatongwe <unknown> | 2005-03-20 01:37:22 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-03-20 01:37:22 +0000 |
commit | 0eeee7531d739c2fc06e54eb56d27f361ece0503 (patch) | |
tree | 8395a920bd832f73b878b22182452e5fc86f45c0 | |
parent | 6007ca5bf84031f6e353d05907f195ef448769ca (diff) | |
download | scintilla-mirror-0eeee7531d739c2fc06e54eb56d27f361ece0503.tar.gz |
Patch from nissl in RFE 1164540 adds WrapCount method.
-rw-r--r-- | doc/ScintillaDoc.html | 43 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 5 | ||||
-rw-r--r-- | src/Editor.cxx | 15 | ||||
-rw-r--r-- | src/Editor.h | 1 |
6 files changed, 46 insertions, 20 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index e075df0b1..879cccc36 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -787,7 +787,7 @@ struct TextToFind { unless the document is read-only.</p> <p>On X, the clipboard is asynchronous and may require several messages between - the destination and source applications. Data from SCI_PASTE will not arrive in the + the destination and source applications. Data from SCI_PASTE will not arrive in the document immediately.</p> <b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br /> @@ -2323,8 +2323,8 @@ struct TextToFind { horizontal space, such as Thai, will mostly work but there are some issues where the characters are drawn separately leading to visual glitches. Bi-directional text is not supported.</p> - <p>On Windows, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), - 949 (Korean), and 950 (Traditional Chinese Big5) although these may require installation of language + <p>On Windows, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), + 949 (Korean), and 950 (Traditional Chinese Big5) although these may require installation of language specific support.</p> <p>On GTK+, code page <code>SC_CP_DBCS</code> (1) sets Scintilla into @@ -2888,10 +2888,10 @@ struct TextToFind { <p>When the user makes a selection from the list the container is sent a <code><a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump" - href="#Notifications">notification message</a>. On return from the notification Scintilla will insert + href="#Notifications">notification message</a>. On return from the notification Scintilla will insert the selected text unless the autocompletion list has been cancelled, for example by the container sending <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p> - + <p>To make use of autocompletion you must monitor each character added to the document. See <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p> <code><a class="message" href="#SCI_AUTOCSHOW">SCI_AUTOCSHOW(int lenEntered, const char @@ -3599,10 +3599,10 @@ struct RangeToFormat { into the print rectangle. If you set <code>SC_WRAP_NONE</code>, each line of text generates one line of output and the line is truncated if it is too long to fit into the print area.<br /> - <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by - white space or style changes although if a word is longer than a line, it will be wrapped before - the line end. <code>SC_WRAP_CHAR</code> is preferred to - <code>SC_WRAP_WORD</code> for Asian languages where there is no white space + <code>SC_WRAP_WORD</code> tries to wrap only between words as indicated by + white space or style changes although if a word is longer than a line, it will be wrapped before + the line end. <code>SC_WRAP_CHAR</code> is preferred to + <code>SC_WRAP_WORD</code> for Asian languages where there is no white space between words.</p> <h2 id="DirectAccess">Direct access</h2> @@ -3730,7 +3730,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ The best way to see how this is done is to search the SciTE source code for the messages used in this section of the documentation and see how they are used. You will also need to use markers and a folding margin to complete your folding implementation. - The <code>"fold"</code> property should be set to <code>"1"</code> with + The <code>"fold"</code> property should be set to <code>"1"</code> with <code>SCI_SETPROPERTY("fold", "1")</code> to enable folding. </p> <code><a class="message" href="#SCI_VISIBLEFROMDOCLINE">SCI_VISIBLEFROMDOCLINE(int docLine)</a><br /> @@ -3910,6 +3910,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br /> <a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT</a><br /> <a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br /> + <a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br /> </code> <p>By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider @@ -3944,13 +3945,13 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <p><b id="SCI_SETWRAPMODE">SCI_SETWRAPMODE(int wrapMode)</b><br /> <b id="SCI_GETWRAPMODE">SCI_GETWRAPMODE</b><br /> - Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping - on word boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping - between any characters, and to <code>SC_WRAP_NONE</code> (0) to disable line - wrapping. <code>SC_WRAP_CHAR</code> is preferred to - <code>SC_WRAP_WORD</code> for Asian languages where there is no white space + Set wrapMode to <code>SC_WRAP_WORD</code> (1) to enable wrapping + on word boundaries, <code>SC_WRAP_CHAR</code> (2) to enable wrapping + between any characters, and to <code>SC_WRAP_NONE</code> (0) to disable line + wrapping. <code>SC_WRAP_CHAR</code> is preferred to + <code>SC_WRAP_WORD</code> for Asian languages where there is no white space between words.</p> - + <p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br /> <b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br /> @@ -4100,6 +4101,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Where this would lead to no space between words, an extra space is inserted. </p> + <p><b id="SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</b><br /> + Document lines can occupy more than one display line if they wrap and this + returns the number of display lines needed to wrap a document line.</p> + <h2 id="Zooming">Zooming</h2> <p>Scintilla incorporates a "zoom factor" that lets you make all the text in the document @@ -4416,7 +4421,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber); href="#SCI_SETREADONLY">SCI_SETREADONLY</a></code>.</p> <p><b id="SCN_KEY">SCN_KEY</b><br /> - Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of + Reports all keys pressed but not consumed by Scintilla. Used on GTK+ because of some problems with keyboard focus and is not sent by the Windows version. <code>SCNotification.ch</code> holds the key code and <code>SCNotification.modifiers</code> holds the modifiers. This notification is sent if the modifiers include <code>SCMOD_ALT</code> or <code>SCMOD_CTRL</code> and the key code is less @@ -4485,7 +4490,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber); <td align="left">Valid for text changes, not for style changes. If we are collecting undo information this holds a pointer to the text that is handed to the Undo system, otherwise - it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and + it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells, not bytes.</td> </tr> @@ -4900,7 +4905,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next <p><b id="SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</b><br /> The user has selected an item in an <a class="jump" href="#Autocompletion">autocompletion list</a>. The - notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a + notification is sent before the selection is inserted. Automatic insertion can be cancelled by sending a <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code> message before returning from the notification. The <code>SCNotification</code> fields used are:</p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 67b42abd8..482ad4697 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -192,6 +192,7 @@ <li>Borujoa</li> <li>Michael Owens</li> <li>Franck Marcia</li> + <li>nissl</li> </ul> <p> Images used in GTK+ version diff --git a/include/Scintilla.h b/include/Scintilla.h index cd1dbd77f..5e5528c0a 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -352,6 +352,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_CALLTIPSETFOREHLT 2207 #define SCI_VISIBLEFROMDOCLINE 2220 #define SCI_DOCLINEFROMVISIBLE 2221 +#define SCI_WRAPCOUNT 2235 #define SC_FOLDLEVELBASE 0x400 #define SC_FOLDLEVELWHITEFLAG 0x1000 #define SC_FOLDLEVELHEADERFLAG 0x2000 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 5436fced4..b7e64ed17 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -905,6 +905,9 @@ fun int VisibleFromDocLine=2220(int line,) # Find the document line of a display line taking hidden lines into account. fun int DocLineFromVisible=2221(int lineDisplay,) +# The number of display lines needed to wrap a document line +fun int WrapCount=2235(int line,) + enu FoldLevel=SC_FOLDLEVEL val SC_FOLDLEVELBASE=0x400 val SC_FOLDLEVELWHITEFLAG=0x1000 @@ -1596,7 +1599,7 @@ fun void SetLengthForEncode=2448(int bytes,) # On error return 0. fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) -# Find the position of a column on a line taking into account tabs and +# Find the position of a column on a line taking into account tabs and # multi-byte characters. If beyond end of line, return line end position. fun int FindColumn=2456(int line, int column) diff --git a/src/Editor.cxx b/src/Editor.cxx index 9211335df..5eb384bb2 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5572,6 +5572,18 @@ int Editor::CodePage() const { return 0; } +int Editor::WrapCount(int line) { + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + + if (surface && ll) { + LayoutLine(line, surface, vs, ll, wrapWidth); + return ll->lines; + } else { + return 1; + } +} + static bool ValidMargin(unsigned long wParam) { return wParam < ViewStyle::margins; } @@ -6642,6 +6654,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_DOCLINEFROMVISIBLE: return cs.DocFromDisplay(wParam); + case SCI_WRAPCOUNT: + return WrapCount(wParam); + case SCI_SETFOLDLEVEL: { int prev = pdoc->SetLevel(wParam, lParam); if (prev != lParam) diff --git a/src/Editor.h b/src/Editor.h index bace500bd..76e79e7e7 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -516,6 +516,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void GetHotSpotRange(int& hsStart, int& hsEnd); int CodePage() const; + int WrapCount(int line); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; |