diff options
author | XhmikosR <xhmikosr@gmail.com> | 2015-11-07 12:31:06 +0200 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2015-11-07 12:31:06 +0200 |
commit | 017529246a001ffe1df321bd5f799c29aa59d486 (patch) | |
tree | 6b9d847225816ca9bedb2cddb63cba47bbefe48e | |
parent | 0e976db39a47728f48aed5ef8dbda32cba25afcf (diff) | |
download | notepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.zip notepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.tar.gz notepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.tar.bz2 |
Update Scintilla to v3.6.2.
38 files changed, 327 insertions, 175 deletions
diff --git a/scintilla/doc/Design.html b/scintilla/doc/Design.html index d426cb3..1becd98 100644 --- a/scintilla/doc/Design.html +++ b/scintilla/doc/Design.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla and SciTE
</title>
diff --git a/scintilla/doc/Icons.html b/scintilla/doc/Icons.html index 0d8b8bf..b27de52 100644 --- a/scintilla/doc/Icons.html +++ b/scintilla/doc/Icons.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla icons
</title>
diff --git a/scintilla/doc/Indicators.png b/scintilla/doc/Indicators.png Binary files differindex 33e31f8..b67566e 100644 --- a/scintilla/doc/Indicators.png +++ b/scintilla/doc/Indicators.png diff --git a/scintilla/doc/Markers.png b/scintilla/doc/Markers.png Binary files differindex 6eee926..2ad37b1 100644 --- a/scintilla/doc/Markers.png +++ b/scintilla/doc/Markers.png diff --git a/scintilla/doc/Privacy.html b/scintilla/doc/Privacy.html index 22c8cd5..34eda60 100644 --- a/scintilla/doc/Privacy.html +++ b/scintilla/doc/Privacy.html @@ -5,6 +5,7 @@ <head> <meta name="generator" content="SciTE" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> <title> Privacy Policy </title> diff --git a/scintilla/doc/SciCoding.html b/scintilla/doc/SciCoding.html index 1d45f0a..c18bfdd 100644 --- a/scintilla/doc/SciCoding.html +++ b/scintilla/doc/SciCoding.html @@ -5,6 +5,7 @@ <head>
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla and SciTE Code Style Preferences
</title>
diff --git a/scintilla/doc/SciTEIco.png b/scintilla/doc/SciTEIco.png Binary files differindex d0cc869..90ab9ff 100644 --- a/scintilla/doc/SciTEIco.png +++ b/scintilla/doc/SciTEIco.png diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 263628f..e77c064 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -2224,6 +2224,14 @@ struct Sci_TextToFind { <td>White space used for indentation is displayed normally but after the first visible character, it is shown as dots and arrows.</td> </tr> + + <tr> + <th align="left"><code>SCWS_VISIBLEONLYININDENT</code></th> + + <td>3</td> + + <td>White space used for indentation is displayed as dots and arrows.</td> + </tr> </tbody> </table> diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index c3d3f44..7d7169c 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Download Scintilla
</title>
@@ -25,9 +26,9 @@ <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
- <font size="4"> <a href="http://www.scintilla.org/scintilla361.zip">
+ <font size="4"> <a href="http://www.scintilla.org/scintilla362.zip">
Windows</a>
- <a href="http://www.scintilla.org/scintilla361.tgz">
+ <a href="http://www.scintilla.org/scintilla362.tgz">
GTK+/Linux</a>
</font>
</td>
@@ -41,7 +42,7 @@ containing very few restrictions.
</p>
<h3>
- Release 3.6.1
+ Release 3.6.2
</h3>
<h4>
Source Code
@@ -49,8 +50,8 @@ The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
- <li><a href="http://www.scintilla.org/scintilla361.zip">zip format</a> (1500K) commonly used on Windows</li>
- <li><a href="http://www.scintilla.org/scintilla361.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
+ <li><a href="http://www.scintilla.org/scintilla362.zip">zip format</a> (1500K) commonly used on Windows</li>
+ <li><a href="http://www.scintilla.org/scintilla362.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 456fbb7..05f531c 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla and SciTE
</title>
@@ -487,7 +488,81 @@ </li>
</ul>
<h3>
- <a href="http://prdownloads.sourceforge.net/scintilla/scite361.zip?download">Release 3.6.1</a>
+ <a href="http://www.scintilla.org/scite362.zip">Release 3.6.2</a>
+ </h3>
+ <ul>
+ <li>
+ Released 6 November 2015.
+ </li>
+ <li>
+ Whitespace may be made visible just in indentation.
+ </li>
+ <li>
+ Whitespace dots are centred when larger than 1 pixel.
+ </li>
+ <li>
+ The Scintilla framework on Cocoa now contains version numbers.
+ </li>
+ <li>
+ SciTE's standard properties collect values from all active .properties file to produce the Language menu
+ and the file types pull-down in the File open dialog.
+ </li>
+ <li>
+ The single executable version of SciTE, Sc1, uses 'module' statements within its embedded
+ properties. This makes it act more like the full distribution allowing languages to be turned on
+ and off by setting imports.include and imports.exclude.
+ The default imports.exclude property adds eiffel, erlang, ps, and pov so these languages are
+ turned off by default.
+ </li>
+ <li>
+ SciTE adds an output.blank.margin.left property to allow setting the output pane
+ margin to a different width than the edit pane.
+ </li>
+ <li>
+ CoffeeScript lexer highlights ranges correctly.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1765/">Bug #1765</a>.
+ </li>
+ <li>
+ Markdown lexer treats line starts consistently to always highlight *foo* or similar at line start.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1766/">Bug #1766</a>.
+ </li>
+ <li>
+ Optimise marker redrawing by only drawing affected lines when markers shown in the text.
+ </li>
+ <li>
+ On Cocoa, timers and idling now work in modal dialogs. This also stops some crashes.
+ </li>
+ <li>
+ On Cocoa, fix crashes when deleting a ScintillaView. These crashes could occur when scrolling
+ at the time the ScintillaView was deleted although there may have been other cases.
+ </li>
+ <li>
+ On GTK+ 2.x, fix height of lines in autocompletion lists.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1774/">Bug #1774</a>.
+ </li>
+ <li>
+ Fix bug with SCI_LINEENDDISPLAY where the caret moved to the next document line instead of the
+ end of the display line.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1772/">Bug #1772</a>.
+ </li>
+ <li>
+ Report error (SC_STATUS_FAILURE) when negative length passed to SCI_SETSTYLING.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1768/">Bug #1768</a>.
+ </li>
+ <li>
+ When SC_MARK_UNDERLINE is not assigned to a margin, stop drawing the whole line.
+ </li>
+ <li>
+ When reverting an untitled document in SciTE, just clear it with no message about a file.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1764/">Bug #1764</a>.
+ </li>
+ <li>
+ SciTE on GTK+ allows use of Ctrl+A (Select All) inside find and replace strips.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1769/">Bug #1769</a>.
+ </li>
+ </ul>
+ <h3>
+ <a href="http://www.scintilla.org/scite361.zip">Release 3.6.1</a>
</h3>
<ul>
<li>
@@ -533,6 +608,7 @@ <li>
On GTK+, avoid "Invalid rectangle passed" warning messages by never reporting the client
rectangle with a negative width or height.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1743/">Bug #1743</a>.
</li>
<li>
On Cocoa, copy Sci_Position.h into the framework so clients can build.
diff --git a/scintilla/doc/ScintillaRelated.html b/scintilla/doc/ScintillaRelated.html index 3a20b08..2403ee1 100644 --- a/scintilla/doc/ScintillaRelated.html +++ b/scintilla/doc/ScintillaRelated.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla and SciTE Related Sites
</title>
diff --git a/scintilla/doc/ScintillaToDo.html b/scintilla/doc/ScintillaToDo.html index 17b9307..5b29942 100644 --- a/scintilla/doc/ScintillaToDo.html +++ b/scintilla/doc/ScintillaToDo.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla and SciTE To Do
</title>
diff --git a/scintilla/doc/ScintillaUsage.html b/scintilla/doc/ScintillaUsage.html index c19cbc5..14bec8f 100644 --- a/scintilla/doc/ScintillaUsage.html +++ b/scintilla/doc/ScintillaUsage.html @@ -6,6 +6,7 @@ <meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Scintilla Usage Notes
</title>
diff --git a/scintilla/doc/annotations.png b/scintilla/doc/annotations.png Binary files differindex 9d9b247..23e5feb 100644 --- a/scintilla/doc/annotations.png +++ b/scintilla/doc/annotations.png diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index a77930f..21297c0 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,7 +9,8 @@ <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
- <meta name="Date.Modified" content="20150915" />
+ <meta name="Date.Modified" content="20151106" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
#versionlist {
margin: 0;
@@ -55,8 +56,8 @@ GTK+, and OS X</font>
</td>
<td width="40%" align="right">
- <font color="#FFCC99" size="3"> Release version 3.6.1<br />
- Site last modified September 15 2015</font>
+ <font color="#FFCC99" size="3"> Release version 3.6.2<br />
+ Site last modified November 6 2015</font>
</td>
<td width="20%">
@@ -71,15 +72,11 @@ </tr>
</table>
<ul id="versionlist">
+ <li>Version 3.6.2 fixes crashes and other bugs, particularly on Cocoa.</li>
<li>Version 3.6.1 adds minor features and fixes bugs.</li>
<li>Version 3.6.0 implements more multiple selection operations.
Type definitions Sci_Position, Sci_PositionU, and Sci_PositionCR allow client
code to prepare for a future change allowing larger than 2 GB documents.</li>
- <li>Version 3.5.7 fixes a crash on Cocoa with drag and drop and adds commands to add the next or each occurrence of the
- main selection to the set of selections.</li>
- <li>Version 3.5.6 fixes a bug with undo on Cocoa that could lose data.</li>
- <li>Version 3.5.5 improves IME on Qt and fixes minor bugs.</li>
- <li>Version 3.5.4 improves indicators to be able to change appearance on mouse-over and to use a wide variety of colours together.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
diff --git a/scintilla/doc/styledmargin.png b/scintilla/doc/styledmargin.png Binary files differindex 3aaf35b..30ccbfd 100644 --- a/scintilla/doc/styledmargin.png +++ b/scintilla/doc/styledmargin.png diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 432c3bc..77b2078 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -73,6 +73,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCWS_INVISIBLE 0
#define SCWS_VISIBLEALWAYS 1
#define SCWS_VISIBLEAFTERINDENT 2
+#define SCWS_VISIBLEONLYININDENT 3
#define SCI_GETVIEWWS 2020
#define SCI_SETVIEWWS 2021
#define SCI_POSITIONFROMPOINT 2022
diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index ec8d0bd..fb7d053 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -159,6 +159,7 @@ enu WhiteSpace=SCWS_ val SCWS_INVISIBLE=0
val SCWS_VISIBLEALWAYS=1
val SCWS_VISIBLEAFTERINDENT=2
+val SCWS_VISIBLEONLYININDENT=3
# Are white space characters currently visible?
# Returns one of SCWS_* constants.
diff --git a/scintilla/lexers/LexCoffeeScript.cxx b/scintilla/lexers/LexCoffeeScript.cxx index 7e64b85..51229b1 100644 --- a/scintilla/lexers/LexCoffeeScript.cxx +++ b/scintilla/lexers/LexCoffeeScript.cxx @@ -252,6 +252,10 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length }
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
+ // Handle '..' and '...' operators correctly.
+ if (sc.ch == '.') {
+ for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ;
+ }
}
}
diff --git a/scintilla/lexers/LexECL.cxx b/scintilla/lexers/LexECL.cxx index 95a4780..7c00cdc 100644 --- a/scintilla/lexers/LexECL.cxx +++ b/scintilla/lexers/LexECL.cxx @@ -388,7 +388,7 @@ static bool IsStreamCommentStyle(int style) { style == SCE_ECL_COMMENTDOCKEYWORDERROR;
}
-bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) {
+static bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) {
Sci_Position i=0;
for (; *s; i++) {
char compare_char = tolower(*s);
diff --git a/scintilla/lexers/LexInno.cxx b/scintilla/lexers/LexInno.cxx index 8db8349..5f68440 100644 --- a/scintilla/lexers/LexInno.cxx +++ b/scintilla/lexers/LexInno.cxx @@ -33,7 +33,7 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W char ch = 0;
char chNext = styler[startPos];
Sci_Position lengthDoc = startPos + length;
- char *buffer = new char[length];
+ char *buffer = new char[length+1];
Sci_Position bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
bool isCStyleComment = false;
diff --git a/scintilla/lexers/LexMarkdown.cxx b/scintilla/lexers/LexMarkdown.cxx index 6729ca5..9562882 100644 --- a/scintilla/lexers/LexMarkdown.cxx +++ b/scintilla/lexers/LexMarkdown.cxx @@ -114,7 +114,7 @@ static bool HasPrevLineContent(StyleContext &sc) { }
static bool AtTermStart(StyleContext &sc) {
- return sc.currentPos == 0 || isspacechar(sc.chPrev);
+ return sc.currentPos == 0 || sc.chPrev == 0 || isspacechar(sc.chPrev);
}
static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) {
diff --git a/scintilla/lexers/LexMySQL.cxx b/scintilla/lexers/LexMySQL.cxx index 87f537f..4cd89e5 100644 --- a/scintilla/lexers/LexMySQL.cxx +++ b/scintilla/lexers/LexMySQL.cxx @@ -331,7 +331,7 @@ static bool IsStreamCommentStyle(int style) * Code copied from StyleContext and modified to work here. Should go into Accessor as a
* companion to Match()...
*/
-bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s)
+static bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s)
{
for (Sci_Position n = 0; *s; n++)
{
diff --git a/scintilla/lexers/LexPB.cxx b/scintilla/lexers/LexPB.cxx index 73ad621..e967fd8 100644 --- a/scintilla/lexers/LexPB.cxx +++ b/scintilla/lexers/LexPB.cxx @@ -70,7 +70,7 @@ static inline bool IsAWordStart(const int ch) return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
+static bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
{
char ch;
for (Sci_Position i=0; *s; i++)
diff --git a/scintilla/lexers/LexSML.cxx b/scintilla/lexers/LexSML.cxx index e083037..37dcdd4 100644 --- a/scintilla/lexers/LexSML.cxx +++ b/scintilla/lexers/LexSML.cxx @@ -33,7 +33,7 @@ inline int issmld(int c) {return isdigit(c) || c == '_';} using namespace Scintilla;
#endif
-void ColouriseSMLDoc(
+static void ColouriseSMLDoc(
Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
@@ -205,7 +205,7 @@ void ColouriseSMLDoc( sc.Complete();
}
-void FoldSMLDoc(
+static void FoldSMLDoc(
Sci_PositionU, Sci_Position,
int,
WordList *[],
diff --git a/scintilla/scripts/FileGenerator.py b/scintilla/scripts/FileGenerator.py index 01a79bf..e2750eb 100644 --- a/scintilla/scripts/FileGenerator.py +++ b/scintilla/scripts/FileGenerator.py @@ -137,6 +137,25 @@ def Regenerate(filename, commentPrefix, *lists): """ Generate(filename, filename, commentPrefix, *lists) +def UpdateLineInPlistFile(path, key, value): + """Replace a single string value preceded by 'key' in an XML plist file. + """ + lines = [] + keyCurrent = "" + with codecs.open(path, "rb", "utf-8") as f: + for l in f.readlines(): + ls = l.strip() + if ls.startswith("<key>"): + keyCurrent = ls.replace("<key>", "").replace("</key>", "") + elif ls.startswith("<string>"): + if keyCurrent == key: + start, tag, rest = l.partition("<string>") + val, etag, end = rest.partition("</string>") + l = start + tag + value + etag + end + lines.append(l) + contents = "".join(lines) + UpdateFile(path, contents) + def UpdateLineInFile(path, linePrefix, lineReplace): lines = [] updated = False diff --git a/scintilla/scripts/LexGen.py b/scintilla/scripts/LexGen.py index 4bf8837..e22d69a 100644 --- a/scintilla/scripts/LexGen.py +++ b/scintilla/scripts/LexGen.py @@ -8,7 +8,7 @@ # Files are regenerated in place with templates stored in comments. # The format of generation comments is documented in FileGenerator.py. -from FileGenerator import Regenerate, UpdateLineInFile, ReplaceREInFile +from FileGenerator import Regenerate, UpdateLineInFile, ReplaceREInFile, UpdateLineInPlistFile import ScintillaData import HFacer @@ -38,6 +38,10 @@ def UpdateVersionNumbers(sci, root): UpdateLineInFile(root + "doc/ScintillaHistory.html", ' Released ', ' Released ' + sci.dmyModified + '.') + UpdateLineInPlistFile(root + "cocoa/ScintillaFramework/Info.plist", + "CFBundleVersion", sci.versionDotted) + UpdateLineInPlistFile(root + "cocoa/ScintillaFramework/Info.plist", + "CFBundleShortVersionString", sci.versionDotted) def RegenerateAll(root): diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index b955be1..9db875e 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -2141,7 +2141,7 @@ int Document::WordPartRight(int pos) { return pos;
}
-bool IsLineEndChar(char c) {
+static bool IsLineEndChar(char c) {
return (c == '\n' || c == '\r');
}
diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index f8912a9..04b94a8 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -291,7 +291,7 @@ void EditView::AllocateGraphics(const ViewStyle &vsDraw) { pixmapIndentGuideHighlight = Surface::Allocate(vsDraw.technology); } -const char *ControlCharacterString(unsigned char ch) { +static const char *ControlCharacterString(unsigned char ch) { const char *reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", @@ -305,7 +305,7 @@ const char *ControlCharacterString(unsigned char ch) { } } -void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { +static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { int ydiff = static_cast<int>(rcTab.bottom - rcTab.top) / 2; int xhead = static_cast<int>(rcTab.right) - 1 - ydiff; if (xhead <= rcTab.left) { @@ -711,12 +711,14 @@ int EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, int int posInLine = pos - posLineStart; if (posInLine <= ll->maxLineLength) { for (int subLine = 0; subLine < ll->lines; subLine++) { - if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { + if ((posInLine >= ll->LineStart(subLine)) && + (posInLine <= ll->LineStart(subLine + 1)) && + (posInLine <= ll->numCharsBeforeEOL)) { if (start) { posRet = ll->LineStart(subLine) + posLineStart; } else { if (subLine == ll->lines - 1) - posRet = ll->LineStart(subLine + 1) + posLineStart; + posRet = ll->numCharsBeforeEOL + posLineStart; else posRet = ll->LineStart(subLine + 1) + posLineStart - 1; } @@ -1301,8 +1303,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi if (ts.representation) { if (ll->chars[i] == '\t') { // Tab display - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) textBack = vsDraw.whitespaceColours.back; } else { // Blob display @@ -1312,12 +1313,10 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi } else { // Normal text display surface->FillRectangle(rcSegment, textBack); - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { + if (vsDraw.viewWhitespace != wsInvisible) { for (int cpos = 0; cpos <= i - ts.start; cpos++) { if (ll->chars[cpos + ts.start] == ' ') { - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) { PRectangle rcSpace( ll->positions[cpos + ts.start] + xStart - static_cast<XYPOSITION>(subLineStart), rcSegment.top, @@ -1408,27 +1407,26 @@ static void DrawTranslucentLineState(Surface *surface, const EditModel &model, c if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret) { SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); } - int marks = model.pdoc->GetMark(line); - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) { - SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); - } else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) { - PRectangle rcUnderline = rcLine; - rcUnderline.top = rcUnderline.bottom - 2; - SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + const int marksOfLine = model.pdoc->GetMark(line); + int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText; + for (int markBit = 0; (markBit < 32) && marksDrawnInText; markBit++) { + if (marksDrawnInText & 1) { + if (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + } else if (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) { + PRectangle rcUnderline = rcLine; + rcUnderline.top = rcUnderline.bottom - 2; + SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + } } - marks >>= 1; + marksDrawnInText >>= 1; } - if (vsDraw.maskInLine) { - int marksMasked = model.pdoc->GetMark(line) & vsDraw.maskInLine; - if (marksMasked) { - for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { - if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) { - SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); - } - marksMasked >>= 1; - } + int marksDrawnInLine = marksOfLine & vsDraw.maskInLine; + for (int markBit = 0; (markBit < 32) && marksDrawnInLine; markBit++) { + if (marksDrawnInLine & 1) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); } + marksDrawnInLine >>= 1; } } @@ -1504,8 +1502,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi if (ll->chars[i] == '\t') { // Tab display if (phasesDraw == phasesOne) { - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) textBack = vsDraw.whitespaceColours.back; surface->FillRectangle(rcSegment, textBack); } @@ -1521,7 +1518,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi } } if (vsDraw.viewWhitespace != wsInvisible) { - if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + if (vsDraw.WhiteSpaceVisible(inIndentation)) { if (vsDraw.whitespaceColours.fore.isSet) textFore = vsDraw.whitespaceColours.fore; surface->PenColour(textFore); @@ -1569,10 +1566,9 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi if (vsDraw.viewWhitespace != wsInvisible) { if (vsDraw.whitespaceColours.fore.isSet) textFore = vsDraw.whitespaceColours.fore; - if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + if (vsDraw.WhiteSpaceVisible(inIndentation)) { XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2; - if ((phasesDraw == phasesOne) && drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + if ((phasesDraw == phasesOne) && drawWhitespaceBackground) { textBack = vsDraw.whitespaceColours.back; PRectangle rcSpace( ll->positions[cpos + ts.start] + xStart - static_cast<XYPOSITION>(subLineStart), @@ -1581,7 +1577,8 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi rcSegment.bottom); surface->FillRectangle(rcSpace, textBack); } - PRectangle rcDot(xmid + xStart - static_cast<XYPOSITION>(subLineStart), + const int halfDotWidth = vsDraw.whitespaceSize / 2; + PRectangle rcDot(xmid + xStart - halfDotWidth - static_cast<XYPOSITION>(subLineStart), rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f); rcDot.right = rcDot.left + vsDraw.whitespaceSize; rcDot.bottom = rcDot.top + vsDraw.whitespaceSize; @@ -1940,7 +1937,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan // Space (3 space characters) between line numbers and text when printing. #define lineNumberPrintSpace " " -ColourDesired InvertedLight(ColourDesired orig) { +static ColourDesired InvertedLight(ColourDesired orig) { unsigned int r = orig.GetRed(); unsigned int g = orig.GetGreen(); unsigned int b = orig.GetBlue(); diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 5479ac5..03f17c0 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -478,44 +478,48 @@ void Editor::Redraw() { }
void Editor::RedrawSelMargin(int line, bool allAfter) {
- bool abandonDraw = false;
- if (!wMargin.GetID()) // Margin in main window so may need to abandon and retry
- abandonDraw = AbandonPaint();
- if (!abandonDraw) {
- if (vs.maskInLine) {
- Redraw();
- } else {
- PRectangle rcSelMargin = GetClientRectangle();
- rcSelMargin.right = rcSelMargin.left + vs.fixedColumnWidth;
- if (line != -1) {
- PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0);
-
- // Inflate line rectangle if there are image markers with height larger than line height
- if (vs.largestMarkerHeight > vs.lineHeight) {
- int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2;
- rcLine.top -= delta;
- rcLine.bottom += delta;
- if (rcLine.top < rcSelMargin.top)
- rcLine.top = rcSelMargin.top;
- if (rcLine.bottom > rcSelMargin.bottom)
- rcLine.bottom = rcSelMargin.bottom;
- }
-
- rcSelMargin.top = rcLine.top;
- if (!allAfter)
- rcSelMargin.bottom = rcLine.bottom;
- if (rcSelMargin.Empty())
- return;
- }
- if (wMargin.GetID()) {
- Point ptOrigin = GetVisibleOriginInMain();
- rcSelMargin.Move(-ptOrigin.x, -ptOrigin.y);
- wMargin.InvalidateRectangle(rcSelMargin);
- } else {
- wMain.InvalidateRectangle(rcSelMargin);
- }
+ const bool markersInText = vs.maskInLine || vs.maskDrawInText;
+ if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry
+ if (AbandonPaint()) {
+ return;
}
}
+ if (wMargin.GetID() && markersInText) {
+ Redraw();
+ return;
+ }
+ PRectangle rcMarkers = GetClientRectangle();
+ if (!markersInText) {
+ // Normal case: just draw the margin
+ rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth;
+ }
+ if (line != -1) {
+ PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0);
+
+ // Inflate line rectangle if there are image markers with height larger than line height
+ if (vs.largestMarkerHeight > vs.lineHeight) {
+ int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2;
+ rcLine.top -= delta;
+ rcLine.bottom += delta;
+ if (rcLine.top < rcMarkers.top)
+ rcLine.top = rcMarkers.top;
+ if (rcLine.bottom > rcMarkers.bottom)
+ rcLine.bottom = rcMarkers.bottom;
+ }
+
+ rcMarkers.top = rcLine.top;
+ if (!allAfter)
+ rcMarkers.bottom = rcLine.bottom;
+ if (rcMarkers.Empty())
+ return;
+ }
+ if (wMargin.GetID()) {
+ Point ptOrigin = GetVisibleOriginInMain();
+ rcMarkers.Move(-ptOrigin.x, -ptOrigin.y);
+ wMargin.InvalidateRectangle(rcMarkers);
+ } else {
+ wMain.InvalidateRectangle(rcMarkers);
+ }
}
PRectangle Editor::RectangleFromRange(Range r, int overlap) {
@@ -6279,7 +6283,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break;
case SCI_SETSTYLING:
- pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
+ if (static_cast<int>(wParam) < 0)
+ errorStatus = SC_STATUS_FAILURE;
+ else
+ pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
break;
case SCI_SETSTYLINGEX: // Specify a complete styling buffer
@@ -7930,7 +7937,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SWAPMAINANCHORCARET:
InvalidateSelection(sel.RangeMain());
- sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret);
+ sel.RangeMain().Swap();
break;
case SCI_MULTIPLESELECTADDNEXT:
diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index ecb9ec4..1d42f76 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -305,7 +305,7 @@ void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) { }
}
-unsigned char escapeValue(unsigned char ch) {
+static unsigned char escapeValue(unsigned char ch) {
switch (ch) {
case 'a': return '\a';
case 'b': return '\b';
diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx index 8133537..79ef16c 100644 --- a/scintilla/src/Selection.cxx +++ b/scintilla/src/Selection.cxx @@ -126,6 +126,10 @@ SelectionSegment SelectionRange::Intersect(SelectionSegment check) const { }
}
+void SelectionRange::Swap() {
+ std::swap(caret, anchor);
+}
+
bool SelectionRange::Trim(SelectionRange range) {
SelectionPosition startRange = range.Start();
SelectionPosition endRange = range.End();
diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h index fc14408..ce4e253 100644 --- a/scintilla/src/Selection.h +++ b/scintilla/src/Selection.h @@ -126,6 +126,7 @@ struct SelectionRange { SelectionPosition End() const {
return (anchor < caret) ? caret : anchor;
}
+ void Swap();
bool Trim(SelectionRange range);
// If range is all virtual collapse to start of virtual space
void MinimizeVirtualSpace();
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index eff7a82..e288464 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -151,6 +151,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { ms[margin] = source.ms[margin];
}
maskInLine = source.maskInLine;
+ maskDrawInText = source.maskDrawInText;
fixedColumnWidth = source.fixedColumnWidth;
marginInside = source.marginInside;
textStart = source.textStart;
@@ -191,6 +192,32 @@ ViewStyle::~ViewStyle() { fonts.clear();
}
+void ViewStyle::CalculateMarginWidthAndMask() {
+ fixedColumnWidth = marginInside ? leftMarginWidth : 0;
+ maskInLine = 0xffffffff;
+ int maskDefinedMarkers = 0;
+ for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
+ fixedColumnWidth += ms[margin].width;
+ if (ms[margin].width > 0)
+ maskInLine &= ~ms[margin].mask;
+ maskDefinedMarkers |= ms[margin].mask;
+ }
+ maskDrawInText = 0;
+ for (int markBit = 0; markBit < 32; markBit++) {
+ const int maskBit = 1 << markBit;
+ switch (markers[markBit].markType) {
+ case SC_MARK_EMPTY:
+ maskInLine &= ~maskBit;
+ break;
+ case SC_MARK_BACKGROUND:
+ case SC_MARK_UNDERLINE:
+ maskInLine &= ~maskBit;
+ maskDrawInText |= maskDefinedMarkers & maskBit;
+ break;
+ }
+ }
+}
+
void ViewStyle::Init(size_t stylesSize_) {
AllocStyles(stylesSize_);
nextExtendedStyle = 256;
@@ -265,13 +292,7 @@ void ViewStyle::Init(size_t stylesSize_) { ms[2].width = 0;
ms[2].mask = 0;
marginInside = true;
- fixedColumnWidth = marginInside ? leftMarginWidth : 0;
- maskInLine = 0xffffffff;
- for (int margin=0; margin <= SC_MAX_MARGIN; margin++) {
- fixedColumnWidth += ms[margin].width;
- if (ms[margin].width > 0)
- maskInLine &= ~ms[margin].mask;
- }
+ CalculateMarginWidthAndMask();
textStart = marginInside ? fixedColumnWidth : leftMarginWidth;
zoomLevel = 0;
viewWhitespace = wsInvisible;
@@ -368,13 +389,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast<char>(controlCharSymbol));
}
- fixedColumnWidth = marginInside ? leftMarginWidth : 0;
- maskInLine = 0xffffffff;
- for (int margin=0; margin <= SC_MAX_MARGIN; margin++) {
- fixedColumnWidth += ms[margin].width;
- if (ms[margin].width > 0)
- maskInLine &= ~ms[margin].mask;
- }
+ CalculateMarginWidthAndMask();
textStart = marginInside ? fixedColumnWidth : leftMarginWidth;
}
@@ -477,7 +492,7 @@ ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lin int marksMasked = marksOfLine & maskInLine;
if (marksMasked) {
for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
- if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) &&
+ if ((marksMasked & 1) &&
(markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
background = ColourOptional(markers[markBit].back, true);
}
@@ -497,6 +512,12 @@ bool ViewStyle::WhitespaceBackgroundDrawn() const { return (viewWhitespace != wsInvisible) && (whitespaceColours.back.isSet);
}
+bool ViewStyle::WhiteSpaceVisible(bool inIndent) const {
+ return (!inIndent && viewWhitespace == wsVisibleAfterIndent) ||
+ (inIndent && viewWhitespace == wsVisibleOnlyInIndent) ||
+ viewWhitespace == wsVisibleAlways;
+}
+
ColourDesired ViewStyle::WrapColour() const {
if (whitespaceColours.fore.isSet)
return whitespaceColours.fore;
diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index df0e322..8244844 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -52,7 +52,7 @@ public: enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
-enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
+enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2, wsVisibleOnlyInIndent=3};
typedef std::map<FontSpecification, FontRealised *> FontMap;
@@ -114,6 +114,7 @@ public: int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on right of text
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
+ int maskDrawInText; ///< Mask for markers that always draw in text
MarginStyle ms[SC_MAX_MARGIN+1];
int fixedColumnWidth; ///< Total width of margins
bool marginInside; ///< true: margin included in text view, false: separate views
@@ -160,6 +161,7 @@ public: ViewStyle();
ViewStyle(const ViewStyle &source);
~ViewStyle();
+ void CalculateMarginWidthAndMask();
void Init(size_t stylesSize_=256);
void Refresh(Surface &surface, int tabInChars);
void ReleaseAllExtendedStyles();
@@ -183,6 +185,8 @@ public: bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
bool SetWrapIndentMode(int wrapIndentMode_);
+ bool WhiteSpaceVisible(bool inIndent) const;
+
private:
void AllocStyles(size_t sizeNew);
void CreateAndAddFont(const FontSpecification &fs);
diff --git a/scintilla/version.txt b/scintilla/version.txt index 2f5742f..ecd385f 100644 --- a/scintilla/version.txt +++ b/scintilla/version.txt @@ -1 +1 @@ -361
+362
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index afecb61..3f40818 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -325,7 +325,7 @@ FontCached::FontCached(const FontParameters &fp) : fid = 0;
if (technology == SCWIN_TECH_GDI) {
HFONT hfont = ::CreateFontIndirectW(&lf);
- fid = reinterpret_cast<void *>(new FormatAndMetrics(hfont, fp.extraFontFlag, fp.characterSet));
+ fid = static_cast<void *>(new FormatAndMetrics(hfont, fp.extraFontFlag, fp.characterSet));
} else {
#if defined(USE_D2D)
IDWriteTextFormat *pTextFormat;
@@ -365,7 +365,7 @@ FontCached::FontCached(const FontParameters &fp) : pTextLayout->Release();
pTextFormat->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, lineMetrics[0].height, lineMetrics[0].baseline);
}
- fid = reinterpret_cast<void *>(new FormatAndMetrics(pTextFormat, fp.extraFontFlag, fp.characterSet, yAscent, yDescent, yInternalLeading));
+ fid = static_cast<void *>(new FormatAndMetrics(pTextFormat, fp.extraFontFlag, fp.characterSet, yAscent, yDescent, yInternalLeading));
}
#endif
}
@@ -388,7 +388,7 @@ bool FontCached::SameAs(const FontParameters &fp) { }
void FontCached::Release() {
- delete reinterpret_cast<FormatAndMetrics *>(fid);
+ delete static_cast<FormatAndMetrics *>(fid);
fid = 0;
}
@@ -585,31 +585,31 @@ SurfaceGDI::~SurfaceGDI() { void SurfaceGDI::Release() {
if (penOld) {
- ::SelectObject(reinterpret_cast<HDC>(hdc), penOld);
+ ::SelectObject(hdc, penOld);
::DeleteObject(pen);
penOld = 0;
}
pen = 0;
if (brushOld) {
- ::SelectObject(reinterpret_cast<HDC>(hdc), brushOld);
+ ::SelectObject(hdc, brushOld);
::DeleteObject(brush);
brushOld = 0;
}
brush = 0;
if (fontOld) {
// Fonts are not deleted as they are owned by a Font object
- ::SelectObject(reinterpret_cast<HDC>(hdc), fontOld);
+ ::SelectObject(hdc, fontOld);
fontOld = 0;
}
font = 0;
if (bitmapOld) {
- ::SelectObject(reinterpret_cast<HDC>(hdc), bitmapOld);
+ ::SelectObject(hdc, bitmapOld);
::DeleteObject(bitmap);
bitmapOld = 0;
}
bitmap = 0;
if (hdcOwned) {
- ::DeleteDC(reinterpret_cast<HDC>(hdc));
+ ::DeleteDC(hdc);
hdc = 0;
hdcOwned = false;
}
@@ -623,13 +623,13 @@ void SurfaceGDI::Init(WindowID) { Release();
hdc = ::CreateCompatibleDC(NULL);
hdcOwned = true;
- ::SetTextAlign(reinterpret_cast<HDC>(hdc), TA_BASELINE);
+ ::SetTextAlign(hdc, TA_BASELINE);
}
void SurfaceGDI::Init(SurfaceID sid, WindowID) {
Release();
- hdc = reinterpret_cast<HDC>(sid);
- ::SetTextAlign(reinterpret_cast<HDC>(hdc), TA_BASELINE);
+ hdc = static_cast<HDC>(sid);
+ ::SetTextAlign(hdc, TA_BASELINE);
}
void SurfaceGDI::InitPixMap(int width, int height, Surface *surface_, WindowID) {
@@ -639,7 +639,7 @@ void SurfaceGDI::InitPixMap(int width, int height, Surface *surface_, WindowID) hdcOwned = true;
bitmap = ::CreateCompatibleBitmap(psurfOther->hdc, width, height);
bitmapOld = static_cast<HBITMAP>(::SelectObject(hdc, bitmap));
- ::SetTextAlign(reinterpret_cast<HDC>(hdc), TA_BASELINE);
+ ::SetTextAlign(hdc, TA_BASELINE);
SetUnicodeMode(psurfOther->unicodeMode);
SetDBCSMode(psurfOther->codePage);
}
@@ -652,7 +652,7 @@ void SurfaceGDI::PenColour(ColourDesired fore) { penOld = 0;
}
pen = ::CreatePen(0,1,fore.AsLong());
- penOld = static_cast<HPEN>(::SelectObject(reinterpret_cast<HDC>(hdc), pen));
+ penOld = static_cast<HPEN>(::SelectObject(hdc, pen));
}
void SurfaceGDI::BrushColor(ColourDesired back) {
@@ -670,14 +670,14 @@ void SurfaceGDI::BrushColor(ColourDesired back) { void SurfaceGDI::SetFont(Font &font_) {
if (font_.GetID() != font) {
- FormatAndMetrics *pfm = reinterpret_cast<FormatAndMetrics *>(font_.GetID());
+ FormatAndMetrics *pfm = static_cast<FormatAndMetrics *>(font_.GetID());
PLATFORM_ASSERT(pfm->technology == SCWIN_TECH_GDI);
if (fontOld) {
::SelectObject(hdc, pfm->hfont);
} else {
fontOld = static_cast<HFONT>(::SelectObject(hdc, pfm->hfont));
}
- font = reinterpret_cast<HFONT>(pfm->hfont);
+ font = pfm->hfont;
}
}
@@ -775,14 +775,14 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil ColourDesired outline, int alphaOutline, int /* flags*/ ) {
const RECT rcw = RectFromPRectangle(rc);
if (AlphaBlendFn && rc.Width() > 0) {
- HDC hMemDC = ::CreateCompatibleDC(reinterpret_cast<HDC>(hdc));
+ HDC hMemDC = ::CreateCompatibleDC(hdc);
int width = static_cast<int>(rc.Width());
int height = static_cast<int>(rc.Height());
// Ensure not distorted too much by corners when small
cornerSize = Platform::Minimum(cornerSize, (Platform::Minimum(width, height) / 2) - 2);
BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}};
void *image = 0;
- HBITMAP hbmMem = CreateDIBSection(reinterpret_cast<HDC>(hMemDC), &bpih,
+ HBITMAP hbmMem = CreateDIBSection(hMemDC, &bpih,
DIB_RGB_COLORS, &image, NULL, 0);
if (hbmMem) {
@@ -799,7 +799,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil static_cast<byte>(GetGValue(outline.AsLong()) * alphaOutline / 255),
static_cast<byte>(GetRValue(outline.AsLong()) * alphaOutline / 255),
static_cast<byte>(alphaOutline));
- DWORD *pixels = reinterpret_cast<DWORD *>(image);
+ DWORD *pixels = static_cast<DWORD *>(image);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
if ((x==0) || (x==width-1) || (y == 0) || (y == height-1)) {
@@ -820,7 +820,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil BLENDFUNCTION merge = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
- AlphaBlendFn(reinterpret_cast<HDC>(hdc), rcw.left, rcw.top, width, height, hMemDC, 0, 0, width, height, merge);
+ AlphaBlendFn(hdc, rcw.left, rcw.top, width, height, hMemDC, 0, 0, width, height, merge);
SelectBitmap(hMemDC, hbmOld);
::DeleteObject(hbmMem);
@@ -834,7 +834,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
if (AlphaBlendFn && rc.Width() > 0) {
- HDC hMemDC = ::CreateCompatibleDC(reinterpret_cast<HDC>(hdc));
+ HDC hMemDC = ::CreateCompatibleDC(hdc);
if (rc.Width() > width)
rc.left += static_cast<int>((rc.Width() - width) / 2);
rc.right = rc.left + width;
@@ -844,7 +844,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}};
unsigned char *image = 0;
- HBITMAP hbmMem = CreateDIBSection(reinterpret_cast<HDC>(hMemDC), &bpih,
+ HBITMAP hbmMem = CreateDIBSection(hMemDC, &bpih,
DIB_RGB_COLORS, reinterpret_cast<void **>(&image), NULL, 0);
if (hbmMem) {
HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem);
@@ -863,7 +863,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig BLENDFUNCTION merge = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
- AlphaBlendFn(reinterpret_cast<HDC>(hdc), static_cast<int>(rc.left), static_cast<int>(rc.top),
+ AlphaBlendFn(hdc, static_cast<int>(rc.left), static_cast<int>(rc.top),
static_cast<int>(rc.Width()), static_cast<int>(rc.Height()), hMemDC, 0, 0, width, height, merge);
SelectBitmap(hMemDC, hbmOld);
@@ -1204,7 +1204,7 @@ void SurfaceD2D::Init(WindowID /* wid */) { void SurfaceD2D::Init(SurfaceID sid, WindowID) {
Release();
SetScale();
- pRenderTarget = reinterpret_cast<ID2D1RenderTarget *>(sid);
+ pRenderTarget = static_cast<ID2D1RenderTarget *>(sid);
}
void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID) {
@@ -1255,7 +1255,7 @@ void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) { }
void SurfaceD2D::SetFont(Font &font_) {
- FormatAndMetrics *pfm = reinterpret_cast<FormatAndMetrics *>(font_.GetID());
+ FormatAndMetrics *pfm = static_cast<FormatAndMetrics *>(font_.GetID());
PLATFORM_ASSERT(pfm->technology == SCWIN_TECH_DIRECTWRITE);
pTextFormat = pfm->pTextFormat;
yAscent = pfm->yAscent;
@@ -1785,7 +1785,7 @@ Window::~Window() { void Window::Destroy() {
if (wid)
- ::DestroyWindow(reinterpret_cast<HWND>(wid));
+ ::DestroyWindow(static_cast<HWND>(wid));
wid = 0;
}
@@ -1795,12 +1795,12 @@ bool Window::HasFocus() { PRectangle Window::GetPosition() {
RECT rc;
- ::GetWindowRect(reinterpret_cast<HWND>(wid), &rc);
+ ::GetWindowRect(static_cast<HWND>(wid), &rc);
return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom);
}
void Window::SetPosition(PRectangle rc) {
- ::SetWindowPos(reinterpret_cast<HWND>(wid),
+ ::SetWindowPos(static_cast<HWND>(wid),
0, static_cast<int>(rc.left), static_cast<int>(rc.top),
static_cast<int>(rc.Width()), static_cast<int>(rc.Height()), SWP_NOZORDER | SWP_NOACTIVATE);
}
@@ -1824,10 +1824,10 @@ static RECT RectFromMonitor(HMONITOR hMonitor) { }
void Window::SetPositionRelative(PRectangle rc, Window w) {
- LONG style = ::GetWindowLong(reinterpret_cast<HWND>(wid), GWL_STYLE);
+ LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE);
if (style & WS_POPUP) {
POINT ptOther = {0, 0};
- ::ClientToScreen(reinterpret_cast<HWND>(w.GetID()), &ptOther);
+ ::ClientToScreen(static_cast<HWND>(w.GetID()), &ptOther);
rc.Move(static_cast<XYPOSITION>(ptOther.x), static_cast<XYPOSITION>(ptOther.y));
RECT rcMonitor = RectFromPRectangle(rc);
@@ -1860,28 +1860,28 @@ void Window::SetPositionRelative(PRectangle rc, Window w) { PRectangle Window::GetClientPosition() {
RECT rc={0,0,0,0};
if (wid)
- ::GetClientRect(reinterpret_cast<HWND>(wid), &rc);
+ ::GetClientRect(static_cast<HWND>(wid), &rc);
return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom);
}
void Window::Show(bool show) {
if (show)
- ::ShowWindow(reinterpret_cast<HWND>(wid), SW_SHOWNOACTIVATE);
+ ::ShowWindow(static_cast<HWND>(wid), SW_SHOWNOACTIVATE);
else
- ::ShowWindow(reinterpret_cast<HWND>(wid), SW_HIDE);
+ ::ShowWindow(static_cast<HWND>(wid), SW_HIDE);
}
void Window::InvalidateAll() {
- ::InvalidateRect(reinterpret_cast<HWND>(wid), NULL, FALSE);
+ ::InvalidateRect(static_cast<HWND>(wid), NULL, FALSE);
}
void Window::InvalidateRectangle(PRectangle rc) {
RECT rcw = RectFromPRectangle(rc);
- ::InvalidateRect(reinterpret_cast<HWND>(wid), &rcw, FALSE);
+ ::InvalidateRect(static_cast<HWND>(wid), &rcw, FALSE);
}
static LRESULT Window_SendMessage(Window *w, UINT msg, WPARAM wParam=0, LPARAM lParam=0) {
- return ::SendMessage(reinterpret_cast<HWND>(w->GetID()), msg, wParam, lParam);
+ return ::SendMessage(static_cast<HWND>(w->GetID()), msg, wParam, lParam);
}
void Window::SetFont(Font &font) {
@@ -1961,7 +1961,7 @@ void Window::SetCursor(Cursor curs) { }
void Window::SetTitle(const char *s) {
- ::SetWindowTextA(reinterpret_cast<HWND>(wid), s);
+ ::SetWindowTextA(static_cast<HWND>(wid), s);
}
/* Returns rectangle of monitor pt is on, both rect and pt are in Window's
@@ -2140,7 +2140,7 @@ void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHei lineHeight = lineHeight_;
unicodeMode = unicodeMode_;
technology = technology_;
- HWND hwndParent = reinterpret_cast<HWND>(parent->GetID());
+ HWND hwndParent = static_cast<HWND>(parent->GetID());
HINSTANCE hinstanceParent = GetWindowInstance(hwndParent);
// Window created as popup so not clipped within parent client area
wid = ::CreateWindowEx(
@@ -2162,7 +2162,7 @@ void ListBoxX::SetFont(Font &font) { ::DeleteObject(fontCopy);
fontCopy = 0;
}
- FormatAndMetrics *pfm = reinterpret_cast<FormatAndMetrics *>(font.GetID());
+ FormatAndMetrics *pfm = static_cast<FormatAndMetrics *>(font.GetID());
fontCopy = pfm->HFont();
::SendMessage(lb, WM_SETFONT, reinterpret_cast<WPARAM>(fontCopy), 0);
}
@@ -2181,7 +2181,7 @@ int ListBoxX::GetVisibleRows() const { }
HWND ListBoxX::GetHWND() const {
- return reinterpret_cast<HWND>(GetID());
+ return static_cast<HWND>(GetID());
}
PRectangle ListBoxX::GetDesiredRect() {
@@ -2686,7 +2686,7 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_PAINT: {
PAINTSTRUCT ps;
HDC hDC = ::BeginPaint(hWnd, &ps);
- ListBoxX *lbx = reinterpret_cast<ListBoxX *>(PointerFromWindow(::GetParent(hWnd)));
+ ListBoxX *lbx = static_cast<ListBoxX *>(PointerFromWindow(::GetParent(hWnd)));
if (lbx)
lbx->Paint(hDC);
::EndPaint(hWnd, &ps);
@@ -2712,7 +2712,7 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA return 0;
case WM_LBUTTONDBLCLK: {
- ListBoxX *lbx = reinterpret_cast<ListBoxX *>(PointerFromWindow(::GetParent(hWnd)));
+ ListBoxX *lbx = static_cast<ListBoxX *>(PointerFromWindow(::GetParent(hWnd)));
if (lbx) {
lbx->OnDoubleClick();
}
@@ -2738,7 +2738,7 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
switch (iMessage) {
case WM_CREATE: {
- HINSTANCE hinstanceParent = GetWindowInstance(reinterpret_cast<HWND>(parent->GetID()));
+ HINSTANCE hinstanceParent = GetWindowInstance(static_cast<HWND>(parent->GetID()));
// Note that LBS_NOINTEGRALHEIGHT is specified to fix cosmetic issue when resizing the list
// but has useful side effect of speeding up list population significantly
lb = ::CreateWindowEx(
@@ -2774,7 +2774,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam case WM_COMMAND:
// This is not actually needed now - the registered double click action is used
// directly to action a choice from the list.
- ::SendMessage(reinterpret_cast<HWND>(parent->GetID()), iMessage, wParam, lParam);
+ ::SendMessage(static_cast<HWND>(parent->GetID()), iMessage, wParam, lParam);
break;
case WM_MEASUREITEM: {
@@ -2872,7 +2872,7 @@ LRESULT PASCAL ListBoxX::StaticWndProc( SetWindowPointer(hWnd, pCreate->lpCreateParams);
}
// Find C++ object associated with window.
- ListBoxX *lbx = reinterpret_cast<ListBoxX *>(PointerFromWindow(hWnd));
+ ListBoxX *lbx = static_cast<ListBoxX *>(PointerFromWindow(hWnd));
if (lbx) {
return lbx->WndProc(hWnd, iMessage, wParam, lParam);
} else {
@@ -2915,14 +2915,14 @@ void Menu::CreatePopUp() { void Menu::Destroy() {
if (mid)
- ::DestroyMenu(reinterpret_cast<HMENU>(mid));
+ ::DestroyMenu(static_cast<HMENU>(mid));
mid = 0;
}
void Menu::Show(Point pt, Window &w) {
- ::TrackPopupMenu(reinterpret_cast<HMENU>(mid),
+ ::TrackPopupMenu(static_cast<HMENU>(mid),
TPM_RIGHTBUTTON, static_cast<int>(pt.x - 4), static_cast<int>(pt.y), 0,
- reinterpret_cast<HWND>(w.GetID()), NULL);
+ static_cast<HWND>(w.GetID()), NULL);
Destroy();
}
@@ -3045,12 +3045,12 @@ bool Platform::IsKeyDown(int key) { long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) {
// This should never be called - its here to satisfy an old interface
- return static_cast<long>(::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam));
+ return static_cast<long>(::SendMessage(static_cast<HWND>(w), msg, wParam, lParam));
}
long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) {
// This should never be called - its here to satisfy an old interface
- return static_cast<long>(::SendMessage(reinterpret_cast<HWND>(w), msg, wParam,
+ return static_cast<long>(::SendMessage(static_cast<HWND>(w), msg, wParam,
reinterpret_cast<LPARAM>(lParam)));
}
@@ -3170,7 +3170,7 @@ int Platform::Clamp(int val, int minVal, int maxVal) { void Platform_Initialise(void *hInstance) {
::InitializeCriticalSection(&crPlatformLock);
- hinstPlatformRes = reinterpret_cast<HINSTANCE>(hInstance);
+ hinstPlatformRes = static_cast<HINSTANCE>(hInstance);
// This may be called from DllMain, in which case the call to LoadLibrary
// is bad because it can upset the DLL load order.
if (!hDLLImage) {
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index dfa71f2..bccd6ce 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -569,7 +569,7 @@ void ScintillaWin::DropRenderTarget() { #endif
HWND ScintillaWin::MainHWND() {
- return reinterpret_cast<HWND>(wMain.GetID());
+ return static_cast<HWND>(wMain.GetID());
}
bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) {
@@ -1211,7 +1211,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam switch (iMessage) {
case WM_CREATE:
- ctrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(wMain.GetID()));
+ ctrlID = ::GetDlgCtrlID(static_cast<HWND>(wMain.GetID()));
// Get Intellimouse scroll line parameters
GetIntelliMouseParameters();
::RegisterDragDrop(MainHWND(), reinterpret_cast<IDropTarget *>(&dt));
@@ -1257,7 +1257,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_MOUSEWHEEL:
// if autocomplete list active then send mousewheel message to it
if (ac.Active()) {
- HWND hWnd = reinterpret_cast<HWND>(ac.lb->GetID());
+ HWND hWnd = static_cast<HWND>(ac.lb->GetID());
::SendMessage(hWnd, iMessage, wParam, lParam);
break;
}
@@ -1496,7 +1496,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_KILLFOCUS: {
HWND wOther = reinterpret_cast<HWND>(wParam);
HWND wThis = MainHWND();
- HWND wCT = reinterpret_cast<HWND>(ct.wCallTip.GetID());
+ HWND wCT = static_cast<HWND>(ct.wCallTip.GetID());
if (!wParam ||
!(::IsChild(wThis, wOther) || (wOther == wCT))) {
SetFocusState(false);
@@ -1937,11 +1937,11 @@ void ScintillaWin::NotifyFocus(bool focus) { }
void ScintillaWin::SetCtrlID(int identifier) {
- ::SetWindowID(reinterpret_cast<HWND>(wMain.GetID()), identifier);
+ ::SetWindowID(static_cast<HWND>(wMain.GetID()), identifier);
}
int ScintillaWin::GetCtrlID() {
- return ::GetDlgCtrlID(reinterpret_cast<HWND>(wMain.GetID()));
+ return ::GetDlgCtrlID(static_cast<HWND>(wMain.GetID()));
}
void ScintillaWin::NotifyParent(SCNotification scn) {
@@ -2270,7 +2270,7 @@ void ScintillaWin::CreateCallTipWindow(PRectangle) { }
void ScintillaWin::AddToPopUp(const char *label, int cmd, bool enabled) {
- HMENU hmenuPopup = reinterpret_cast<HMENU>(popup.GetID());
+ HMENU hmenuPopup = static_cast<HMENU>(popup.GetID());
if (!label[0])
::AppendMenuA(hmenuPopup, MF_SEPARATOR, 0, "");
else if (enabled)
@@ -3238,7 +3238,7 @@ BOOL ScintillaWin::DestroySystemCaret() { LRESULT PASCAL ScintillaWin::CTWndProc(
HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
// Find C++ object associated with window.
- ScintillaWin *sciThis = reinterpret_cast<ScintillaWin *>(PointerFromWindow(hWnd));
+ ScintillaWin *sciThis = static_cast<ScintillaWin *>(PointerFromWindow(hWnd));
try {
// ctp will be zero if WM_CREATE not seen yet
if (sciThis == 0) {
@@ -3358,7 +3358,7 @@ LRESULT PASCAL ScintillaWin::SWndProc( //Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam);
// Find C++ object associated with window.
- ScintillaWin *sci = reinterpret_cast<ScintillaWin *>(PointerFromWindow(hWnd));
+ ScintillaWin *sci = static_cast<ScintillaWin *>(PointerFromWindow(hWnd));
// sci will be zero if WM_CREATE not seen yet
if (sci == 0) {
try {
@@ -3390,7 +3390,7 @@ LRESULT PASCAL ScintillaWin::SWndProc( // Must be called once only.
int Scintilla_RegisterClasses(void *hInstance) {
Platform_Initialise(hInstance);
- bool result = ScintillaWin::Register(reinterpret_cast<HINSTANCE>(hInstance));
+ bool result = ScintillaWin::Register(static_cast<HINSTANCE>(hInstance));
#ifdef SCI_LEXER
Scintilla_LinkLexers();
#endif
|