mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ upd: Current Scintilla development (disable command events for speedup)
This commit is contained in:
parent
f7a9a35522
commit
a3db5648e4
@ -7264,6 +7264,8 @@ struct SCNotification {
|
||||
<p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
|
||||
<code><a class="message" href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</a><br />
|
||||
<a class="message" href="#SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK → int</a><br />
|
||||
<a class="message" href="#SCI_SETCOMMANDEVENTS">SCI_SETCOMMANDEVENTS(bool commandEvents)</a><br />
|
||||
<a class="message" href="#SCI_GETCOMMANDEVENTS">SCI_GETCOMMANDEVENTS → bool</a><br />
|
||||
<a class="message" href="#SCI_SETMOUSEDWELLTIME">SCI_SETMOUSEDWELLTIME(int periodMilliseconds)</a><br />
|
||||
<a class="message" href="#SCI_GETMOUSEDWELLTIME">SCI_GETMOUSEDWELLTIME → int</a><br />
|
||||
<a class="message" href="#SCI_SETIDENTIFIER">SCI_SETIDENTIFIER(int identifier)</a><br />
|
||||
@ -7750,7 +7752,9 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
||||
<code>EN_CHANGE</code>). No other information is sent. If you need more detailed information
|
||||
use <a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>. You can filter the
|
||||
types of changes you are notified about with <a class="message"
|
||||
href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</p>
|
||||
href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a> and
|
||||
<a class="message"
|
||||
href="#SCI_SETCOMMANDEVENTS"><code>SCI_SETCOMMANDEVENTS</code></a>.</p>
|
||||
|
||||
<p><b id="SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK(int eventMask)</b><br />
|
||||
<b id="SCI_GETMODEVENTMASK">SCI_GETMODEVENTMASK → int</b><br />
|
||||
@ -7770,6 +7774,14 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
||||
<code>SC_MOD_BEFOREINSERT</code>, <code>SC_MOD_BEFOREDELETE</code>,
|
||||
<code>SC_MULTILINEUNDOREDO</code>, and <code>SC_MODEVENTMASKALL</code>.</p>
|
||||
|
||||
<p><b id="SCI_SETCOMMANDEVENTS">SCI_SETCOMMANDEVENTS(bool commandEvents)</b><br />
|
||||
<b id="SCI_GETCOMMANDEVENTS">SCI_GETCOMMANDEVENTS → bool</b><br />
|
||||
These messages set and get whether <code>SCEN_*</code> command events are
|
||||
sent to the container. For <code>SCEN_CHANGE</code> this acts as an additional filter over
|
||||
<a class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.
|
||||
Most applications should set this off to avoid overhead and only use
|
||||
<a class="message" href="#SCN_MODIFIED"><code>SCN_MODIFIED</code></a>.</p>
|
||||
|
||||
<p><b id="SCEN_SETFOCUS">SCEN_SETFOCUS</b><br />
|
||||
<b id="SCEN_KILLFOCUS">SCEN_KILLFOCUS</b><br />
|
||||
<code>SCEN_SETFOCUS</code> (512) is fired when Scintilla receives focus and
|
||||
|
||||
@ -551,6 +551,10 @@
|
||||
<a href="https://www.scintilla.org/scite413.zip">Release 4.1.3</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they
|
||||
can be a significant performance cost.
|
||||
</li>
|
||||
<li>
|
||||
Fixed a crash on Cocoa in bidirectional mode where some patterns of invalid UTF-8
|
||||
caused failures to create Unicode strings.
|
||||
|
||||
@ -103,8 +103,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SC_IME_INLINE 1
|
||||
#define SCI_GETIMEINTERACTION 2678
|
||||
#define SCI_SETIMEINTERACTION 2679
|
||||
#define SCI_ISIMEOPEN 2717
|
||||
#define SCI_ISIMEMODECJK 2718
|
||||
#define SCI_ISIMEOPEN 2719
|
||||
#define SCI_ISIMEMODECJK 2720
|
||||
#define MARKER_MAX 31
|
||||
#define SC_MARK_CIRCLE 0
|
||||
#define SC_MARK_ROUNDRECT 1
|
||||
@ -703,6 +703,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_RELEASEDOCUMENT 2377
|
||||
#define SCI_GETDOCUMENTOPTIONS 2379
|
||||
#define SCI_GETMODEVENTMASK 2378
|
||||
#define SCI_SETCOMMANDEVENTS 2717
|
||||
#define SCI_GETCOMMANDEVENTS 2718
|
||||
#define SCI_SETFOCUS 2380
|
||||
#define SCI_GETFOCUS 2381
|
||||
#define SC_STATUS_OK 0
|
||||
|
||||
@ -267,8 +267,8 @@ get int GetIMEInteraction=2678(,)
|
||||
set void SetIMEInteraction=2679(int imeInteraction,)
|
||||
|
||||
# >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
get bool IsIMEOpen=2717(,)
|
||||
get bool IsIMEModeCJK=2718(,)
|
||||
get bool IsIMEOpen=2719(,)
|
||||
get bool IsIMEModeCJK=2720(,)
|
||||
# <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
enu MarkerSymbol=SC_MARK_
|
||||
@ -1813,6 +1813,12 @@ get int GetDocumentOptions=2379(,)
|
||||
# Get which document modification events are sent to the container.
|
||||
get int GetModEventMask=2378(,)
|
||||
|
||||
# Set whether command events are sent to the container.
|
||||
set void SetCommandEvents=2717(bool commandEvents,)
|
||||
|
||||
# Get whether command events are sent to the container.
|
||||
get bool GetCommandEvents=2718(,)
|
||||
|
||||
# Change internal focus flag.
|
||||
set void SetFocus=2380(bool focus,)
|
||||
# Get internal focus flag.
|
||||
|
||||
@ -181,6 +181,7 @@ Editor::Editor() {
|
||||
needIdleStyling = false;
|
||||
|
||||
modEventMask = SC_MODEVENTMASKALL;
|
||||
commandEvents = true;
|
||||
|
||||
pdoc->AddWatcher(this, 0);
|
||||
|
||||
@ -2677,9 +2678,11 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
|
||||
|
||||
// If client wants to see this modification
|
||||
if (mh.modificationType & modEventMask) {
|
||||
if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) {
|
||||
// Real modification made to text of document.
|
||||
NotifyChange(); // Send EN_CHANGE
|
||||
if (commandEvents) {
|
||||
if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) {
|
||||
// Real modification made to text of document.
|
||||
NotifyChange(); // Send EN_CHANGE
|
||||
}
|
||||
}
|
||||
|
||||
SCNotification scn = {};
|
||||
@ -7665,6 +7668,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_GETMODEVENTMASK:
|
||||
return modEventMask;
|
||||
|
||||
case SCI_SETCOMMANDEVENTS:
|
||||
commandEvents = static_cast<bool>(wParam);
|
||||
return 0;
|
||||
|
||||
case SCI_GETCOMMANDEVENTS:
|
||||
return commandEvents;
|
||||
|
||||
case SCI_CONVERTEOLS:
|
||||
pdoc->ConvertLineEnds(static_cast<int>(wParam));
|
||||
SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document
|
||||
|
||||
@ -229,6 +229,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool needIdleStyling;
|
||||
|
||||
int modEventMask;
|
||||
bool commandEvents;
|
||||
|
||||
SelectionText drag;
|
||||
|
||||
|
||||
@ -2120,9 +2120,11 @@ void ScintillaWin::NotifyChange() noexcept {
|
||||
}
|
||||
|
||||
void ScintillaWin::NotifyFocus(bool focus) {
|
||||
::SendMessage(::GetParent(MainHWND()), WM_COMMAND,
|
||||
MAKELONG(GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS),
|
||||
reinterpret_cast<LPARAM>(MainHWND()));
|
||||
if (commandEvents) {
|
||||
::SendMessage(::GetParent(MainHWND()), WM_COMMAND,
|
||||
MAKELONG(GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS),
|
||||
reinterpret_cast<LPARAM>(MainHWND()));
|
||||
}
|
||||
Editor::NotifyFocus(focus);
|
||||
}
|
||||
|
||||
|
||||
@ -4,32 +4,17 @@
|
||||
* Notepad3 *
|
||||
* *
|
||||
* Encoding.h *
|
||||
* General helper functions *
|
||||
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
|
||||
* Parts taken from SciTE, (c) Neil Hodgson *
|
||||
* MinimizeToTray, (c) 2000 Matthew Ellis *
|
||||
* *
|
||||
* Copyright (C) 2006-2016 Wu Yongwei <wuyongwei@gmail.com> *
|
||||
* *
|
||||
* This software is provided 'as-is', without any express or implied *
|
||||
* warranty. In no event will the authors be held liable for any *
|
||||
* damages arising from the use of this software. *
|
||||
* *
|
||||
* Permission is granted to anyone to use this software for any purpose, *
|
||||
* including commercial applications, and to alter it and redistribute *
|
||||
* it freely, subject to the following restrictions: *
|
||||
* *
|
||||
* 1. The origin of this software must not be misrepresented; you must *
|
||||
* not claim that you wrote the original software. If you use this *
|
||||
* software in a product, an acknowledgement in the product *
|
||||
* documentation would be appreciated but is not required. *
|
||||
* 2. Altered source versions must be plainly marked as such, and must *
|
||||
* not be misrepresented as being the original software. *
|
||||
* 3. This notice may not be removed or altered from any source *
|
||||
* distribution. *
|
||||
* *
|
||||
* *
|
||||
* The latest version of this software should be available at: *
|
||||
* <URL:https://github.com/adah1972/tellenc> *
|
||||
* (c) Rizonesoft 2008-2018 *
|
||||
* https://rizonesoft.com *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#ifndef _NP3_ENCODING_H_
|
||||
#define _NP3_ENCODING_H_
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
* Helpers.c *
|
||||
* General helper functions *
|
||||
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
|
||||
* Parts taken from SciTE, (c) Neil Hodgson *
|
||||
* MinimizeToTray, (c) 2000 Matthew Ellis *
|
||||
* Parts taken from SciTE, (c) Neil Hodgson *
|
||||
* MinimizeToTray, (c) 2000 Matthew Ellis *
|
||||
* *
|
||||
* (c) Rizonesoft 2008-2016 *
|
||||
* (c) Rizonesoft 2008-2018 *
|
||||
* https://rizonesoft.com *
|
||||
* *
|
||||
* *
|
||||
|
||||
@ -1543,7 +1543,9 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
|
||||
// SC_PERFORMED_UNDO, SC_PERFORMED_REDO, SC_MULTISTEPUNDOREDO, SC_LASTSTEPINUNDOREDO, SC_MOD_CHANGEMARKER,
|
||||
// SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.
|
||||
//
|
||||
///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE;
|
||||
///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE;
|
||||
/// SC_MOD_CHANGESTYLE and SC_MOD_CHANGEINDICATOR needs SCI_SETCOMMANDEVENTS=true
|
||||
|
||||
int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO;
|
||||
int const evtMask2 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE;
|
||||
|
||||
@ -1564,7 +1566,8 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
|
||||
SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0);
|
||||
SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, SCVS_NONE, 0);
|
||||
SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0);
|
||||
|
||||
SendMessage(hwndEditCtrl, SCI_SETCOMMANDEVENTS, false, 0); // SCI 4.1.3 : speedup folding
|
||||
|
||||
// assign command keys
|
||||
SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_NEXT + (SCMOD_CTRL << 16)), SCI_PARADOWN);
|
||||
SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_PRIOR + (SCMOD_CTRL << 16)), SCI_PARAUP);
|
||||
|
||||
@ -32,7 +32,7 @@ typedef __int64 (*LexFunctionPtr_t)(LexFunctionType type, int value);
|
||||
|
||||
typedef struct _editstyle
|
||||
{
|
||||
#pragma warning(disable : 4201) // MS's Non-Std: Struktur/Union ohne Namen
|
||||
#pragma warning(disable : 4201) // MS's Non-Std: Structure/Union w/o name
|
||||
union
|
||||
{
|
||||
INT32 iStyle;
|
||||
@ -53,7 +53,7 @@ typedef struct _keywordlist
|
||||
} KEYWORDLIST, *PKEYWORDLIST;
|
||||
|
||||
|
||||
#pragma warning(disable : 4200) // MS's Non-Std: Null-Array in Struktur/Union
|
||||
#pragma warning(disable : 4200) // MS's Non-Std: Null-Array in Structure/Union
|
||||
typedef struct _editlexer
|
||||
{
|
||||
int lexerID;
|
||||
|
||||
BIN
src/Version.h
BIN
src/Version.h
Binary file not shown.
Loading…
Reference in New Issue
Block a user