Merge pull request #448 from RaiKoHoff/Hide_NonOcc

Enhancement:  Collapse View to marked occurrences only
This commit is contained in:
Derick Payne 2018-04-18 16:10:09 +02:00 committed by GitHub
commit a307503ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 27702 additions and 26980 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,29 @@
#ifndef __CRYPTO_H__
#define __CRYPTO_H__
#include <stdbool.h>
#include <stdbool.h>
#define BUG1(a,b) { perror("a"); }
#define BUG(a) { perror("a"); }
#define PREAMBLE_SIZE 8 // 4 byte signature + 4 byte subfile type
#define KEY_BYTES 32 // 32 byts = 256 bits of key
#define KEY_BYTES 32 // 32 bytes = 256 bits of key
#define PREAMBLE 0x01020304 // first 4 bytes of the file
#define FILEKEY_FORMAT 1 // next 4 bytes determine version/format
#define MASTERKEY_FORMAT 2 // format with master key
#define MASTER_KEY_OFFSET (PREAMBLE_SIZE+AES_MAX_IV_SIZE)
#define UNUSED(expr) (void)(expr)
#define DECRYPT_SUCCESS 0x00
#define DECRYPT_FREAD_FAILED 0x01
#define DECRYPT_WRONG_PASS 0x02
#define DECRYPT_NO_ENCRYPTION 0x04
#define DECRYPT_CANCELED_NO_PASS 0x08
#define DECRYPT_FATAL_ERROR 0x10
int ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWORD *resultlen);
bool EncryptAndWriteFile(HWND hwnd, HANDLE hFile, BYTE *data, DWORD size, DWORD *written);
bool ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWORD *resultlen);
bool GetFileKey(HWND hwnd);
void ResetEncryption();
#endif

View File

@ -70,18 +70,50 @@ extern int flagNoFileVariables;
extern int flagUseSystemMRU;
//=============================================================================
//
// MsgBox()
//
static HHOOK hhkMsgBox = NULL;
static LRESULT CALLBACK _MsgBoxProc(INT nCode, WPARAM wParam, LPARAM lParam)
{
HWND hParentWnd, hChildWnd; // msgbox is "child"
RECT rParent, rChild, rDesktop;
// notification that a window is about to be activated
if (nCode == HCBT_ACTIVATE) {
// set window handles
hParentWnd = GetForegroundWindow();
hChildWnd = (HWND)wParam; // window handle is wParam
if ((hParentWnd != NULL) && (hChildWnd != NULL) &&
(GetWindowRect(GetDesktopWindow(), &rDesktop) != 0) &&
(GetWindowRect(hParentWnd, &rParent) != 0) &&
(GetWindowRect(hChildWnd, &rChild) != 0)) {
CenterDlgInParent(hChildWnd);
}
// exit _MsgBoxProc hook
UnhookWindowsHookEx(hhkMsgBox);
}
else // otherwise, continue with any possible chained hooks
{
CallNextHookEx(hhkMsgBox, nCode, wParam, lParam);
}
return 0;
}
// -----------------------------------------------------------------------------
int MsgBox(int iType,UINT uIdMsg,...)
{
WCHAR szText [HUGE_BUFFER] = { L'\0' };
WCHAR szBuf [HUGE_BUFFER] = { L'\0' };
WCHAR szTitle[64] = { L'\0' };
int iIcon = 0;
HWND hwnd;
if (!GetString(uIdMsg,szBuf,COUNTOF(szBuf)))
return(0);
@ -112,22 +144,24 @@ int MsgBox(int iType,UINT uIdMsg,...)
GetString(IDS_APPTITLE,szTitle,COUNTOF(szTitle));
int iIcon = MB_ICONHAND;
switch (iType) {
case MBINFO: iIcon = MB_ICONINFORMATION; break;
case MBWARN: iIcon = MB_ICONEXCLAMATION; break;
case MBYESNO: iIcon = MB_ICONEXCLAMATION | MB_YESNO; break;
case MBYESNOCANCEL: iIcon = MB_ICONEXCLAMATION | MB_YESNOCANCEL; break;
case MBYESNOWARN: iIcon = MB_ICONEXCLAMATION | MB_YESNO; break;
case MBWARN: iIcon = MB_ICONWARNING; break;
case MBYESNO: iIcon = MB_ICONQUESTION | MB_YESNO; break;
case MBYESNOCANCEL: iIcon = MB_ICONINFORMATION | MB_YESNOCANCEL; break;
case MBYESNOWARN: iIcon = MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1; break;
case MBOKCANCEL: iIcon = MB_ICONEXCLAMATION | MB_OKCANCEL; break;
case MBRETRYCANCEL: iIcon = MB_ICONQUESTION | MB_RETRYCANCEL; break;
default: iIcon = MB_ICONSTOP | MB_TOPMOST | MB_OK; break;
}
HWND focus = GetFocus();
hwnd = focus ? focus : g_hwndMain;
HWND hwnd = focus ? focus : g_hwndMain;
return MessageBoxEx(hwnd,
szText,szTitle,
MB_SETFOREGROUND | iIcon,
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT));
hhkMsgBox = SetWindowsHookEx(WH_CBT, &_MsgBoxProc, 0, GetCurrentThreadId());
return MessageBoxEx(hwnd, szText, szTitle, MB_SETFOREGROUND | iIcon, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT));
}
@ -1513,7 +1547,7 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
}
// Ask...
int answ = (LOWORD(wParam) == IDOK) ? MsgBox(MBYESNO, IDS_ERR_MRUDLG)
int answ = (LOWORD(wParam) == IDOK) ? MsgBox(MBYESNOWARN, IDS_ERR_MRUDLG)
: ((iCur == lvi.iItem) ? IDNO : IDYES);
if (IDYES == answ) {
@ -2759,24 +2793,25 @@ INT_PTR InfoBox(int iType,LPCWSTR lpstrSetting,int uidMessage,...)
ib.lpstrSetting = (LPWSTR)lpstrSetting;
ib.bDisableCheckBox = (StringCchLenW(g_wchIniFile,COUNTOF(g_wchIniFile)) == 0 || lstrlen(lpstrSetting) == 0 || iMode == 2) ? true : false;
int idDlg = IDD_INFOBOX;
if (iType == MBYESNO)
int idDlg;
switch (iType) {
case MBYESNO:
idDlg = IDD_INFOBOX2;
else if (iType == MBOKCANCEL)
break;
case MBOKCANCEL:
idDlg = IDD_INFOBOX3;
break;
default:
idDlg = IDD_INFOBOX;
break;
}
HWND focus = GetFocus();
HWND hwnd = focus ? focus : g_hwndMain;
MessageBeep(MB_ICONEXCLAMATION);
return ThemedDialogBoxParam(
g_hInstance,
MAKEINTRESOURCE(idDlg),
hwnd,
InfoBoxDlgProc,
(LPARAM)&ib);
return ThemedDialogBoxParam(g_hInstance, MAKEINTRESOURCE(idDlg), hwnd, InfoBoxDlgProc, (LPARAM)&ib);
}
// End of Dialogs.c

View File

@ -18,13 +18,6 @@
#include "TypeDefs.h"
#define MBINFO 0
#define MBWARN 1
#define MBYESNO 2
#define MBYESNOWARN 3
#define MBYESNOCANCEL 4
#define MBOKCANCEL 8
int MsgBox(int,UINT,...);
void DisplayCmdLineHelp(HWND);
bool GetDirectory(HWND,int,LPWSTR,LPCWSTR,bool);

16163
src/Edit.c

File diff suppressed because it is too large Load Diff

View File

@ -1,206 +1,178 @@
/******************************************************************************
* *
* *
* Notepad3 *
* *
* Edit.h *
* Text File Editing Helper Stuff *
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
* *
* (c) Rizonesoft 2008-2016 *
* https://rizonesoft.com *
* *
* *
*******************************************************************************/
#pragma once
#ifndef _NP3_EDIT_H_
#define _NP3_EDIT_H_
#include "TypeDefs.h"
// extern "C" declarations of Scintilla functions
int Scintilla_RegisterClasses(void*);
int Scintilla_ReleaseResources();
typedef struct _editfindreplace
{
char szFind[FNDRPL_BUFFER];
char szReplace[FNDRPL_BUFFER];
UINT fuFlags;
bool bTransformBS;
bool bObsolete /* was bFindUp */;
bool bFindClose;
bool bReplaceClose;
bool bNoFindWrap;
bool bWildcardSearch;
bool bMarkOccurences;
bool bDotMatchAll;
HWND hwnd;
} EDITFINDREPLACE, *LPEDITFINDREPLACE, *LPCEDITFINDREPLACE;
#define EFR_INIT_DATA { "", "", /* "", "", */ 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }
#define IDMSG_SWITCHTOFIND 300
#define IDMSG_SWITCHTOREPLACE 301
#define MARKER_NP3_BOOKMARK 1
#define INDIC_NP3_MARK_OCCURANCE 1
#define INDIC_NP3_MATCH_BRACE 2
#define INDIC_NP3_BAD_BRACE 3
void EditInitWordDelimiter(HWND);
void EditSetNewText(HWND,char*,DWORD);
bool EditConvertText(HWND,int,int,bool);
bool EditSetNewEncoding(HWND,int,bool,bool);
bool EditIsRecodingNeeded(WCHAR*,int);
char* EditGetClipboardText(HWND,bool,int*,int*);
bool EditSetClipboardText(HWND, const char*);
bool EditClearClipboard(HWND);
void EditPaste2RectSel(HWND,char*);
bool EditPasteClipboard(HWND,bool,bool);
bool EditCopyAppend(HWND,bool);
int EditDetectEOLMode(HWND,char*,DWORD);
bool EditLoadFile(HWND,LPCWSTR,bool,bool,int*,int*,bool*,bool*,bool*);
bool EditSaveFile(HWND,LPCWSTR,int,bool*,bool);
void EditInvertCase(HWND);
void EditTitleCase(HWND);
void EditSentenceCase(HWND);
void EditURLEncode(HWND);
void EditURLDecode(HWND);
void EditEscapeCChars(HWND);
void EditUnescapeCChars(HWND);
void EditChar2Hex(HWND);
void EditHex2Char(HWND);
void EditFindMatchingBrace(HWND);
void EditSelectToMatchingBrace(HWND);
void EditModifyNumber(HWND,bool);
void EditTabsToSpaces(HWND,int,bool);
void EditSpacesToTabs(HWND,int,bool);
void EditMoveUp(HWND);
void EditMoveDown(HWND);
void EditJumpToSelectionEnd(HWND);
void EditJumpToSelectionStart(HWND);
void EditModifyLines(HWND,LPCWSTR,LPCWSTR);
void EditIndentBlock(HWND,int,bool);
void EditAlignText(HWND,int);
void EditEncloseSelection(HWND,LPCWSTR,LPCWSTR);
void EditToggleLineComments(HWND,LPCWSTR,bool);
void EditPadWithSpaces(HWND,bool,bool);
void EditStripFirstCharacter(HWND);
void EditStripLastCharacter(HWND,bool,bool);
void EditCompressSpaces(HWND);
void EditRemoveBlankLines(HWND,bool,bool);
void EditRemoveDuplicateLines(HWND,bool);
void EditWrapToColumn(HWND,DocPos);
void EditJoinLinesEx(HWND,bool,bool);
void EditSortLines(HWND,int);
void EditJumpTo(HWND, DocLn, DocPos);
void EditScrollTo(HWND, DocLn, int);
void EditSelectEx(HWND, DocPos, DocPos, int, int);
void EditFixPositions(HWND);
void EditEnsureSelectionVisible(HWND);
void EditGetExcerpt(HWND,LPWSTR,DWORD);
HWND EditFindReplaceDlg(HWND,LPCEDITFINDREPLACE,bool);
bool EditFindNext(HWND,LPCEDITFINDREPLACE,bool,bool);
bool EditFindPrev(HWND,LPCEDITFINDREPLACE,bool,bool);
bool EditReplace(HWND,LPCEDITFINDREPLACE);
int EditReplaceAllInRange(HWND,LPCEDITFINDREPLACE,DocPos,DocPos,DocPos*);
bool EditReplaceAll(HWND,LPCEDITFINDREPLACE,bool);
bool EditReplaceAllInSelection(HWND,LPCEDITFINDREPLACE,bool);
bool EditLinenumDlg(HWND);
bool EditModifyLinesDlg(HWND,LPWSTR,LPWSTR);
bool EditEncloseSelectionDlg(HWND,LPWSTR,LPWSTR);
bool EditInsertTagDlg(HWND,LPWSTR,LPWSTR);
bool EditSortDlg(HWND,int*);
bool EditAlignDlg(HWND,int*);
bool EditPrint(HWND,LPCWSTR,LPCWSTR);
void EditPrintSetup(HWND);
void EditPrintInit();
void EditMatchBrace(HWND);
void EditClearAllMarks(HWND, DocPos, DocPos);
void EditMarkAll(HWND, char*, int, DocPos, DocPos, bool, bool);
void EditUpdateUrlHotspots(HWND, DocPos, DocPos, bool);
void EditSetAccelWordNav(HWND,bool);
void EditCompleteWord(HWND,bool);
void EditGetBookmarkList(HWND,LPWSTR,int);
void EditSetBookmarkList(HWND,LPCWSTR);
void EditApplyLexerStyle(HWND, DocPos, DocPos);
void EditFinalizeStyling(HWND, DocPos);
void EditMarkAllOccurrences();
void EditUpdateVisibleUrlHotspot(bool);
void EditEnterTargetTransaction();
void EditLeaveTargetTransaction();
bool EditIsInTargetTransaction();
//void SciInitThemes(HWND);
//LRESULT CALLBACK SciThemedWndProc(HWND,UINT,WPARAM,LPARAM);
#define FV_TABWIDTH 1
#define FV_INDENTWIDTH 2
#define FV_TABSASSPACES 4
#define FV_TABINDENTS 8
#define FV_WORDWRAP 16
#define FV_LONGLINESLIMIT 32
#define FV_ENCODING 64
#define FV_MODE 128
typedef struct _filevars {
int mask;
int iTabWidth;
int iIndentWidth;
bool bTabsAsSpaces;
bool bTabIndents;
bool fWordWrap;
int iLongLinesLimit;
char tchEncoding[32];
int iEncoding;
char tchMode[32];
} FILEVARS, *LPFILEVARS;
bool FileVars_Init(char*,DWORD,LPFILEVARS);
bool FileVars_Apply(HWND,LPFILEVARS);
bool FileVars_ParseInt(char*,char*,int*);
bool FileVars_ParseStr(char*,char*,char*,int);
bool FileVars_IsUTF8(LPFILEVARS);
bool FileVars_IsNonUTF8(LPFILEVARS);
bool FileVars_IsValidEncoding(LPFILEVARS);
int FileVars_GetEncoding(LPFILEVARS);
//
// Folding Functions
//
typedef enum {
EXPAND = 1,
SNIFF = 0,
FOLD = -1
} FOLD_ACTION;
typedef enum {
UP = -1,
NONE = 0,
DOWN = 1
} FOLD_MOVE;
void EditFoldToggleAll(FOLD_ACTION);
void EditFoldClick(DocLn, int);
void EditFoldAltArrow(FOLD_MOVE, FOLD_ACTION);
#endif //_NP3_EDIT_H_
/// End of Edit.h \\\
/******************************************************************************
* *
* *
* Notepad3 *
* *
* Edit.h *
* Text File Editing Helper Stuff *
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
* *
* (c) Rizonesoft 2008-2016 *
* https://rizonesoft.com *
* *
* *
*******************************************************************************/
#pragma once
#ifndef _NP3_EDIT_H_
#define _NP3_EDIT_H_
#include "TypeDefs.h"
// extern "C" declarations of Scintilla functions
int Scintilla_RegisterClasses(void*);
int Scintilla_ReleaseResources();
void EditInitWordDelimiter(HWND);
void EditSetNewText(HWND,char*,DWORD);
bool EditConvertText(HWND,int,int,bool);
bool EditSetNewEncoding(HWND,int,bool,bool);
bool EditIsRecodingNeeded(WCHAR*,int);
char* EditGetClipboardText(HWND,bool,int*,int*);
bool EditSetClipboardText(HWND, const char*);
bool EditClearClipboard(HWND);
void EditPaste2RectSel(HWND,char*);
bool EditPasteClipboard(HWND,bool,bool);
bool EditCopyAppend(HWND,bool);
int EditDetectEOLMode(HWND,char*,DWORD);
bool EditLoadFile(HWND,LPCWSTR,bool,bool,int*,int*,bool*,bool*,bool*);
bool EditSaveFile(HWND,LPCWSTR,int,bool*,bool);
void EditInvertCase(HWND);
void EditTitleCase(HWND);
void EditSentenceCase(HWND);
void EditURLEncode(HWND);
void EditURLDecode(HWND);
void EditEscapeCChars(HWND);
void EditUnescapeCChars(HWND);
void EditChar2Hex(HWND);
void EditHex2Char(HWND);
void EditFindMatchingBrace(HWND);
void EditSelectToMatchingBrace(HWND);
void EditModifyNumber(HWND,bool);
void EditTabsToSpaces(HWND,int,bool);
void EditSpacesToTabs(HWND,int,bool);
void EditMoveUp(HWND);
void EditMoveDown(HWND);
void EditJumpToSelectionEnd(HWND);
void EditJumpToSelectionStart(HWND);
void EditModifyLines(HWND,LPCWSTR,LPCWSTR);
void EditIndentBlock(HWND,int,bool);
void EditAlignText(HWND,int);
void EditEncloseSelection(HWND,LPCWSTR,LPCWSTR);
void EditToggleLineComments(HWND,LPCWSTR,bool);
void EditPadWithSpaces(HWND,bool,bool);
void EditStripFirstCharacter(HWND);
void EditStripLastCharacter(HWND,bool,bool);
void EditCompressSpaces(HWND);
void EditRemoveBlankLines(HWND,bool,bool);
void EditRemoveDuplicateLines(HWND,bool);
void EditWrapToColumn(HWND,DocPos);
void EditJoinLinesEx(HWND,bool,bool);
void EditSortLines(HWND,int);
void EditJumpTo(HWND, DocLn, DocPos);
void EditScrollTo(HWND, DocLn, int);
void EditSelectEx(HWND, DocPos, DocPos, int, int);
void EditFixPositions(HWND);
void EditEnsureSelectionVisible(HWND);
void EditGetExcerpt(HWND,LPWSTR,DWORD);
HWND EditFindReplaceDlg(HWND,LPCEDITFINDREPLACE,bool);
bool EditFindNext(HWND,LPCEDITFINDREPLACE,bool,bool);
bool EditFindPrev(HWND,LPCEDITFINDREPLACE,bool,bool);
bool EditReplace(HWND,LPCEDITFINDREPLACE);
int EditReplaceAllInRange(HWND,LPCEDITFINDREPLACE,DocPos,DocPos,DocPos*);
bool EditReplaceAll(HWND,LPCEDITFINDREPLACE,bool);
bool EditReplaceAllInSelection(HWND,LPCEDITFINDREPLACE,bool);
bool EditLinenumDlg(HWND);
bool EditModifyLinesDlg(HWND,LPWSTR,LPWSTR);
bool EditEncloseSelectionDlg(HWND,LPWSTR,LPWSTR);
bool EditInsertTagDlg(HWND,LPWSTR,LPWSTR);
bool EditSortDlg(HWND,int*);
bool EditAlignDlg(HWND,int*);
bool EditPrint(HWND,LPCWSTR,LPCWSTR);
void EditPrintSetup(HWND);
void EditPrintInit();
void EditMatchBrace(HWND);
void EditClearAllOccurrenceMarkers(HWND, DocPos, DocPos);
bool EditToggleView(HWND hwnd, bool bToggleView);
void EditMarkAll(HWND, char*, int, DocPos, DocPos, bool, bool);
void EditUpdateUrlHotspots(HWND, DocPos, DocPos, bool);
void EditSetAccelWordNav(HWND,bool);
void EditCompleteWord(HWND,bool);
void EditGetBookmarkList(HWND,LPWSTR,int);
void EditSetBookmarkList(HWND,LPCWSTR);
void EditApplyLexerStyle(HWND, DocPos, DocPos);
void EditFinalizeStyling(HWND, DocPos);
void EditMarkAllOccurrences();
void EditUpdateVisibleUrlHotspot(bool);
void EditHideNotMarkedLineRange(HWND, DocPos, DocPos, bool);
void EditEnterTargetTransaction();
void EditLeaveTargetTransaction();
bool EditIsInTargetTransaction();
//void SciInitThemes(HWND);
//LRESULT CALLBACK SciThemedWndProc(HWND,UINT,WPARAM,LPARAM);
#define FV_TABWIDTH 1
#define FV_INDENTWIDTH 2
#define FV_TABSASSPACES 4
#define FV_TABINDENTS 8
#define FV_WORDWRAP 16
#define FV_LONGLINESLIMIT 32
#define FV_ENCODING 64
#define FV_MODE 128
typedef struct _filevars {
int mask;
int iTabWidth;
int iIndentWidth;
bool bTabsAsSpaces;
bool bTabIndents;
bool fWordWrap;
int iLongLinesLimit;
char tchEncoding[32];
int iEncoding;
char tchMode[32];
} FILEVARS, *LPFILEVARS;
bool FileVars_Init(char*,DWORD,LPFILEVARS);
bool FileVars_Apply(HWND,LPFILEVARS);
bool FileVars_ParseInt(char*,char*,int*);
bool FileVars_ParseStr(char*,char*,char*,int);
bool FileVars_IsUTF8(LPFILEVARS);
bool FileVars_IsNonUTF8(LPFILEVARS);
bool FileVars_IsValidEncoding(LPFILEVARS);
int FileVars_GetEncoding(LPFILEVARS);
//
// Folding Functions
//
typedef enum {
EXPAND = 1,
SNIFF = 0,
FOLD = -1
} FOLD_ACTION;
typedef enum {
UP = -1,
NONE = 0,
DOWN = 1
} FOLD_MOVE;
void EditFoldToggleAll(FOLD_ACTION);
void EditFoldClick(DocLn, int);
void EditFoldAltArrow(FOLD_MOVE, FOLD_ACTION);
#endif //_NP3_EDIT_H_
/// End of Edit.h \\\

View File

@ -598,8 +598,7 @@ void SetWindowTransparentMode(HWND hwnd,bool bTransparentMode)
}
else
SetWindowLongPtr(hwnd,GWL_EXSTYLE,
GetWindowLongPtr(hwnd,GWL_EXSTYLE) & ~WS_EX_LAYERED);
SetWindowLongPtr(hwnd,GWL_EXSTYLE,GetWindowLongPtr(hwnd,GWL_EXSTYLE) & ~WS_EX_LAYERED);
}
@ -609,7 +608,6 @@ void SetWindowTransparentMode(HWND hwnd,bool bTransparentMode)
//
void CenterDlgInParent(HWND hDlg)
{
RECT rcDlg;
HWND hParent;
RECT rcParent;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,366 +1,374 @@
/******************************************************************************
* *
* *
* Notepad3 *
* *
* SciCall.h *
* Inline wrappers for Scintilla API calls, arranged in the order and *
* grouping in which they appear in the Scintilla documentation. *
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
* *
* The use of these inline wrapper functions with declared types will *
* ensure that we get the benefit of the compiler's type checking. *
* *
* (c) Rizonesoft 2008-2018 *
* https://rizonesoft.com *
* *
* *
*******************************************************************************/
/******************************************************************************
*
* On Windows, the message - passing scheme used to communicate between the
* container and Scintilla is mediated by the operating system SendMessage
* function and can lead to bad performance when calling intensively.
* To avoid this overhead, Scintilla provides messages that allow you to call
* the Scintilla message function directly.
* The code to do this in C / C++ is of the form :
*
* #include "Scintilla.h"
* SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
* sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
*
* // now a wrapper to call Scintilla directly
* sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
* return pSciMsg(pSciWndData, iMessage, wParam, lParam);
* }
*
* SciFnDirect, sptr_t and uptr_t are declared in Scintilla.h.hSciWnd
* is the window handle returned when you created the Scintilla window.
*
* While faster, this direct calling will cause problems if performed from a
* different thread to the native thread of the Scintilla window in which case
* SendMessage(hSciWnd, SCI_*, wParam, lParam) should be used
* to synchronize with the window's thread.
*
*******************************************************************************/
#define SCI_DIRECTFUNCTION_INTERFACE 1 // disable for asynchronous operation
#pragma once
#ifndef _NP3_SCICALL_H_
#define _NP3_SCICALL_H_
#include "TypeDefs.h"
extern HANDLE g_hScintilla;
extern HANDLE g_hwndEdit;
//=============================================================================
//
// Sci_SendMessage() short version
//
#define Sci_SendMsgV0(CMD) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)0, (LPARAM)0)
#define Sci_SendMsgV1(CMD,WP) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)0)
#define Sci_SendMsgV2(CMD,WP,LP) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)(LP))
#define Sci_PostMsgV0(CMD) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)0, (LPARAM)0)
#define Sci_PostMsgV1(CMD,WP) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)0)
#define Sci_PostMsgV2(CMD,WP,LP) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)(LP))
//=============================================================================
//
// SciCall()
//
#ifdef SCI_DIRECTFUNCTION_INTERFACE
LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM);
#define SciCall(m, w, l) Scintilla_DirectFunction(g_hScintilla, m, w, l)
#else
#define SciCall(m, w, l) SendMessage(g_hwndEdit, m, w, l)
#endif // SCI_DIRECTFUNCTION_INTERFACE
//=============================================================================
//
// DeclareSciCall[RV][0-2] Macros
//
// R: With an explicit return type
// V: No return type defined ("void"); defaults to SendMessage's LRESULT
// 0-2: Number of parameters to define
//
#define DeclareSciCallR0(fn, msg, ret) \
__forceinline ret SciCall_##fn() { \
return((ret)SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallR1(fn, msg, ret, type1, var1) \
__forceinline ret SciCall_##fn(type1 var1) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallR01(fn, msg, ret, type2, var2) \
__forceinline ret SciCall_##fn(type2 var2) { \
return((ret)SciCall(SCI_##msg, 0, (LPARAM)(var2))); \
}
#define DeclareSciCallR2(fn, msg, ret, type1, var1, type2, var2) \
__forceinline ret SciCall_##fn(type1 var1, type2 var2) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
#define DeclareSciCallV0(fn, msg) \
__forceinline LRESULT SciCall_##fn() { \
return(SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallV1(fn, msg, type1, var1) \
__forceinline LRESULT SciCall_##fn(type1 var1) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallV01(fn, msg, type2, var2) \
__forceinline LRESULT SciCall_##fn(type2 var2) { \
return(SciCall(SCI_##msg, 0, (LPARAM)(var2))); \
}
#define DeclareSciCallV2(fn, msg, type1, var1, type2, var2) \
__forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
//=============================================================================
//
// Selection, positions and information
//
DeclareSciCallR0(IsDocModified, GETMODIFY, bool)
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool)
DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
DeclareSciCallR0(CanPaste, CANPASTE, bool)
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, DocPos)
DeclareSciCallR0(GetAnchor, GETANCHOR, DocPos)
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int)
DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, DocPos)
DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, DocPos)
DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, DocPos, DocLn, line)
DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, DocPos, DocLn, line)
// Rectangular selection with virtual space
DeclareSciCallR0(GetRectangularSelectionCaret, GETRECTANGULARSELECTIONCARET, DocPos)
DeclareSciCallV1(SetRectangularSelectionCaret, SETRECTANGULARSELECTIONCARET, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionAnchor, GETRECTANGULARSELECTIONANCHOR, DocPos)
DeclareSciCallV1(SetRectangularSelectionAnchor, SETRECTANGULARSELECTIONANCHOR, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionCaretVirtualSpace, GETRECTANGULARSELECTIONCARETVIRTUALSPACE, DocPos)
DeclareSciCallV1(SetRectangularSelectionCaretVirtualSpace, SETRECTANGULARSELECTIONCARETVIRTUALSPACE, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionAnchorVirtualSpace, GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, DocPos)
DeclareSciCallV1(SetRectangularSelectionAnchorVirtualSpace, SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, DocPos, position)
// Multiselections (Lines of Rectangular selection)
DeclareSciCallV0(ClearSelections, CLEARSELECTIONS)
DeclareSciCallV0(SwapMainAnchorCaret, SWAPMAINANCHORCARET)
DeclareSciCallR0(GetSelections, GETSELECTIONS, DocPosU)
DeclareSciCallR1(GetSelectionNCaret, GETSELECTIONNCARET, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNAnchor, GETSELECTIONNANCHOR, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNCaretVirtualSpace, GETSELECTIONNCARETVIRTUALSPACE, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNAnchorVirtualSpace, GETSELECTIONNANCHORVIRTUALSPACE, DocPos, DocPosU, selnum)
DeclareSciCallV2(SetSelectionNCaret, SETSELECTIONNCARET, DocPosU, selnum, DocPos, caretPos)
DeclareSciCallV2(SetSelectionNAnchor, SETSELECTIONNANCHOR, DocPosU, selnum, DocPos, anchorPos)
DeclareSciCallV2(SetSelectionNCaretVirtualSpace, SETSELECTIONNCARETVIRTUALSPACE, DocPosU, selnum, DocPos, position)
DeclareSciCallV2(SetSelectionNAnchorVirtualSpace, SETSELECTIONNANCHORVIRTUALSPACE, DocPosU, selnum, DocPos, position)
// Operations
DeclareSciCallV0(Cut, CUT)
DeclareSciCallV0(Copy, COPY)
DeclareSciCallV0(Paste, PASTE)
DeclareSciCallV0(Clear, CLEAR)
DeclareSciCallV0(Cancel, CANCEL)
DeclareSciCallV0(CopyAllowLine, COPYALLOWLINE)
DeclareSciCallV0(LineDelete, LINEDELETE)
DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, const char*, text)
DeclareSciCallV2(GetText, GETTEXT, DocPos, length, const char*, text)
DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos)
DeclareSciCallV0(SelectAll, SELECTALL)
DeclareSciCallR01(GetSelText, GETSELTEXT, DocPos, const char*, text)
DeclareSciCallV01(ReplaceSel, REPLACESEL, const char*, text)
DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text)
DeclareSciCallV2(InsertText, INSERTTEXT, DocPos, position, const char*, text)
DeclareSciCallR0(GetTargetStart, GETTARGETSTART, DocPos)
DeclareSciCallR0(GetTargetEnd, GETTARGETEND, DocPos)
DeclareSciCallV0(TargetFromSelection, TARGETFROMSELECTION)
DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, DocPos, start, DocPos, end)
DeclareSciCallR2(ReplaceTarget, REPLACETARGET, DocPos, DocPos, length, const char*, text)
DeclareSciCallV2(AddText, ADDTEXT, DocPos, length, const char*, text)
DeclareSciCallV1(SetAnchor, SETANCHOR, DocPos, position)
DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, DocPos, position)
DeclareSciCallV1(SetMultiPaste, SETMULTIPASTE, int, option)
DeclareSciCallV1(GotoPos, GOTOPOS, DocPos, position)
DeclareSciCallV1(GotoLine, GOTOLINE, DocLn, line)
DeclareSciCallR1(PositionBefore, POSITIONBEFORE, DocPos, DocPos, position)
DeclareSciCallR1(PositionAfter, POSITIONAFTER, DocPos, DocPos, position)
DeclareSciCallR1(GetCharAt, GETCHARAT, char, DocPos, position)
DeclareSciCallR0(GetEOLMode, GETEOLMODE, int)
DeclareSciCallR0(GetLineCount, GETLINECOUNT, DocLn)
DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, DocPos)
DeclareSciCallR1(LineLength, LINELENGTH, DocPos, DocLn, line)
DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, DocLn, DocPos, position)
DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, DocPos, DocLn, line)
DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, DocPos, DocLn, line)
DeclareSciCallR1(GetColumn, GETCOLUMN, DocPos, DocPos, position)
DeclareSciCallR2(FindColumn, FINDCOLUMN, DocPos, DocLn, line, DocPos, column)
DeclareSciCallR1(GetLineIndentPosition, GETLINEINDENTPOSITION, DocPos, DocLn, line)
DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, char* const, DocPos, start, DocPos, length)
DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, const char*)
DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options)
//=============================================================================
//
// Commands
//
DeclareSciCallV0(NewLine, NEWLINE)
//=============================================================================
//
// Scrolling and automatic scrolling
//
DeclareSciCallV2(SetVisiblePolicy, SETVISIBLEPOLICY, int, flags, DocLn, lines)
DeclareSciCallV0(ChooseCaretX, CHOOSECARETX)
DeclareSciCallV0(ScrollCaret, SCROLLCARET)
DeclareSciCallV2(LineScroll, LINESCROLL, DocPos, columns, DocLn, lines)
DeclareSciCallV2(ScrollRange, SCROLLRANGE, DocPos, secondaryPos, DocPos, primaryPos)
DeclareSciCallV1(SetScrollWidth, SETSCROLLWIDTH, int, width)
DeclareSciCallV1(SetEndAtLastLine, SETENDATLASTLINE, bool, flag)
DeclareSciCallR0(GetXoffset, GETXOFFSET, int)
DeclareSciCallV1(SetXoffset, SETXOFFSET, int, offset)
DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, DocLn)
DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, DocLn)
DeclareSciCallV1(SetFirstVisibleLine, SETFIRSTVISIBLELINE, DocLn, line)
DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line)
//=============================================================================
//
// Style definition
//
DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber)
DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber)
DeclareSciCallV2(SetStyling, SETSTYLING, DocPosCR, length, int, style)
DeclareSciCallV1(StartStyling, STARTSTYLING, DocPos, position)
DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int)
//=============================================================================
//
// Margins
//
DeclareSciCallV2(SetMarginType, SETMARGINTYPEN, int, margin, int, type)
DeclareSciCallV2(SetMarginWidth, SETMARGINWIDTHN, int, margin, int, pixelWidth)
DeclareSciCallV2(SetMarginMask, SETMARGINMASKN, int, margin, int, mask)
DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, bool, sensitive)
DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, int, margin, COLORREF, colour)
DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour)
DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour)
//=============================================================================
//
// Markers
//
DeclareSciCallR1(MarkerGet, MARKERGET, int, DocLn, line)
DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols)
DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour)
DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour)
DeclareSciCallR2(MarkerAdd, MARKERADD, int, DocLn, line, int, markerNumber)
DeclareSciCallV2(MarkerDelete, MARKERDELETE, DocLn, line, int, markerNumber)
DeclareSciCallV1(MarkerDeleteAll, MARKERDELETEALL, int, markerNumber)
//=============================================================================
//
// Indicators
//
DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, DocPos, position)
DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPos, length)
//=============================================================================
//
// Folding
//
//
DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, DocLn, line)
DeclareSciCallV2(SetFoldLevel, SETFOLDLEVEL, DocLn, line, int, flags)
DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, DocLn, line)
DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags)
DeclareSciCallV1(FoldDisplayTextSetStyle, FOLDDISPLAYTEXTSETSTYLE, int, flags)
DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, DocLn, line)
DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line)
DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line)
DeclareSciCallV1(FoldAll, FOLDALL, int, flags)
DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line)
DeclareSciCallV1(EnsureVisibleEnforcePolicy, ENSUREVISIBLEENFORCEPOLICY, DocLn, line)
//=============================================================================
//
// Lexer
//
DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value)
//=============================================================================
//
// Cursor
//
DeclareSciCallV1(SetCursor, SETCURSOR, int, flags)
//=============================================================================
//
// Undo/Redo Stack
//
DeclareSciCallR0(GetUndoCollection, GETUNDOCOLLECTION, bool)
//=============================================================================
//
// SetTechnology
//
DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, bool, value)
DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology)
//=============================================================================
//
// Utilities
//
#define Sci_IsStreamSelected() (SciCall_GetSelectionMode() == SC_SEL_STREAM)
#define Sci_IsFullLineSelected() (SciCall_GetSelectionMode() == SC_SEL_LINES)
#define Sci_IsThinRectangleSelected() (SciCall_GetSelectionMode() == SC_SEL_THIN)
#define Sci_IsSingleLineSelection() \
(SciCall_LineFromPosition(SciCall_GetCurrentPos()) == SciCall_LineFromPosition(SciCall_GetAnchor()))
#define Sci_GetEOLLen() ((SciCall_GetEOLMode() == SC_EOL_CRLF) ? 2 : 1)
#define Sci_GetCurrentLine() SciCall_LineFromPosition(SciCall_GetCurrentPos())
// length of line w/o line-end chars (full use SciCall_LineLength()
#define Sci_GetNetLineLength(line) (SciCall_GetLineEndPosition(line) - SciCall_PositionFromLine(line))
//=============================================================================
#endif //_NP3_SCICALL_H_
/******************************************************************************
* *
* *
* Notepad3 *
* *
* SciCall.h *
* Inline wrappers for Scintilla API calls, arranged in the order and *
* grouping in which they appear in the Scintilla documentation. *
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
* *
* The use of these inline wrapper functions with declared types will *
* ensure that we get the benefit of the compiler's type checking. *
* *
* (c) Rizonesoft 2008-2018 *
* https://rizonesoft.com *
* *
* *
*******************************************************************************/
/******************************************************************************
*
* On Windows, the message - passing scheme used to communicate between the
* container and Scintilla is mediated by the operating system SendMessage
* function and can lead to bad performance when calling intensively.
* To avoid this overhead, Scintilla provides messages that allow you to call
* the Scintilla message function directly.
* The code to do this in C / C++ is of the form :
*
* #include "Scintilla.h"
* SciFnDirect pSciMsg = (SciFnDirect)SendMessage(hSciWnd, SCI_GETDIRECTFUNCTION, 0, 0);
* sptr_t pSciWndData = (sptr_t)SendMessage(hSciWnd, SCI_GETDIRECTPOINTER, 0, 0);
*
* // now a wrapper to call Scintilla directly
* sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
* return pSciMsg(pSciWndData, iMessage, wParam, lParam);
* }
*
* SciFnDirect, sptr_t and uptr_t are declared in Scintilla.h.hSciWnd
* is the window handle returned when you created the Scintilla window.
*
* While faster, this direct calling will cause problems if performed from a
* different thread to the native thread of the Scintilla window in which case
* SendMessage(hSciWnd, SCI_*, wParam, lParam) should be used
* to synchronize with the window's thread.
*
*******************************************************************************/
#define SCI_DIRECTFUNCTION_INTERFACE 1 // disable for asynchronous operation
#pragma once
#ifndef _NP3_SCICALL_H_
#define _NP3_SCICALL_H_
#include "TypeDefs.h"
extern HANDLE g_hScintilla;
extern HANDLE g_hwndEdit;
//=============================================================================
//
// Sci_SendMessage() short version
//
#define Sci_SendMsgV0(CMD) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)0, (LPARAM)0)
#define Sci_SendMsgV1(CMD,WP) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)0)
#define Sci_SendMsgV2(CMD,WP,LP) SendMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)(LP))
#define Sci_PostMsgV0(CMD) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)0, (LPARAM)0)
#define Sci_PostMsgV1(CMD,WP) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)0)
#define Sci_PostMsgV2(CMD,WP,LP) PostMessage(g_hwndEdit, SCI_##CMD, (WPARAM)(WP), (LPARAM)(LP))
//=============================================================================
//
// SciCall()
//
#ifdef SCI_DIRECTFUNCTION_INTERFACE
LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM);
#define SciCall(m, w, l) Scintilla_DirectFunction(g_hScintilla, m, w, l)
#else
#define SciCall(m, w, l) SendMessage(g_hwndEdit, m, w, l)
#endif // SCI_DIRECTFUNCTION_INTERFACE
//=============================================================================
//
// DeclareSciCall[RV][0-2] Macros
//
// R: With an explicit return type
// V: No return type defined ("void"); defaults to SendMessage's LRESULT
// 0-2: Number of parameters to define
//
#define DeclareSciCallR0(fn, msg, ret) \
__forceinline ret SciCall_##fn() { \
return((ret)SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallR1(fn, msg, ret, type1, var1) \
__forceinline ret SciCall_##fn(type1 var1) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallR01(fn, msg, ret, type2, var2) \
__forceinline ret SciCall_##fn(type2 var2) { \
return((ret)SciCall(SCI_##msg, 0, (LPARAM)(var2))); \
}
#define DeclareSciCallR2(fn, msg, ret, type1, var1, type2, var2) \
__forceinline ret SciCall_##fn(type1 var1, type2 var2) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
#define DeclareSciCallV0(fn, msg) \
__forceinline LRESULT SciCall_##fn() { \
return(SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallV1(fn, msg, type1, var1) \
__forceinline LRESULT SciCall_##fn(type1 var1) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallV01(fn, msg, type2, var2) \
__forceinline LRESULT SciCall_##fn(type2 var2) { \
return(SciCall(SCI_##msg, 0, (LPARAM)(var2))); \
}
#define DeclareSciCallV2(fn, msg, type1, var1, type2, var2) \
__forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
//=============================================================================
//
// Selection, positions and information
//
DeclareSciCallR0(GetReadOnly, GETREADONLY, bool)
DeclareSciCallV1(SetReadOnly, SETREADONLY, bool, flag)
DeclareSciCallR0(CanUndo, CANUNDO, bool)
DeclareSciCallR0(CanRedo, CANREDO, bool)
DeclareSciCallR0(IsDocModified, GETMODIFY, bool)
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, bool)
DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
DeclareSciCallR0(CanPaste, CANPASTE, bool)
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, DocPos)
DeclareSciCallR0(GetAnchor, GETANCHOR, DocPos)
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int)
DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, DocPos)
DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, DocPos)
DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, DocPos, DocLn, line)
DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, DocPos, DocLn, line)
// Rectangular selection with virtual space
DeclareSciCallR0(GetRectangularSelectionCaret, GETRECTANGULARSELECTIONCARET, DocPos)
DeclareSciCallV1(SetRectangularSelectionCaret, SETRECTANGULARSELECTIONCARET, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionAnchor, GETRECTANGULARSELECTIONANCHOR, DocPos)
DeclareSciCallV1(SetRectangularSelectionAnchor, SETRECTANGULARSELECTIONANCHOR, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionCaretVirtualSpace, GETRECTANGULARSELECTIONCARETVIRTUALSPACE, DocPos)
DeclareSciCallV1(SetRectangularSelectionCaretVirtualSpace, SETRECTANGULARSELECTIONCARETVIRTUALSPACE, DocPos, position)
DeclareSciCallR0(GetRectangularSelectionAnchorVirtualSpace, GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, DocPos)
DeclareSciCallV1(SetRectangularSelectionAnchorVirtualSpace, SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, DocPos, position)
// Multiselections (Lines of Rectangular selection)
DeclareSciCallV0(ClearSelections, CLEARSELECTIONS)
DeclareSciCallV0(SwapMainAnchorCaret, SWAPMAINANCHORCARET)
DeclareSciCallR0(GetSelections, GETSELECTIONS, DocPosU)
DeclareSciCallR1(GetSelectionNCaret, GETSELECTIONNCARET, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNAnchor, GETSELECTIONNANCHOR, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNCaretVirtualSpace, GETSELECTIONNCARETVIRTUALSPACE, DocPos, DocPosU, selnum)
DeclareSciCallR1(GetSelectionNAnchorVirtualSpace, GETSELECTIONNANCHORVIRTUALSPACE, DocPos, DocPosU, selnum)
DeclareSciCallV2(SetSelectionNCaret, SETSELECTIONNCARET, DocPosU, selnum, DocPos, caretPos)
DeclareSciCallV2(SetSelectionNAnchor, SETSELECTIONNANCHOR, DocPosU, selnum, DocPos, anchorPos)
DeclareSciCallV2(SetSelectionNCaretVirtualSpace, SETSELECTIONNCARETVIRTUALSPACE, DocPosU, selnum, DocPos, position)
DeclareSciCallV2(SetSelectionNAnchorVirtualSpace, SETSELECTIONNANCHORVIRTUALSPACE, DocPosU, selnum, DocPos, position)
// Operations
DeclareSciCallV0(Cut, CUT)
DeclareSciCallV0(Copy, COPY)
DeclareSciCallV0(Paste, PASTE)
DeclareSciCallV0(Clear, CLEAR)
DeclareSciCallV0(Cancel, CANCEL)
DeclareSciCallV0(CopyAllowLine, COPYALLOWLINE)
DeclareSciCallV0(LineDelete, LINEDELETE)
DeclareSciCallV2(CopyText, COPYTEXT, DocPos, length, const char*, text)
DeclareSciCallV2(GetText, GETTEXT, DocPos, length, const char*, text)
DeclareSciCallV2(SetSel, SETSEL, DocPos, anchorPos, DocPos, currentPos)
DeclareSciCallV0(SelectAll, SELECTALL)
DeclareSciCallR01(GetSelText, GETSELTEXT, DocPos, const char*, text)
DeclareSciCallV01(ReplaceSel, REPLACESEL, const char*, text)
DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text)
DeclareSciCallV2(InsertText, INSERTTEXT, DocPos, position, const char*, text)
DeclareSciCallR0(GetTargetStart, GETTARGETSTART, DocPos)
DeclareSciCallR0(GetTargetEnd, GETTARGETEND, DocPos)
DeclareSciCallV0(TargetFromSelection, TARGETFROMSELECTION)
DeclareSciCallV2(SetTargetRange, SETTARGETRANGE, DocPos, start, DocPos, end)
DeclareSciCallR2(ReplaceTarget, REPLACETARGET, DocPos, DocPos, length, const char*, text)
DeclareSciCallV2(AddText, ADDTEXT, DocPos, length, const char*, text)
DeclareSciCallV1(SetAnchor, SETANCHOR, DocPos, position)
DeclareSciCallV1(SetCurrentPos, SETCURRENTPOS, DocPos, position)
DeclareSciCallV1(SetMultiPaste, SETMULTIPASTE, int, option)
DeclareSciCallV1(GotoPos, GOTOPOS, DocPos, position)
DeclareSciCallV1(GotoLine, GOTOLINE, DocLn, line)
DeclareSciCallR1(PositionBefore, POSITIONBEFORE, DocPos, DocPos, position)
DeclareSciCallR1(PositionAfter, POSITIONAFTER, DocPos, DocPos, position)
DeclareSciCallR1(GetCharAt, GETCHARAT, char, DocPos, position)
DeclareSciCallR0(GetEOLMode, GETEOLMODE, int)
DeclareSciCallR0(GetLineCount, GETLINECOUNT, DocLn)
DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, DocPos)
DeclareSciCallR1(LineLength, LINELENGTH, DocPos, DocLn, line)
DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, DocLn, DocPos, position)
DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, DocPos, DocLn, line)
DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, DocPos, DocLn, line)
DeclareSciCallR1(GetColumn, GETCOLUMN, DocPos, DocPos, position)
DeclareSciCallR2(FindColumn, FINDCOLUMN, DocPos, DocLn, line, DocPos, column)
DeclareSciCallR1(GetLineIndentPosition, GETLINEINDENTPOSITION, DocPos, DocLn, line)
DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, char* const, DocPos, start, DocPos, length)
DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, const char*)
DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options)
//=============================================================================
//
// Commands
//
DeclareSciCallV0(NewLine, NEWLINE)
//=============================================================================
//
// Scrolling and automatic scrolling
//
DeclareSciCallV2(SetVisiblePolicy, SETVISIBLEPOLICY, int, flags, DocLn, lines)
DeclareSciCallV0(ChooseCaretX, CHOOSECARETX)
DeclareSciCallV0(ScrollCaret, SCROLLCARET)
DeclareSciCallV2(LineScroll, LINESCROLL, DocPos, columns, DocLn, lines)
DeclareSciCallV2(ScrollRange, SCROLLRANGE, DocPos, secondaryPos, DocPos, primaryPos)
DeclareSciCallV1(SetScrollWidth, SETSCROLLWIDTH, int, width)
DeclareSciCallV1(SetEndAtLastLine, SETENDATLASTLINE, bool, flag)
DeclareSciCallR0(GetXoffset, GETXOFFSET, int)
DeclareSciCallV1(SetXoffset, SETXOFFSET, int, offset)
DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, DocLn)
DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, DocLn)
DeclareSciCallV1(SetFirstVisibleLine, SETFIRSTVISIBLELINE, DocLn, line)
DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line)
//=============================================================================
//
// Style definition
//
DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber)
DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber)
DeclareSciCallV2(SetStyling, SETSTYLING, DocPosCR, length, int, style)
DeclareSciCallV1(StartStyling, STARTSTYLING, DocPos, position)
DeclareSciCallR0(GetEndStyled, GETENDSTYLED, DocPos)
//=============================================================================
//
// Margins
//
DeclareSciCallV2(SetMarginType, SETMARGINTYPEN, int, margin, int, type)
DeclareSciCallV2(SetMarginWidth, SETMARGINWIDTHN, int, margin, int, pixelWidth)
DeclareSciCallV2(SetMarginMask, SETMARGINMASKN, int, margin, int, mask)
DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, bool, sensitive)
DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, int, margin, COLORREF, colour)
DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour)
DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour)
//=============================================================================
//
// Markers
//
DeclareSciCallR1(MarkerGet, MARKERGET, int, DocLn, line)
DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols)
DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour)
DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour)
DeclareSciCallV2(MarkerSetAlpha, MARKERSETALPHA, int, markerNumber, int, alpha)
DeclareSciCallR2(MarkerAdd, MARKERADD, int, DocLn, line, int, markerNumber)
DeclareSciCallV2(MarkerDelete, MARKERDELETE, DocLn, line, int, markerNumber)
DeclareSciCallV1(MarkerDeleteAll, MARKERDELETEALL, int, markerNumber)
//=============================================================================
//
// Indicators
//
DeclareSciCallR2(IndicatorValueAt, INDICATORVALUEAT, int, int, indicatorID, DocPos, position)
DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPos, length)
//=============================================================================
//
// Folding
//
//
DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, DocLn, line)
DeclareSciCallV2(SetFoldLevel, SETFOLDLEVEL, DocLn, line, int, flags)
DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, DocLn, line)
DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags)
DeclareSciCallV1(FoldDisplayTextSetStyle, FOLDDISPLAYTEXTSETSTYLE, int, flags)
DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, DocLn, line)
DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line)
DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line)
DeclareSciCallV1(FoldAll, FOLDALL, int, flags)
DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line)
DeclareSciCallV1(EnsureVisibleEnforcePolicy, ENSUREVISIBLEENFORCEPOLICY, DocLn, line)
//=============================================================================
//
// Lexer
//
DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value)
DeclareSciCallV2(Colourise, COLOURISE, DocPos, startPos, DocPos, endPos)
//=============================================================================
//
// Cursor
//
DeclareSciCallV1(SetCursor, SETCURSOR, int, flags)
//=============================================================================
//
// Undo/Redo Stack
//
DeclareSciCallR0(GetUndoCollection, GETUNDOCOLLECTION, bool)
//=============================================================================
//
// SetTechnology
//
DeclareSciCallV1(SetBufferedDraw, SETBUFFEREDDRAW, bool, value)
DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology)
//=============================================================================
//
// Utilities
//
#define Sci_IsStreamSelected() (SciCall_GetSelectionMode() == SC_SEL_STREAM)
#define Sci_IsFullLineSelected() (SciCall_GetSelectionMode() == SC_SEL_LINES)
#define Sci_IsThinRectangleSelected() (SciCall_GetSelectionMode() == SC_SEL_THIN)
#define Sci_IsSingleLineSelection() \
(SciCall_LineFromPosition(SciCall_GetCurrentPos()) == SciCall_LineFromPosition(SciCall_GetAnchor()))
#define Sci_GetEOLLen() ((SciCall_GetEOLMode() == SC_EOL_CRLF) ? 2 : 1)
#define Sci_GetCurrentLine() SciCall_LineFromPosition(SciCall_GetCurrentPos())
// length of line w/o line-end chars (full use SciCall_LineLength()
#define Sci_GetNetLineLength(line) (SciCall_GetLineEndPosition(line) - SciCall_PositionFromLine(line))
//=============================================================================
#endif //_NP3_SCICALL_H_

13178
src/Styles.c

File diff suppressed because it is too large Load Diff

View File

@ -71,6 +71,8 @@ bool Style_Import(HWND);
bool Style_Export(HWND);
void Style_SetLexer(HWND,PEDITLEXER);
void Style_SetUrlHotSpot(HWND, bool);
void Style_SetInvisible(HWND, bool);
void Style_SetReadonly(HWND, bool);
void Style_SetLongLineColors(HWND);
void Style_SetCurrentLineBackground(HWND, bool);
void Style_SetFolding(HWND, bool);
@ -116,6 +118,8 @@ HWND Style_CustomizeSchemesDlg(HWND);
INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND,UINT,WPARAM,LPARAM);
void Style_SelectLexerDlg(HWND);
int Style_GetHotspotStyleID();
int Style_GetInvisibleStyleID();
int Style_GetReadonlyStyleID();
bool Style_StrGetWeightValue(LPCWSTR,int*);
void Style_AppendWeightStr(LPWSTR, int, int);

View File

@ -40,38 +40,93 @@
#endif
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
typedef struct _wi
{
int x;
int y;
int cx;
int cy;
int max;
} WININFO;
typedef struct _wi
{
int x;
int y;
int cx;
int cy;
int max;
} WININFO;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
typedef enum BufferSizes
{
MICRO_BUFFER = 32,
MINI_BUFFER = 64,
SMALL_BUFFER = 128,
MIDSZ_BUFFER = 256,
LARGE_BUFFER = 512,
HUGE_BUFFER = 1024,
XHUGE_BUFFER = 2048,
typedef enum BufferSizes
{
MICRO_BUFFER = 32,
MINI_BUFFER = 64,
SMALL_BUFFER = 128,
MIDSZ_BUFFER = 256,
LARGE_BUFFER = 512,
HUGE_BUFFER = 1024,
XHUGE_BUFFER = 2048,
FILE_ARG_BUF = MAX_PATH + 2,
FNDRPL_BUFFER = 1024,
TEMPLINE_BUFFER = 4096
FILE_ARG_BUF = MAX_PATH + 2,
FNDRPL_BUFFER = 1024,
TEMPLINE_BUFFER = 4096
} BUFFER_SIZES;
} BUFFER_SIZES;
typedef enum { FND_NOP = 0, NXT_NOT_FND, NXT_FND, NXT_WRP_FND, PRV_NOT_FND, PRV_FND, PRV_WRP_FND } FR_STATES;
typedef enum { FRMOD_IGNORE = 0, FRMOD_NORM, FRMOD_WRAPED } FR_UPD_MODES;
typedef enum { FND_NOP = 0, NXT_NOT_FND, NXT_FND, NXT_WRP_FND, PRV_NOT_FND, PRV_FND, PRV_WRP_FND } FR_STATES;
typedef enum { FRMOD_IGNORE = 0, FRMOD_NORM, FRMOD_WRAPED } FR_UPD_MODES;
typedef enum { MBINFO = 0, MBWARN, MBYESNO, MBYESNOWARN, MBYESNOCANCEL, MBOKCANCEL, MBRETRYCANCEL } MBTYPES;
// --------------------------------------------------------------------------
typedef struct _editfindreplace
{
char szFind[FNDRPL_BUFFER];
char szReplace[FNDRPL_BUFFER];
UINT fuFlags;
bool bTransformBS;
bool bFindClose;
bool bReplaceClose;
bool bNoFindWrap;
bool bWildcardSearch;
bool bMarkOccurences;
bool bHideNonMatchedLines;
bool bDotMatchAll;
bool bStateChanged;
HWND hwnd;
} EDITFINDREPLACE, *LPEDITFINDREPLACE, *LPCEDITFINDREPLACE;
#define EFR_INIT_DATA { "", "", 0, false, false, false, false, false, false, false, false, true, NULL }
#define IDMSG_SWITCHTOFIND 300
#define IDMSG_SWITCHTOREPLACE 301
// --------------------------------------------------------------------------
typedef struct _cmq
{
HWND hwnd;
UINT cmd;
WPARAM wparam;
LPARAM lparam;
int delay;
struct _cmq* next;
struct _cmq* prev;
} CmdMessageQueue_t;
#define MESSAGE_QUEUE_INIT = { NULL, WM_COMMAND, NULL, NULL, -1 };
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#define MARKER_NP3_BOOKMARK 1
#define MARKER_NP3_OCCUR_LINE 2
#define INDIC_NP3_MARK_OCCURANCE 1
#define INDIC_NP3_MATCH_BRACE 2
#define INDIC_NP3_BAD_BRACE 3
// --------------------------------------------------------------------------
//=============================================================================

Binary file not shown.

View File

@ -5,9 +5,9 @@
// //////////////////////////////////////////////////////////
#define VERSION_MAJOR 3
#define VERSION_MINOR 18
#define VERSION_REV 311
#define VERSION_BUILD 928
#define VERSION_REV 329
#define VERSION_BUILD 960
#define SCINTILLA_VER 403
#define ONIGMO_REGEX_VER 6.1.3
#define VERSION_PATCH L""
#define VERSIONA_PATCH ""
#define VERSION_PATCH L" develop"
#define VERSIONA_PATCH " develop"

File diff suppressed because it is too large Load Diff